Automagically link our man pages.

This commit is contained in:
Roy Marples 2007-12-24 22:34:22 +00:00
parent c876853859
commit 3e8695f6f0

View File

@ -9,12 +9,26 @@ MAN8 = $(_MAN8)$(shell $(_MAN8_SH))
TOPDIR = .. TOPDIR = ..
include $(TOPDIR)/default.mk include $(TOPDIR)/default.mk
# Handy macro to create symlinks
# This does rely on correctly formatting our manpages!
MAKE_LINKS = suffix=$${man\#*.}; \
prefix=$${man%%.*}; \
for link in `sed -e 's/ ,//g' \
-n -e '/^\.Sh NAME$$/,/\.Sh/ s/\.Nm //p' $${man}`; do \
if test "$${link}" != "$${prefix}" ; then \
ln -sf $${man} \
$(DESTDIR)/$(DIR)/man$${suffix}/$${link}.$${suffix} ; \
fi; \
done;
install:: install::
$(INSTALL) -d $(DESTDIR)/$(DIR)/man3 $(INSTALL) -d $(DESTDIR)/$(DIR)/man3
for man in $(MAN3); do \ for man in $(MAN3); do \
$(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man3 || exit $$?; \ $(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man3 || exit $$?; \
$(MAKE_LINKS) \
done done
$(INSTALL) -d $(DESTDIR)/$(DIR)/man8 $(INSTALL) -d $(DESTDIR)/$(DIR)/man8
for man in $(MAN8); do \ for man in $(MAN8); do \
$(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man8 || exit $$?; \ $(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man8 || exit $$?; \
$(MAKE_LINKS) \
done done