Commit 0867d629 authored by Timo Teräs's avatar Timo Teräs

convert man page makefile to make.rules format

parent ee24da7d
...@@ -89,6 +89,9 @@ endif ...@@ -89,6 +89,9 @@ endif
ifneq ($(origin targets),file) ifneq ($(origin targets),file)
targets := targets :=
endif endif
ifneq ($(origin docs),file)
docs :=
endif
src := src :=
obj := obj :=
...@@ -259,6 +262,18 @@ $(__progs): $(obj)/%: $(cobjs) FORCE ...@@ -259,6 +262,18 @@ $(__progs): $(obj)/%: $(cobjs) FORCE
targets += $(__progs) $(cobjs) 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 # why - tell why a a target got build
ifeq ($(VERBOSE),2) ifeq ($(VERBOSE),2)
...@@ -268,9 +283,9 @@ why = \ ...@@ -268,9 +283,9 @@ why = \
$(if $(strip $(any-prereq)),- due to: $(any-prereq), \ $(if $(strip $(any-prereq)),- due to: $(any-prereq), \
$(if $(arg-check), \ $(if $(arg-check), \
$(if $(cmd_$@),- due to command line change: $(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 missing .cmd file, \
- due to $(notdir $@) not in $$(targets) \ - due to $(notdir $@) not in $$(targets) or $$(docs) \
) \ ) \
) \ ) \
) \ ) \
...@@ -291,7 +306,10 @@ endif ...@@ -291,7 +306,10 @@ endif
compile: generate $(targets) compile: generate $(targets)
@: @:
install: $(targets) FORCE docs: $(docs) $(targets)
@:
install: docs $(targets) FORCE
generate: generate:
...@@ -305,7 +323,8 @@ endif ...@@ -305,7 +323,8 @@ endif
$(sort $(progs-y) $(progs-n) $(progs-) \ $(sort $(progs-y) $(progs-n) $(progs-) \
$(shlibs-y) $(shlibs-n) $(shlibs-) \ $(shlibs-y) $(shlibs-n) $(shlibs-) \
$(libs-y) $(libs-n) $(libs-) \ $(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) ifeq ($(origin VERSION),command line)
DIST_VERSION=$(VERSION) DIST_VERSION=$(VERSION)
...@@ -326,7 +345,8 @@ FORCE: ...@@ -326,7 +345,8 @@ FORCE:
# exist, we will rebuild anyway in that case. # exist, we will rebuild anyway in that case.
targets := $(wildcard $(sort $(targets))) 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),) ifneq ($(cmd_files),)
include $(cmd_files) include $(cmd_files)
......
$(obj)/%: $(src)/%.scd scdocs-y += \
$(SCDOC) < $< > $@ 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 \ install:
$(obj)/apk-keys.5 \ for page in $(scdocs-y); do \
$(obj)/apk-repositories.5 \ section=$${page#*.}; \
$(obj)/apk-world.5 $(INSTALLDIR) $(DESTDIR)$(MANDIR)/man$$section; \
$(INSTALL) $(obj)/$$page $(DESTDIR)$(MANDIR)/man$$section/; \
MAN_8=$(obj)/apk.8 \ done
$(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
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment