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>
6 RSYNC_DEST = public-inbox.org:/srv/public-inbox/
7 docs := README COPYING INSTALL TODO HACKING
8 docs += $(shell git ls-files 'Documentation/*.txt')
11 PODMAN_OPTS = -v --stderr -d 1993-10-02 -c 'public-inbox user manual'
12 PODMAN_OPTS += -r public-inbox.git
13 podman = $(PODMAN) $(PODMAN_OPTS)
15 PODTEXT_OPTS = --stderr
16 podtext = $(PODTEXT) $(PODTEXT_OPTS)
18 # MakeMaker only seems to support manpage sections 1 and 3...
20 m1 += public-inbox-mda
21 m1 += public-inbox-httpd
22 m1 += public-inbox-nntpd
23 m1 += public-inbox-watch
24 m1 += public-inbox-index
26 m5 += public-inbox-config
27 m5 += public-inbox-v1-format
28 m5 += public-inbox-v2-format
30 m7 += public-inbox-overview
32 m8 += public-inbox-daemon
34 man1 := $(addsuffix .1, $(m1))
35 man5 := $(addsuffix .5, $(m5))
36 man7 := $(addsuffix .7, $(m7))
37 man8 := $(addsuffix .8, $(m8))
41 man: $(man1) $(man5) $(man7) $(man8)
45 mandir ?= $(prefix)/share/man
46 man1dir = $(mandir)/man1
47 man5dir = $(mandir)/man5
48 man7dir = $(mandir)/man7
49 man8dir = $(mandir)/man8
52 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
53 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
54 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
55 $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
56 $(INSTALL) -m 644 $(man1) $(DESTDIR)$(man1dir)
57 $(INSTALL) -m 644 $(man5) $(DESTDIR)$(man5dir)
58 $(INSTALL) -m 644 $(man7) $(DESTDIR)$(man7dir)
59 $(INSTALL) -m 644 $(man8) $(DESTDIR)$(man8dir)
61 doc_install :: install-man
63 %.1 %.5 %.7 %.8 : Documentation/%.pod
64 $(podman) -s $(subst .,,$(suffix $@)) $< $@+ && mv $@+ $@
72 mantxt = $(addprefix Documentation/, $(addsuffix .txt, $(manuals)))
77 Documentation/%.txt : Documentation/%.pod
78 $(podtext) $< $@+ && mv $@+ $@
80 txt2pre = $(PERL) -I lib ./Documentation/txt2pre <$< >$@+ && \
81 touch -r $< $@+ && mv $@+ $@
82 txt := INSTALL README COPYING TODO
83 dtxt := design_notes.txt design_www.txt dc-dlvr-spam-flow.txt hosted.txt
84 dtxt := $(addprefix Documentation/, $(dtxt)) $(mantxt)
87 TITLE="$(basename $(<F))" $(txt2pre)
91 docs_html := $(addsuffix .html, $(subst .txt,,$(dtxt)) $(txt))
93 gz_docs := $(addsuffix .gz, $(docs) $(docs_html))
94 rsync_docs := $(gz_docs) $(docs) $(txt) $(docs_html)
96 gzip -9 --rsyncable <$< >$@+
102 git set-file-times $(docs) $(txt)
104 $(RSYNC) --chmod=Fugo=r -av $(rsync_docs) $(RSYNC_DEST)
106 $(RM) $(man1) $(man5) $(man7) $(gz_docs) $(docs_html) $(mantxt)