1 # Copyright (C) 2013-2019 all contributors <meta@public-inbox.org>
2 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
5 # Note: some GNU-isms present and required to build docs
6 # (including manpages), but at least this should not trigger
7 # warnings with BSD make(1) when running "make check"
8 # Maybe it's not worth it to support non-GNU make, though...
10 RSYNC_DEST = public-inbox.org:/srv/public-inbox/
16 txt := INSTALL README COPYING TODO HACKING
17 dtxt := design_notes.txt design_www.txt dc-dlvr-spam-flow.txt hosted.txt
20 dtxt := $(addprefix Documentation/, $(dtxt))
21 docs := $(txt) $(dtxt)
25 PODMAN_OPTS = -v --stderr -d 1993-10-02 -c 'public-inbox user manual'
26 PODMAN_OPTS += -r public-inbox.git
27 podman = $(PODMAN) $(PODMAN_OPTS)
29 PODTEXT_OPTS = --stderr
30 podtext = $(PODTEXT) $(PODTEXT_OPTS)
32 # MakeMaker only seems to support manpage sections 1 and 3...
34 m1 += public-inbox-compact
35 m1 += public-inbox-convert
36 m1 += public-inbox-httpd
37 m1 += public-inbox-index
38 m1 += public-inbox-mda
39 m1 += public-inbox-nntpd
40 m1 += public-inbox-watch
41 m1 += public-inbox-xcpdb
43 m5 += public-inbox-config
44 m5 += public-inbox-v1-format
45 m5 += public-inbox-v2-format
47 m7 += public-inbox-overview
49 m8 += public-inbox-daemon
51 man1 := $(addsuffix .1, $(m1))
52 man5 := $(addsuffix .5, $(m5))
53 man7 := $(addsuffix .7, $(m7))
54 man8 := $(addsuffix .8, $(m8))
58 man: $(man1) $(man5) $(man7) $(man8)
62 mandir ?= $(prefix)/share/man
63 man1dir = $(mandir)/man1
64 man5dir = $(mandir)/man5
65 man7dir = $(mandir)/man7
66 man8dir = $(mandir)/man8
69 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
70 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
71 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
72 $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
73 $(INSTALL) -m 644 $(man1) $(DESTDIR)$(man1dir)
74 $(INSTALL) -m 644 $(man5) $(DESTDIR)$(man5dir)
75 $(INSTALL) -m 644 $(man7) $(DESTDIR)$(man7dir)
76 $(INSTALL) -m 644 $(man8) $(DESTDIR)$(man8dir)
78 doc_install :: install-man
80 %.1 %.5 %.7 %.8 : Documentation/%.pod
81 $(podman) -s $(subst .,,$(suffix $@)) $< $@+ && mv $@+ $@
89 mantxt = $(addprefix Documentation/, $(addsuffix .txt, $(manuals)))
95 Documentation/%.txt : Documentation/%.pod
96 $(podtext) $< $@+ && touch -r $< $@+ && mv $@+ $@
98 txt2pre = $(PERL) -I lib ./Documentation/txt2pre <$< >$@+ && \
99 touch -r $< $@+ && mv $@+ $@
101 Documentation/standards.txt : Documentation/standards.perl
102 $(PERL) $< >$@+ && touch -r $< $@+ && mv $@+ $@
104 Documentation/%.html: Documentation/%.txt
110 docs_html := $(addsuffix .html, $(subst .txt,,$(dtxt)) $(txt))
112 gz_docs := $(addsuffix .gz, $(docs) $(docs_html))
113 rsync_docs := $(gz_docs) $(docs) $(docs_html)
115 # external manpages which we host ourselves, since some packages
116 # (currently just Xapian) doesn't host manpages themselves.
118 xtxt += .copydatabase.1
119 xtxt += .xapian-compact.1
120 xtxt := $(addprefix Documentation/.x/, $(addsuffix .txt, $(xtxt)))
122 xdocs_html := $(addsuffix .html, $(subst .txt,,$(xtxt)))
123 gz_xdocs := $(addsuffix .gz, $(xdocs) $(xdocs_html))
124 rsync_xdocs := $(gz_xdocs) $(xdocs_html) $(xdocs)
125 xdoc: $(xdocs) $(xdocs_html)
127 Documentation/.x/%.txt::
129 $(PERL) -w Documentation/extman.perl $@ >$@+
132 Documentation/.x/%.html: Documentation/.x/%.txt
138 gzip -9 --rsyncable <$< >$@+
147 # /usr/share/doc/rsync/scripts/git-set-file-times{.gz} on Debian systems
148 # It is also at: https://yhbt.net/git-set-file-times
149 -git set-file-times $(docs) $(txt)
150 $(MAKE) gz-doc gz-xdoc
151 $(RSYNC) --chmod=Fugo=r -av $(rsync_docs) $(rsync_xdocs) $(RSYNC_DEST)
154 $(RM) $(man1) $(man5) $(man7) $(man8) $(gz_docs) $(docs_html) $(mantxt)
155 $(RM) $(gz_xdocs) $(xdocs_html) $(xdocs)
160 @if test x"$(addprefix g, make)" != xgmake; then \
161 echo W: gmake is currently required to build manpages; fi