summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2020-01-26 11:47:05 +0200
committerTimo Teräs <timo.teras@iki.fi>2020-01-26 11:47:05 +0200
commit0867d629b96d3f5e312d9670f51581e7225e3aad (patch)
tree167e29cb2ac47db2846eb7a1dd062bcbb1d48898
parentee24da7d3607bad67d280b9c3b46a8a43b361e07 (diff)
downloadapk-tools-0867d629b96d3f5e312d9670f51581e7225e3aad.tar.gz
apk-tools-0867d629b96d3f5e312d9670f51581e7225e3aad.tar.bz2
apk-tools-0867d629b96d3f5e312d9670f51581e7225e3aad.tar.xz
apk-tools-0867d629b96d3f5e312d9670f51581e7225e3aad.zip
convert man page makefile to make.rules format
-rw-r--r--Make.rules30
-rw-r--r--doc/Makefile67
2 files changed, 54 insertions, 43 deletions
diff --git a/Make.rules b/Make.rules
index aab5f71..1962457 100644
--- a/Make.rules
+++ b/Make.rules
@@ -89,6 +89,9 @@ endif
ifneq ($(origin targets),file)
targets :=
endif
+ifneq ($(origin docs),file)
+docs :=
+endif
src :=
obj :=
@@ -259,6 +262,18 @@ $(__progs): $(obj)/%: $(cobjs) FORCE
targets += $(__progs) $(cobjs)
+#####
+# Man pages
+
+quiet_cmd_scdoc = SCDOC $@
+ cmd_scdoc = $(SCDOC) < $< > $@
+
+__scdocs := $(addprefix $(obj)/,$(sort $(scdocs-y)))
+docs += $(__scdocs)
+
+$(__scdocs): $(obj)/%: $(src)/%.scd FORCE
+ $(call if_changed,scdoc)
+
###
# why - tell why a a target got build
ifeq ($(VERBOSE),2)
@@ -268,9 +283,9 @@ why = \
$(if $(strip $(any-prereq)),- due to: $(any-prereq), \
$(if $(arg-check), \
$(if $(cmd_$@),- due to command line change: $(arg-check), \
- $(if $(filter $@, $(targets)), \
+ $(if $(filter $@, $(targets) $(docs)), \
- due to missing .cmd file, \
- - due to $(notdir $@) not in $$(targets) \
+ - due to $(notdir $@) not in $$(targets) or $$(docs) \
) \
) \
) \
@@ -291,7 +306,10 @@ endif
compile: generate $(targets)
@:
-install: $(targets) FORCE
+docs: $(docs) $(targets)
+ @:
+
+install: docs $(targets) FORCE
generate:
@@ -305,7 +323,8 @@ endif
$(sort $(progs-y) $(progs-n) $(progs-) \
$(shlibs-y) $(shlibs-n) $(shlibs-) \
$(libs-y) $(libs-n) $(libs-) \
- $(generate-y) $(generate-n) $(generate-)))
+ $(generate-y) $(generate-n) $(generate-) \
+ $(scdocs-y) $(scdocs-n) $(scdocs-)))
ifeq ($(origin VERSION),command line)
DIST_VERSION=$(VERSION)
@@ -326,7 +345,8 @@ FORCE:
# exist, we will rebuild anyway in that case.
targets := $(wildcard $(sort $(targets)))
-cmd_files := $(wildcard $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd))
+docs := $(wildcard $(sort $(docs)))
+cmd_files := $(wildcard $(foreach f,$(targets) $(docs),$(dir $(f)).$(notdir $(f)).cmd))
ifneq ($(cmd_files),)
include $(cmd_files)
diff --git a/doc/Makefile b/doc/Makefile
index 23d8972..21d5e03 100644
--- a/doc/Makefile
+++ b/doc/Makefile
@@ -1,39 +1,30 @@
-$(obj)/%: $(src)/%.scd
- $(SCDOC) < $< > $@
+scdocs-y += \
+ apk-cache.5 \
+ apk-keys.5 \
+ apk-repositories.5 \
+ apk-world.5 \
+ apk.8 \
+ apk-add.8 \
+ apk-audit.8 \
+ apk-cache.8 \
+ apk-del.8 \
+ apk-dot.8 \
+ apk-fetch.8 \
+ apk-fix.8 \
+ apk-index.8 \
+ apk-info.8 \
+ apk-list.8 \
+ apk-manifest.8 \
+ apk-policy.8 \
+ apk-stats.8 \
+ apk-update.8 \
+ apk-upgrade.8 \
+ apk-verify.8 \
+ apk-version.8
-MAN_5=$(obj)/apk-cache.5 \
- $(obj)/apk-keys.5 \
- $(obj)/apk-repositories.5 \
- $(obj)/apk-world.5
-
-MAN_8=$(obj)/apk.8 \
- $(obj)/apk-add.8 \
- $(obj)/apk-audit.8 \
- $(obj)/apk-cache.8 \
- $(obj)/apk-del.8 \
- $(obj)/apk-dot.8 \
- $(obj)/apk-fetch.8 \
- $(obj)/apk-fix.8 \
- $(obj)/apk-index.8 \
- $(obj)/apk-info.8 \
- $(obj)/apk-list.8 \
- $(obj)/apk-manifest.8 \
- $(obj)/apk-policy.8 \
- $(obj)/apk-stats.8 \
- $(obj)/apk-update.8 \
- $(obj)/apk-upgrade.8 \
- $(obj)/apk-verify.8 \
- $(obj)/apk-version.8
-
-docs: $(MAN_5) $(MAN_8)
-targets += docs
-
-install.5: $(MAN_5)
- $(INSTALLDIR) $(DESTDIR)$(MANDIR)/man5
- for page in $^; do $(INSTALL) $$page $(DESTDIR)$(MANDIR)/man5/; done
-
-install.8: $(MAN_8)
- $(INSTALLDIR) $(DESTDIR)$(MANDIR)/man8
- for page in $^; do $(INSTALL) $$page $(DESTDIR)$(MANDIR)/man8/; done
-
-install: install.5 install.8
+install:
+ for page in $(scdocs-y); do \
+ section=$${page#*.}; \
+ $(INSTALLDIR) $(DESTDIR)$(MANDIR)/man$$section; \
+ $(INSTALL) $(obj)/$$page $(DESTDIR)$(MANDIR)/man$$section/; \
+ done