diff --git a/man/Makefile b/man/Makefile index 12a96280..e00de9ae 100644 --- a/man/Makefile +++ b/man/Makefile @@ -1,14 +1,18 @@ ROOT=.. include ${ROOT}/mk/hdr.mk +include ${ROOT}/mk/wmii.mk TARG = wmii.1 \ wmiiloop.1 \ wmiir.1 -FILTER = sed "s|CONFPREFIX|${ETC}|g; \ - s|CONFVERSION|${CONFVERSION}|g; \ - s|P9PATHS|${P9PATHS}|g; \ - s|AWKPATH|${AWKPATH}|g" +$(TARG): Makefile $(ROOT)/mk/wmii.mk + +FILTER = sed "s|CONFPREFIX|$(ETC)|g; \ + s|CONFVERSION|$(CONFVERSION)|g; \ + s|P9PATHS|$(P9PATHS)|g; \ + s|AWKPATH|$(AWKPATH)|g; \ + s|VERSION|$(VERSION)|g" include ${ROOT}/mk/man.mk diff --git a/mk/hdr.mk b/mk/hdr.mk index d3b866cb..728c2212 100644 --- a/mk/hdr.mk +++ b/mk/hdr.mk @@ -16,7 +16,7 @@ MKCFG!=${MKCFGSH} include $(MKCFG) .SILENT: -.SUFFIXES: .O .o .o_pic .c .sh .rc .$(SOEXT) .awk .1 .depend .install .uninstall .clean +.SUFFIXES: .O .o .o_pic .c .sh .rc .$(SOEXT) .awk .1 .man1 .depend .install .uninstall .clean all: .c.depend: @@ -28,13 +28,11 @@ all: .c.o: $(COMPILE) $@ $< - .c.o_pic: $(COMPILEPIC) $@ $< .o.O: $(LINK) $@ $< - .c.O: $(COMPILE) ${<:.c=.o} $< $(LINK) $@ ${<:.c=.o} @@ -48,6 +46,9 @@ all: echo FILTER $(BASE)$< $(FILTER) $< >$@ chmod 0755 $@ +.1.man1: + echo FILTER $(BASE)$< + $(FILTER) $< >$@ .O.install: echo INSTALL $$($(CLEANNAME) $(BASE)$*) @@ -73,11 +74,14 @@ all: echo UNINSTALL $$($(CLEANNAME) $(BASE)$<) rm -f $(INCLUDE)/$< -.1.install: - echo INSTALL man $$($(CLEANNAME) $*'(1)') - $(FILTER) $< >$(MAN)/man1/$< - chmod 0644 $(MAN)/man1/$< -.1.uninstall: +.man1.install: + set -e; \ + man=$(<:$*.man%=%); \ + path="$(MAN)/man$$man/$*.$$man"; \ + echo INSTALL man $$($(CLEANNAME) "$(BASE)/$*($$man)"); \ + cp "$<" "$$path"; \ + chmod 0644 "$$path" +.man1.uninstall: echo UNINSTALL man $$($(CLEANNAME) $*'(1)') rm -f $(MAN)/man1/$< diff --git a/mk/man.mk b/mk/man.mk index 4f699a01..e694970c 100644 --- a/mk/man.mk +++ b/mk/man.mk @@ -1,3 +1,6 @@ +OFILES=$(TARG:.1=.man1) + +all: $(OFILES) install: ${TARG:.1=.install} uninstall: ${TARG:.1=.uninstall} diff --git a/mk/wmii.mk b/mk/wmii.mk index 9fef6a46..0b28f449 100644 --- a/mk/wmii.mk +++ b/mk/wmii.mk @@ -1,2 +1,4 @@ VERSION = $$(hg tip --template 'hg{rev}' 2>/dev/null) +VERSION := $(shell hg tip --template 'hg{rev}' 2>/dev/null) +VERSION != hg tip --template 'hg{rev}' 2>/dev/null CONFVERSION = 3.5