From 3e8695f6f0c30c0d97cea77ec2a43d3f02b5e7e5 Mon Sep 17 00:00:00 2001 From: Roy Marples Date: Mon, 24 Dec 2007 22:34:22 +0000 Subject: [PATCH] Automagically link our man pages. --- man/Makefile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/man/Makefile b/man/Makefile index 9af3a4c7..5375ce90 100644 --- a/man/Makefile +++ b/man/Makefile @@ -9,12 +9,26 @@ MAN8 = $(_MAN8)$(shell $(_MAN8_SH)) TOPDIR = .. 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) -d $(DESTDIR)/$(DIR)/man3 for man in $(MAN3); do \ $(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man3 || exit $$?; \ + $(MAKE_LINKS) \ done $(INSTALL) -d $(DESTDIR)/$(DIR)/man8 for man in $(MAN8); do \ $(INSTALL) -m 0644 "$$man" $(DESTDIR)/$(DIR)/man8 || exit $$?; \ + $(MAKE_LINKS) \ done