aboutsummaryrefslogtreecommitdiff
path: root/man/Makefile
diff options
context:
space:
mode:
authorRoy Marples <roy@marples.name>2007-12-24 22:34:22 +0000
committerRoy Marples <roy@marples.name>2007-12-24 22:34:22 +0000
commit3e8695f6f0c30c0d97cea77ec2a43d3f02b5e7e5 (patch)
tree527b558d68ba5d79262f71e42d6822e2802f7feb /man/Makefile
parentc8768538592572773396883192ceb2af9ea2d736 (diff)
Automagically link our man pages.
Diffstat (limited to 'man/Makefile')
-rw-r--r--man/Makefile14
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