summaryrefslogtreecommitdiff
path: root/man/Makemodule.am
blob: 03b584fd9d4185901d23374b1fa4e9ec3c65fbec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
include man/man1/Makemodule.am
include man/man3/Makemodule.am
include man/man5/Makemodule.am

# Support installing symlinks for man pages that cover multiple interfaces.
install-data-hook:
	set -e; \
	cd "$(DESTDIR)$(mandir)"; \
	for d in $(dist_man_MANS); do \
		man_section=$${d##*.}; \
		d=$${d#man/}; \
		dst=$${d##*/}; \
		for m in `$(AWK) \
			'/^\.S[h|H] NAME/ {ok=1; next} ok {print; exit}' $$d \
			| $(SED) \
				-e 's/^\.Nm //' -e 's/,/ /g' -e 's/\\-.*//' \
				-e 's/\\\f[0-9]//g' -e 's/  / /g;q'`; \
		do \
			[ "$$m" = "\\" ] && continue; \
			ln="man$$man_section/$$m.$$man_section"; \
			[ -e "$$ln" ] && continue; \
			echo $(LN_S) $$dst $$ln; \
			$(LN_S) $$dst $$ln; \
		done; \
	done; \
	rmdir */ 2>/dev/null || :