From c2d396b20c1b0fc1ed3b070a41c9ed07c3930bde Mon Sep 17 00:00:00 2001 From: Luke Shumaker Date: Sat, 27 Jul 2013 15:19:11 -0600 Subject: revamp the Makefiles to support manpages --- .gitignore | 16 ++++++++++++++ common.mk | 51 ++++++++++++++++++++++++++++++++++++++------- config.mk | 2 ++ doc/Makefile | 18 ++++++++++++++-- src/Makefile | 2 +- src/abslibre-tools/Makefile | 2 +- src/chroot-tools/Makefile | 2 +- src/fullpkg/Makefile | 2 +- src/librefetch/Makefile | 2 +- src/mips64el-tools/Makefile | 2 +- src/toru/Makefile | 2 +- 11 files changed, 85 insertions(+), 16 deletions(-) diff --git a/.gitignore b/.gitignore index 1f2308d..46da0e5 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,18 @@ *~ #* +*.1 +*.2 +*.3 +*.4 +*.5 +*.6 +*.7 +*.8 +*.1.html +*.2.html +*.3.html +*.4.html +*.5.html +*.6.html +*.7.html +*.8.html diff --git a/common.mk b/common.mk index bbb1b7c..a2aa260 100644 --- a/common.mk +++ b/common.mk @@ -2,20 +2,57 @@ topdir := $(dir $(lastword $(MAKEFILE_LIST))) include $(topdir)/config.mk ################################################################################ -progs = $(shell find . -maxdepth 1 -type f -executable -printf '%f\n') -confs = $(shell find . -maxdepth 1 -type f -not -executable -printf '%f\n'|fgrep -v Makefile) -files = $(addprefix $(DESTDIR)$(libre_execdir)/,$(progs)) \ - $(addprefix $(DESTDIR)$(libre_datadir)/,$(confs)) + +progs = $(shell find . -maxdepth 1 -type f -executable -printf '%f\n') +confs = $(shell find . -maxdepth 1 -type f -name '*.conf' -printf '%f\n') +mans = $(shell find . -maxdepth 1 -type f -name '*.ronn' -printf '%f\n' | sed 's/\.ronn$$//') all: PHONY build -build: PHONY +################################################################################ + +build_files = $(progs) $(confs) $(mans) +build: PHONY $(build_files) + +%: %.ronn + ronn --roff $(RONNFLAGS) '$<' +%.html: %.ronn + ronn --html $(RONNFLAGS) '$<' -install: PHONY $(files) +################################################################################ + +install_files = $(addprefix $(DESTDIR)$(libre_execdir)/,$(progs)) \ + $(addprefix $(DESTDIR)$(libre_confdir)/,$(confs)) \ + $(addprefix $(DESTDIR)$(mandir)/man1/,$(filter %.1,$(mans))) \ + $(addprefix $(DESTDIR)$(mandir)/man2/,$(filter %.2,$(mans))) \ + $(addprefix $(DESTDIR)$(mandir)/man3/,$(filter %.3,$(mans))) \ + $(addprefix $(DESTDIR)$(mandir)/man4/,$(filter %.4,$(mans))) \ + $(addprefix $(DESTDIR)$(mandir)/man5/,$(filter %.5,$(mans))) \ + $(addprefix $(DESTDIR)$(mandir)/man6/,$(filter %.6,$(mans))) \ + $(addprefix $(DESTDIR)$(mandir)/man7/,$(filter %.7,$(mans))) \ + $(addprefix $(DESTDIR)$(mandir)/man8/,$(filter %.8,$(mans))) +install: PHONY $(install_files) $(DESTDIR)$(libre_execdir)/%: % install -Dm755 '$<' '$@' -$(DESTDIR)$(libre_datadir)/%: % +$(DESTDIR)$(libre_confdir)/%: % + install -Dm644 '$<' '$@' + +$(DESTDIR)$(mandir)/man1/%.1: %.1 + install -Dm644 '$<' '$@' +$(DESTDIR)$(mandir)/man2/%.2: %.2 + install -Dm644 '$<' '$@' +$(DESTDIR)$(mandir)/man3/%.3: %.3 + install -Dm644 '$<' '$@' +$(DESTDIR)$(mandir)/man4/%.4: %.4 + install -Dm644 '$<' '$@' +$(DESTDIR)$(mandir)/man5/%.5: %.5 + install -Dm644 '$<' '$@' +$(DESTDIR)$(mandir)/man6/%.6: %.6 + install -Dm644 '$<' '$@' +$(DESTDIR)$(mandir)/man7/%.7: %.7 + install -Dm644 '$<' '$@' +$(DESTDIR)$(mandir)/man8/%.8: %.8 install -Dm644 '$<' '$@' ################################################################################ diff --git a/config.mk b/config.mk index 5d07d8d..3eeb9f6 100644 --- a/config.mk +++ b/config.mk @@ -21,5 +21,7 @@ datadir=$(datarootdir) sysconfdir=/etc docdir=$(datarootdir)/doc +mandir=$(datarootdir)/man devtoolsdir=$(topdir)/../devtools-par +RONNFLAGS=--manual='libretools Manual' --organization='Parabola' diff --git a/doc/Makefile b/doc/Makefile index 7af3750..4e496f3 100644 --- a/doc/Makefile +++ b/doc/Makefile @@ -1,2 +1,16 @@ -libre_datadir=$(docdir)/libretools -include ../common.mk +topdir := $(realpath ..) +include $(topdir)/config.mk + +files = $(wildcard *.md) + +all: PHONY build +build: PHONY + +install: $(addprefix $(DESTDIR)$(docdir)/libretools/,$(files)) + +$(DESTDIR)$(docdir)/libretools/%: % + install -Dm644 '$<' '$@' + +FORCE: PHONY +PHONY: +.PHONY: FORCE PHONY diff --git a/src/Makefile b/src/Makefile index ff8d399..35a92a0 100644 --- a/src/Makefile +++ b/src/Makefile @@ -1,3 +1,3 @@ libre_execdir=$(bindir) -libre_datadir=$(sysconfdir) +libre_confdir=$(sysconfdir) include ../common.mk diff --git a/src/abslibre-tools/Makefile b/src/abslibre-tools/Makefile index f2cec54..271cc5e 100644 --- a/src/abslibre-tools/Makefile +++ b/src/abslibre-tools/Makefile @@ -1,3 +1,3 @@ libre_execdir=$(bindir) -libre_datadir=$(sysconfdir)/libretools.d +libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile index 3ae95ea..27030e3 100644 --- a/src/chroot-tools/Makefile +++ b/src/chroot-tools/Makefile @@ -1,3 +1,3 @@ libre_execdir=$(sbindir) -libre_datadir=$(sysconfdir)/libretools.d +libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/fullpkg/Makefile b/src/fullpkg/Makefile index f2cec54..271cc5e 100644 --- a/src/fullpkg/Makefile +++ b/src/fullpkg/Makefile @@ -1,3 +1,3 @@ libre_execdir=$(bindir) -libre_datadir=$(sysconfdir)/libretools.d +libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/librefetch/Makefile b/src/librefetch/Makefile index f2cec54..271cc5e 100644 --- a/src/librefetch/Makefile +++ b/src/librefetch/Makefile @@ -1,3 +1,3 @@ libre_execdir=$(bindir) -libre_datadir=$(sysconfdir)/libretools.d +libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/mips64el-tools/Makefile b/src/mips64el-tools/Makefile index f2cec54..271cc5e 100644 --- a/src/mips64el-tools/Makefile +++ b/src/mips64el-tools/Makefile @@ -1,3 +1,3 @@ libre_execdir=$(bindir) -libre_datadir=$(sysconfdir)/libretools.d +libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk diff --git a/src/toru/Makefile b/src/toru/Makefile index f2cec54..271cc5e 100644 --- a/src/toru/Makefile +++ b/src/toru/Makefile @@ -1,3 +1,3 @@ libre_execdir=$(bindir) -libre_datadir=$(sysconfdir)/libretools.d +libre_confdir=$(sysconfdir)/libretools.d include ../../common.mk -- cgit v1.2.3-54-g00ecf