1 # Copyright (C) 2013-2018 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
28 m7 += public-inbox-overview
30 m8 += public-inbox-daemon
32 man1 := $(addsuffix .1, $(m1))
33 man5 := $(addsuffix .5, $(m5))
34 man7 := $(addsuffix .7, $(m7))
35 man8 := $(addsuffix .8, $(m8))
39 man: $(man1) $(man5) $(man7) $(man8)
43 mandir ?= $(prefix)/share/man
44 man1dir = $(mandir)/man1
45 man5dir = $(mandir)/man5
46 man7dir = $(mandir)/man7
47 man8dir = $(mandir)/man8
50 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir)
51 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
52 $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir)
53 $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
54 $(INSTALL) -m 644 $(man1) $(DESTDIR)$(man1dir)
55 $(INSTALL) -m 644 $(man5) $(DESTDIR)$(man5dir)
56 $(INSTALL) -m 644 $(man7) $(DESTDIR)$(man7dir)
57 $(INSTALL) -m 644 $(man8) $(DESTDIR)$(man8dir)
59 doc_install :: install-man
61 %.1 %.5 %.7 %.8 : Documentation/%.pod
62 $(podman) -s $(subst .,,$(suffix $@)) $< $@+ && mv $@+ $@
70 mantxt = $(addprefix Documentation/, $(addsuffix .txt, $(manuals)))
75 Documentation/%.txt : Documentation/%.pod
76 $(podtext) $< $@+ && mv $@+ $@
78 txt2pre = $(PERL) -I lib ./Documentation/txt2pre <$< >$@+ && \
79 touch -r $< $@+ && mv $@+ $@
80 txt := INSTALL README COPYING TODO
81 dtxt := design_notes.txt design_www.txt dc-dlvr-spam-flow.txt hosted.txt
82 dtxt := $(addprefix Documentation/, $(dtxt)) $(mantxt)
85 TITLE="$(basename $(<F))" $(txt2pre)
89 docs_html := $(addsuffix .html, $(subst .txt,,$(dtxt)) $(txt))
91 gz_docs := $(addsuffix .gz, $(docs) $(docs_html))
92 rsync_docs := $(gz_docs) $(docs) $(txt) $(docs_html)
94 gzip -9 --rsyncable <$< >$@+
100 git set-file-times $(docs) $(txt)
102 $(RSYNC) --chmod=Fugo=r -av $(rsync_docs) $(RSYNC_DEST)
104 $(RM) $(man1) $(man5) $(man7) $(gz_docs) $(docs_html) $(mantxt)