diff options
-rw-r--r-- | man/Makefile | 14 |
1 files changed, 14 insertions, 0 deletions
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 |