Makefile: build README.html
[archives2git.git] / Makefile
blob6f2d9e5e04c9a6342074872a49cd726f520f48ab
1 # Makefile
3 PACKAGE_NAME = archives2git
4 PACKAGE_TARNAME = archives2git
6 prefix = $(HOME)/.local
7 bindir = $(prefix)/bin
8 datarootdir = $(prefix)/share
9 docdir = $(datarootdir)/doc/$(PACKAGE_TARNAME)
10 mandir = $(datarootdir)/man
11 # DESTDIR = # distributors set this on the command line
13 MKDIR = mkdir
14 INSTALL = install
15 HELPMESSAGE2POD = helpmessage2pod
16 POD2MAN = pod2man
17 POD2MAN_FLAGS = --utf8 -c "User manuals"
18 POD2TEXT = pod2text
19 POD2HTML = pod2html
20 ASCIIDOC = asciidoc
21 ASCIIDOC_FLAGS = -apackagename="$(PACKAGE_NAME)"
23 SCRIPTS = archives2git
24 MANDOC = $(SCRIPTS:%=%.1)
25 TEXTDOC = $(SCRIPTS:%=%.1.txt)
26 HTMLDOC = $(SCRIPTS:%=%.1.html) README.html
27 ALLDOC = $(MANDOC) $(TEXTDOC) $(HTMLDOC)
29 .PHONY: .help all clean build doc install install-doc
31 all: build doc
33 .help:
34 @echo "Useful targets:"
35 @echo " doc clean distclean install install-doc"
37 clean:
38 $(RM) *.1.helpm *.pod pod2htmd.tmp pod2htmi.tmp *~ .*~
39 distclean: clean
40 $(RM) $(ALLDOC)
42 install: build install-doc
43 $(MKDIR) -p $(DESTDIR)$(bindir)
44 $(INSTALL) -m 755 $(SCRIPTS) $(DESTDIR)$(bindir)/
45 install-doc:
46 $(MKDIR) -p $(DESTDIR)$(mandir)/man1
47 $(INSTALL) -m 644 $(MANDOC) $(DESTDIR)$(mandir)/man1/
49 build:
50 doc: $(ALLDOC)
52 README.html: README
53 $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -a readme $<
55 %.1.helpm: %
56 ./$< -h >$@
57 %.pod: %.1.helpm
58 <$< $(HELPMESSAGE2POD) - >$@
60 %.1: %.pod
61 $(POD2MAN) $(POD2MAN_FLAGS) --section 1 $< >$@
62 %.1.txt: %.pod
63 $(POD2TEXT) --utf8 $< >$@
64 %.1.html: %.pod
65 $(POD2HTML) --noindex --title "$(shell printf "%s(1)" "$*" | LC_ALL=C tr a-z A-Z)" \
66 $< >$@