README: new section Credits & License
[archives2git.git] / Makefile
blob3a69cfc157c1956976e0e8278c061b6b71db14e7
1 # GNU Makefile for archives2git
3 PACKAGE_NAME = archives2git
4 PACKAGE_TARNAME = archives2git
6 # Get the version via git or from the VERSION file or from the project
7 # directory name.
8 VERSION = $(shell test -x version.sh && ./version.sh $(PACKAGE_TARNAME) \
9 || echo "unknown_version")
10 # Allow either to be overwritten by setting DIST_VERSION on the command line.
11 ifdef DIST_VERSION
12 VERSION = $(DIST_VERSION)
13 endif
14 PACKAGE_VERSION = $(VERSION)
16 prefix = $(HOME)/.local
17 bindir = $(prefix)/bin
18 datarootdir = $(prefix)/share
19 docdir = $(datarootdir)/doc/$(PACKAGE_TARNAME)
20 mandir = $(datarootdir)/man
21 # DESTDIR = # distributors set this on the command line
23 MKDIR = mkdir
24 INSTALL = install
25 HELPM2POD = helpm2pod
26 POD2MAN = pod2man
27 POD2MAN_FLAGS = --utf8 -c "User manuals" -r "$(VERSION)"
28 POD2TEXT = pod2text
29 POD2HTML = pod2html
30 ASCIIDOC = asciidoc
31 ASCIIDOC_FLAGS = -apackagename="$(PACKAGE_NAME)" -aversion="$(VERSION)"
33 SCRIPTS = archives2git
34 MANDOC = $(SCRIPTS:%=%.1)
35 TEXTDOC = $(SCRIPTS:%=%.1.txt)
36 HTMLDOC = $(SCRIPTS:%=%.1.html) README.html
37 ALLDOC = $(MANDOC) $(TEXTDOC) $(HTMLDOC)
39 .PHONY: .help all clean build doc install install-doc
41 all: build doc
43 .help:
44 @echo "Useful targets:"
45 @echo " doc clean distclean install install-doc"
47 clean:
48 $(RM) *.1.helpm *.pod pod2htmd.tmp pod2htmi.tmp *~ .*~
49 distclean: clean
50 $(RM) $(ALLDOC)
52 install: build install-doc
53 $(MKDIR) -p $(DESTDIR)$(bindir)
54 $(INSTALL) -m 755 $(SCRIPTS) $(DESTDIR)$(bindir)/
55 install-doc:
56 $(MKDIR) -p $(DESTDIR)$(mandir)/man1
57 $(INSTALL) -m 644 $(MANDOC) $(DESTDIR)$(mandir)/man1/
59 build:
60 doc: $(ALLDOC)
62 README.html: README asciidoc.conf
63 $(ASCIIDOC) $(ASCIIDOC_FLAGS) -b xhtml11 -d article -a readme $<
65 %.1.helpm: %
66 ./$< --helpm >$@
67 %.pod: %.1.helpm
68 $(HELPM2POD) $< >$@
70 %.1: %.pod
71 $(POD2MAN) $(POD2MAN_FLAGS) --section 1 $< >$@
72 %.1.txt: %.pod
73 $(POD2TEXT) --utf8 $< >$@
74 %.1.html: %.pod
75 $(POD2HTML) --noindex --title "$(shell printf "%s(1)" "$*" | LC_ALL=C tr a-z A-Z)" \
76 $< >$@