5 # Include setting from the configure script
9 bindir ?
= $(prefix)/bin
10 datarootdir ?
= $(prefix)/share
11 sysconfdir ?
= $(prefix)/etc
12 docdir ?
= $(datarootdir
)/doc
13 mandir ?
= $(datarootdir
)/man
16 # Get version either via git or from VERSION file. Allow either
17 # to be overwritten by setting DIST_VERSION on the command line.
18 ifneq (,$(wildcard .git
))
19 GITDESC
= $(subst tig-
,,$(shell git describe
))
20 WTDIRTY
= $(if
$(shell git diff-index HEAD
2>/dev
/null
),-dirty
)
21 VERSION
= $(GITDESC
)$(WTDIRTY
)
23 VERSION
= $(shell test -f VERSION
&& cat VERSION || echo
"unknown-version")
26 VERSION
= $(DIST_VERSION
)
29 # Split the version "TAG-OFFSET-gSHA1-DIRTY" into "TAG OFFSET"
30 # and append 0 as a fallback offset for "exact" tagged versions.
31 RPM_VERLIST
= $(filter-out g
% dirty
,$(subst -, ,$(VERSION
))) 0
32 RPM_VERSION
= $(word 1,$(RPM_VERLIST
))
33 RPM_RELEASE
= $(word 2,$(RPM_VERLIST
))$(if
$(WTDIRTY
),.dirty
)
37 DFLAGS
= -g
-DDEBUG
-Werror
39 MANDOC
= tig
.1 tigrc
.5
40 HTMLDOC
= tig
.1.html tigrc
.5.html manual.html README.html NEWS.html
41 ALLDOC
= $(MANDOC
) $(HTMLDOC
) manual.html-chunked manual.pdf
43 # Never include the release number in the tarname for tagged
45 ifneq ($(if
$(DIST_VERSION
),$(words $(RPM_VERLIST
))),2)
46 TARNAME
= tig-
$(RPM_VERSION
)-$(RPM_RELEASE
)
48 TARNAME
= tig-
$(RPM_VERSION
)
51 override CPPFLAGS
+= '-DTIG_VERSION="$(VERSION)"'
52 override CPPFLAGS
+= '-DSYSCONFDIR="$(sysconfdir)"'
54 AUTORECONF ?
= autoreconf
56 ASCIIDOC_FLAGS
= -aversion
=$(VERSION
) -asysconfdir
=$(sysconfdir
)
58 DOCBOOK2PDF ?
= docbook2pdf
62 all-debug
: CFLAGS
+= $(DFLAGS
)
68 mkdir
-p
$(DESTDIR
)$(bindir) && \
69 for prog in
$(PROGS
); do \
70 install -p
-m
0755 "$$prog" "$(DESTDIR)$(bindir)"; \
73 install-doc-man
: doc-man
74 mkdir
-p
$(DESTDIR
)$(mandir)/man1 \
75 $(DESTDIR
)$(mandir)/man5
76 for doc in
$(MANDOC
); do \
77 sed
's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \
79 *.1) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man1/$$doc" ;; \
80 *.5) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man5/$$doc" ;; \
85 install-doc-html
: doc-html
86 mkdir
-p
$(DESTDIR
)$(docdir
)/tig
87 for doc in
$(HTMLDOC
); do \
88 sed
's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \
90 *.html
) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(docdir)/tig/$$doc" ;; \
95 install-doc
: install-doc-man install-doc-html
98 $(RM
) -r
$(TARNAME
) *.spec tig-
*.
tar.gz tig-
*.
tar.gz.md5
99 $(RM
) $(PROGS
) core
*.o
*.xml
102 $(RM
) -r manual.html-chunked autom4te.cache
103 $(RM
) *.toc
$(ALLDOC
) aclocal.m4 configure
104 $(RM
) config.h config.log config.make config.status config.h.in
107 aspell
--lang
=en
--check tig
.1.txt tigrc
.5.txt manual.txt
112 dist: configure tig.spec
113 @mkdir
-p
$(TARNAME
) && \
114 cp tig.spec configure config.h.in aclocal.m4
$(TARNAME
) && \
115 echo
$(VERSION
) > $(TARNAME
)/VERSION
116 git archive
--format
=tar --prefix=$(TARNAME
)/ HEAD | \
117 tar --delete
$(TARNAME
)/VERSION
> $(TARNAME
).
tar && \
118 tar rf
$(TARNAME
).
tar `find $(TARNAME)/*` && \
119 gzip
-f
-9 $(TARNAME
).
tar && \
120 md5sum
$(TARNAME
).
tar.gz
> $(TARNAME
).
tar.gz.md5
124 rpmbuild
-ta
$(TARNAME
).
tar.gz
126 configure
: configure.ac acinclude.m4
131 git checkout release
&& \
132 git merge master
&& \
133 $(MAKE
) distclean doc-man doc-html sysconfdir
=++SYSCONFDIR
++ && \
134 git add
-f
$(MANDOC
) $(HTMLDOC
) && \
135 git commit
-m
"Sync docs" && \
138 release-dist
: release-doc
139 git checkout release
&& \
143 .PHONY
: all all-debug doc doc-man doc-html
install install-doc \
144 install-doc-man install-doc-html
clean spell-check
dist rpm
149 tig.spec
: contrib
/tig.spec.in
150 sed
-e
's/@@VERSION@@/$(RPM_VERSION)/g' \
151 -e
's/@@RELEASE@@/$(RPM_RELEASE)/g' < $< > $@
153 manual.html
: manual.toc
154 manual.toc
: manual.txt
155 sed
-n
'/^\[\[/,/\(---\|~~~\)/p' < $< | while read line
; do \
157 "-----"*) echo
". <<$$ref>>"; ref
= ;; \
158 "~~~~~"*) echo
"- <<$$ref>>"; ref
= ;; \
159 "[["*"]]") ref
="$$line" ;; \
160 *) ref
="$$ref, $$line" ;; \
161 esac
; done | sed
's/\[\[\(.*\)\]\]/\1/' > $@
163 README.html
: README asciidoc.conf
164 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
-a readme
$<
166 NEWS.html
: NEWS asciidoc.conf
167 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
$<
169 %.1.html
: %.1.txt asciidoc.conf
170 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d manpage
$<
172 %.1.xml
: %.1.txt asciidoc.conf
173 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
175 %.5.html
: %.5.txt asciidoc.conf
176 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d manpage
$<
178 %.5.xml
: %.5.txt asciidoc.conf
179 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
181 %.html
: %.txt asciidoc.conf
182 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
-n
$<
184 %.xml
: %.txt asciidoc.conf
185 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d article
$<
190 %.html-chunked
: %.xml
191 $(XMLTO
) html
-o
$@
$<