kcmp.2: tfix
[man-pages.git] / Makefile
blob6090097157afd39bc8c21efa59aeab4f9226b1d5
1 # Do not print "Entering directory ..."
2 MAKEFLAGS += --no-print-directory
4 htmlbuilddir = $(CURDIR)/.html
5 HTOPTS =
7 DESTDIR =
8 prefix = /usr/local
9 datarootdir = $(prefix)/share
10 docdir = $(datarootdir)/doc
11 mandir = $(datarootdir)/man
12 htmldir = $(docdir)
13 htmldir_ = $(htmldir)/man
14 htmlext = .html
16 INSTALL = install
17 INSTALL_DATA = $(INSTALL) -m 644
18 INSTALL_DIR = $(INSTALL) -m 755 -d
20 .PHONY: all
21 all:
22 $(MAKE) uninstall;
23 $(MAKE) install;
25 # Use with
26 # make HTOPTS=whatever html
27 # The sed removes the lines "Content-type: text/html\n\n"
28 .PHONY: html
29 html: | builddirs-html
30 find man?/ -type f \
31 |while read f; do \
32 man2html $(HTOPTS) "$$f" \
33 |sed -e '1,2d' \
34 >"$(htmlbuilddir)/$${f}$(htmlext)" \
35 || exit $$?; \
36 done;
38 .PHONY: builddirs-html
39 builddirs-html:
40 find man?/ -type d \
41 |while read d; do \
42 $(INSTALL_DIR) "$(htmlbuilddir)/$$d" || exit $$?; \
43 done;
45 .PHONY: install-html
46 install-html: | installdirs-html
47 cd $(htmlbuilddir) && \
48 find man?/ -type f \
49 |while read f; do \
50 $(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(htmldir_)/$$f" || exit $$?; \
51 done;
53 .PHONY: installdirs-html
54 installdirs-html:
55 find man?/ -type d \
56 |while read d; do \
57 $(INSTALL_DIR) "$(DESTDIR)$(htmldir_)/$$d" || exit $$?; \
58 done;
60 .PHONY: install
61 install: | installdirs
62 find man?/ -type f \
63 |while read f; do \
64 $(INSTALL_DATA) -T "$$f" "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
65 done;
67 .PHONY: installdirs
68 installdirs:
69 find man?/ -type d \
70 |while read d; do \
71 $(INSTALL_DIR) "$(DESTDIR)$(mandir)/$$d" || exit $$?; \
72 done;
74 .PHONY: uninstall remove
75 uninstall remove:
76 find man?/ -type f \
77 |while read f; do \
78 rm -f "$(DESTDIR)$(mandir)/$$f" || exit $$?; \
79 rm -f "$(DESTDIR)$(mandir)/$$f".* || exit $$?; \
80 done;
82 .PHONY: uninstall-html
83 uninstall-html:
84 find man?/ -type f \
85 |while read f; do \
86 rm -f "$(DESTDIR)$(htmldir_)/$$f".* || exit $$?; \
87 done;
89 .PHONY: clean
90 clean:
91 find man?/ -type f \
92 |while read f; do \
93 rm -f "$(htmlbuilddir)/$$f".* || exit $$?; \
94 done;
96 # Check if groff reports warnings (may be words of sentences not displayed)
97 # from https://lintian.debian.org/tags/groff-message.html
98 .PHONY: check-groff-warnings
99 check-groff-warnings:
100 GROFF_LOG="$$(mktemp --tmpdir manpages-checksXXXX)" || exit $$?; \
101 for i in man?/*.[1-9]; \
102 do \
103 if grep -q 'SH.*NAME' "$$i"; then \
104 LC_ALL=en_US.UTF-8 MANWIDTH=80 man --warnings -E UTF-8 -l "$$i" > /dev/null 2>| "$$GROFF_LOG"; \
105 [ -s "$$GROFF_LOG" ] && { echo "$$i: "; cat "$$GROFF_LOG"; echo; }; \
106 fi; \
107 done; \
108 rm -f "$$GROFF_LOG"
110 # someone might also want to look at /var/catman/cat2 or so ...
111 # a problem is that the location of cat pages varies a lot