1 # GNU Makefile for gitchangelog.sh
3 PACKAGE_NAME
= gitchangelog.sh
4 PACKAGE_TARNAME
= gitchangelog-sh
6 # Get the version via git or from the VERSION file or from the project
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 PACKAGE_VERSION
= $(VERSION
)
12 # Remove the _g<SHA1> part from the $VERSION
13 RPM_VERSION
= $(shell echo
$(VERSION
) |
$(SED
) -e
's/_g[0-9a-z]\+//')
15 prefix = $(HOME
)/.local
16 bindir = $(prefix)/bin
17 datarootdir
= $(prefix)/share
18 docdir
= $(datarootdir
)/doc
/$(PACKAGE_TARNAME
)
19 mandir = $(datarootdir
)/man
20 # DESTDIR = # distributors set this on the command line
27 TAR_FLAGS
= --owner root
--group root
--mode a
+rX
,o-w
--mtime .
30 POD2MAN_FLAGS
= --utf8
-c
"" -r
"$(PACKAGE_NAME) $(PACKAGE_VERSION)"
34 ASCIIDOC_FLAGS
= -apackagename
="$(PACKAGE_NAME)" -aversion
="$(PACKAGE_VERSION)"
38 SCRIPTS
= gitchangelog.sh
39 MANDOC
= $(SCRIPTS
:%=%.1)
40 HELPMDOC
= $(SCRIPTS
:%=%.1.helpm
)
41 PODDOC
= $(SCRIPTS
:%=%.pod
)
42 TEXTDOC
= $(SCRIPTS
:%=%.1.txt
)
43 HTMLDOC
= $(SCRIPTS
:%=%.1.html
) README.html NEWS.html
44 ALLDOC
= $(MANDOC
) $(TEXTDOC
) $(HTMLDOC
)
45 RELEASEDOC
= $(MANDOC
) $(HTMLDOC
)
47 TARNAME
= $(PACKAGE_TARNAME
)-$(RPM_VERSION
)
49 .PHONY
: .help
all clean build doc doc-helpm doc-pod doc-man doc-html
dist \
50 install install-doc install-man
55 @echo
"Useful targets:"
56 @echo
" doc-man doc clean distclean dist install install-doc"
59 $(RM
) $(HELPMDOC
) $(PODDOC
) pod2htmd.tmp pod2htmi.tmp
*~ .
*~
60 $(RM
) $(PACKAGE_TARNAME
)-*.
tar.gz
*
62 $(RM
) ChangeLog
$(ALLDOC
)
64 install: build install-doc
65 $(MKDIR
) $(DESTDIR
)$(bindir)
66 $(INSTALL
) -m
755 $(SCRIPTS
) $(DESTDIR
)$(bindir)/
67 install-doc
: install-man
69 $(MKDIR
) $(DESTDIR
)$(mandir)/man1
70 $(INSTALL
) -m
644 $(MANDOC
) $(DESTDIR
)$(mandir)/man1
/
74 doc-helpm
: $(HELPMDOC
)
79 $(TARNAME
).
tar: ChangeLog
80 $(MKDIR
) -p
$(TARNAME
)
81 echo
$(VERSION
) > $(TARNAME
)/VERSION
82 $(CP
) -p ChangeLog
$(TARNAME
)
83 git archive
--format
=tar --prefix=$(TARNAME
)/ HEAD
> $(TARNAME
).
tar
84 $(TAR
) $(TAR_FLAGS
) -rf
$(TARNAME
).
tar $(TARNAME
)
86 dist: $(TARNAME
).
tar.gz
87 $(TARNAME
).
tar.gz
: $(TARNAME
).
tar $(RELEASEDOC
)
89 $(CP
) -p
-P
$(RELEASEDOC
) $(TARNAME
)
90 $(TAR
) $(TAR_FLAGS
) -rf
$(TARNAME
).
tar $(TARNAME
)
92 gzip
-f
-9 $(TARNAME
).
tar
93 $(MD5SUM
) $(TARNAME
).
tar.gz
> $(TARNAME
).
tar.gz.md5
94 $(SHA512SUM
) $(TARNAME
).
tar.gz
> $(TARNAME
).
tar.gz.sha512
96 ( echo
"# $@ for $(PACKAGE_NAME) - automatically generated from the VCS's history"; \
98 .
/gitchangelog.sh
--tags --tag-pattern
'version\/[^ ]*' \
99 -- - --date-order
--first-parent
) \
100 |
$(SED
) 's/^\[version/\f\[version/' \
103 README.html
: README asciidoc.conf
104 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
-a readme
$<
105 NEWS.html
: NEWS asciidoc.conf
106 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
$<
114 $(POD2MAN
) $(POD2MAN_FLAGS
) --section
1 $< >$@
116 $(POD2TEXT
) --utf8
$< >$@
118 $(POD2HTML
) --noindex
--title
"$(shell printf "%s
(1)" "$*" | LC_ALL=C tr a-z A-Z)" \