man.mk (671B)
1 2 targ = for k in $(MANPAGES); do echo $$k | sed 's/ .*//'; done 3 TARG:= $(shell $(targ)) 4 TARG!= $(targ) 5 6 all: $(TARG) 7 install: $(TARG:.1=.install) $(TARG:.3=.install) maninstall 8 uninstall: $(TARG:.1=.uninstall) $(TARG:.3=.uninstall) manuninstall 9 10 .PHONY: maninstall manuninstall 11 12 MANLOOP = \ 13 set -ef; \ 14 for k in $(MANPAGES); do \ 15 set -- $$k; \ 16 real=$$1; shift; \ 17 for targ; do \ 18 _ $$real $(MAN)/man$${real\#\#*.}/$$targ; \ 19 done; \ 20 done 21 maninstall: 22 _() { echo LN $$1 $${2##*/}; ln -sf $$1 $(DESTDIR)$$2; }; $(MANLOOP) 23 manuninstall: 24 _() { echo RM $${2##*/}; rm -f $(DESTDIR)$$2; }; $(MANLOOP) 25 26 printinstall: 27 echo 'Install directories:' 28 echo ' Man: $(MAN)' 29