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/
14 # this is "xml" on FreeBSD and maybe some other distros:
15 XMLSTARLET = xmlstarlet
20 txt := INSTALL README COPYING TODO HACKING
21 dtxt := design_notes.txt design_www.txt dc-dlvr-spam-flow.txt hosted.txt
24 dtxt := $(addprefix Documentation/, $(dtxt))
25 docs := $(txt) $(dtxt)
29 PODMAN_OPTS = -v --stderr -d 1993-10-02 -c 'public-inbox user manual'
30 PODMAN_OPTS += -r public-inbox.git
31 podman = $(PODMAN) $(PODMAN_OPTS)
33 PODTEXT_OPTS = --stderr
34 podtext = $(PODTEXT) $(PODTEXT_OPTS)
36 # MakeMaker only seems to support manpage sections 1 and 3...
38 m1 += public-inbox-compact
39 m1 += public-inbox-convert
40 m1 += public-inbox-edit
41 m1 += public-inbox-httpd
42 m1 += public-inbox-index
43 m1 += public-inbox-init
44 m1 += public-inbox-mda
45 m1 += public-inbox-nntpd
46 m1 += public-inbox-watch
47 m1 += public-inbox-xcpdb
49 m5 += public-inbox-config
50 m5 += public-inbox-v1-format
51 m5 += public-inbox-v2-format
53 m7 += public-inbox-overview
55 m8 += public-inbox-daemon
57 man1 := $(addsuffix .1, $(m1))
58 man5 := $(addsuffix .5, $(m5))
59 man7 := $(addsuffix .7, $(m7))
60 man8 := $(addsuffix .8, $(m8))
64 man: $(man1) $(man5) $(man7) $(man8)
68 mandir ?= $(prefix)/share/man
69 man1dir = $(mandir)/man1
70 man5dir = $(mandir)/man5
71 man7dir = $(mandir)/man7
72 man8dir = $(mandir)/man8
75 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
76 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
77 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
78 $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
79 $(INSTALL) -m 644 $(man1) $(DESTDIR)$(man1dir)
80 $(INSTALL) -m 644 $(man5) $(DESTDIR)$(man5dir)
81 $(INSTALL) -m 644 $(man7) $(DESTDIR)$(man7dir)
82 $(INSTALL) -m 644 $(man8) $(DESTDIR)$(man8dir)
84 doc_install :: install-man
86 %.1 %.5 %.7 %.8 : Documentation/%.pod
87 $(podman) -s $(subst .,,$(suffix $@)) $< $@+ && mv $@+ $@
95 mantxt = $(addprefix Documentation/, $(addsuffix .txt, $(manuals)))
102 Documentation/%.txt : Documentation/%.pod
103 $(podtext) $< $@+ && touch -r $< $@+ && mv $@+ $@
105 txt2pre = $(PERL) -I lib ./Documentation/txt2pre <$< >$@+ && \
106 touch -r $< $@+ && mv $@+ $@
108 Documentation/standards.txt : Documentation/standards.perl
109 $(PERL) $< >$@+ && touch -r $< $@+ && mv $@+ $@
112 RELEASES += v1.1.0-pre1
115 NEWS NEWS.atom NEWS.html :
116 $(PERL) -I lib -w Documentation/mknews.perl $@ $(RELEASES)
118 # check for internal API changes:
119 check :: NEWS check-NEWS.atom NEWS.html
121 check-NEWS.atom: NEWS.atom
122 $(XMLSTARLET) val NEWS.atom || \
123 { e=$$?; test $$e -eq 0 || test $$e -eq 127; }
125 Documentation/%.html: Documentation/%.txt
131 docs_html := $(addsuffix .html, $(subst .txt,,$(dtxt)) $(txt)) NEWS.html
133 gz_docs := $(addsuffix .gz, $(docs) $(docs_html))
134 rsync_docs := $(gz_docs) $(docs) $(docs_html) NEWS.atom NEWS.atom.gz
136 # external manpages which we host ourselves, since some packages
137 # (currently just Xapian) doesn't host manpages themselves.
139 xtxt += .copydatabase.1
140 xtxt += .xapian-compact.1
141 xtxt := $(addprefix Documentation/.x/, $(addsuffix .txt, $(xtxt)))
143 xdocs_html := $(addsuffix .html, $(subst .txt,,$(xtxt)))
144 gz_xdocs := $(addsuffix .gz, $(xdocs) $(xdocs_html))
145 rsync_xdocs := $(gz_xdocs) $(xdocs_html) $(xdocs)
146 xdoc: $(xdocs) $(xdocs_html)
151 Documentation/.x/%.txt :: | Documentation/.x
152 $(PERL) -w Documentation/extman.perl $@ >$@+
155 Documentation/.x/%.html: Documentation/.x/%.txt
161 gzip -9 --rsyncable <$< >$@+
169 rsync-doc: NEWS.atom.gz
170 # /usr/share/doc/rsync/scripts/git-set-file-times{.gz} on Debian systems
171 # It is also at: https://yhbt.net/git-set-file-times
172 -git set-file-times $(docs) $(txt)
173 $(MAKE) gz-doc gz-xdoc
174 $(RSYNC) --chmod=Fugo=r -av $(rsync_docs) $(rsync_xdocs) $(RSYNC_DEST)
177 $(RM) $(man1) $(man5) $(man7) $(man8) $(gz_docs) $(docs_html) $(mantxt)
178 $(RM) $(gz_xdocs) $(xdocs_html) $(xdocs) NEWS NEWS.atom NEWS.html
183 @if test x"$(addprefix g, make)" != xgmake; then \
184 echo W: gmake is currently required to build manpages; fi