3 # The last tagged version. Can be overridden either by the version from
4 # git or from the value of the DIST_VERSION environment variable.
9 # Include setting from the configure script
13 bindir ?
= $(prefix)/bin
14 datarootdir ?
= $(prefix)/share
15 sysconfdir ?
= $(prefix)/etc
16 docdir ?
= $(datarootdir
)/doc
17 mandir ?
= $(datarootdir
)/man
20 ifneq (,$(wildcard .git
))
21 GITDESC
= $(subst tig-
,,$(shell git describe
))
22 WTDIRTY
= $(if
$(shell git diff-index HEAD
2>/dev
/null
),-dirty
)
23 VERSION
= $(GITDESC
)$(WTDIRTY
)
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
-O0
40 SOURCE
= tig.c tig.h io.c io.h graph.c graph.h
41 TXTDOC
= tig
.1.txt tigrc
.5.txt manual.txt NEWS README INSTALL BUGS
42 MANDOC
= tig
.1 tigrc
.5 tigmanual
.7
43 HTMLDOC
= tig
.1.html tigrc
.5.html manual.html README.html NEWS.html
44 ALLDOC
= $(MANDOC
) $(HTMLDOC
) manual.html-chunked manual.pdf
46 # Never include the release number in the tarname for tagged
48 ifneq ($(if
$(DIST_VERSION
),$(words $(RPM_VERLIST
))),2)
49 TARNAME
= tig-
$(RPM_VERSION
)-$(RPM_RELEASE
)
51 TARNAME
= tig-
$(RPM_VERSION
)
54 override CPPFLAGS
+= '-DTIG_VERSION="$(VERSION)"'
55 override CPPFLAGS
+= '-DSYSCONFDIR="$(sysconfdir)"'
57 AUTORECONF ?
= autoreconf
59 ASCIIDOC_FLAGS
= -aversion
=$(VERSION
) -asysconfdir
=$(sysconfdir
)
61 DOCBOOK2PDF ?
= docbook2pdf
63 all: $(PROGS
) $(TESTS
)
64 all-debug
: $(PROGS
) $(TESTS
)
65 all-debug
: CFLAGS
+= $(DFLAGS
)
71 mkdir
-p
$(DESTDIR
)$(bindir) && \
72 for prog in
$(PROGS
); do \
73 install -p
-m
0755 "$$prog" "$(DESTDIR)$(bindir)"; \
76 install-doc-man
: doc-man
77 mkdir
-p
$(DESTDIR
)$(mandir)/man1 \
78 $(DESTDIR
)$(mandir)/man5 \
79 $(DESTDIR
)$(mandir)/man7
80 for doc in
$(MANDOC
); do \
81 sed
's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \
83 *.1) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man1/$$doc" ;; \
84 *.5) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man5/$$doc" ;; \
85 *.7) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man7/$$doc" ;; \
90 install-release-doc-man
:
91 GIT_INDEX_FILE
=.tmp-doc-index git read-tree
origin/release
92 GIT_INDEX_FILE
=.tmp-doc-index git checkout-index
-f
--prefix=.
/ $(MANDOC
)
94 $(MAKE
) install-doc-man
96 install-doc-html
: doc-html
97 mkdir
-p
$(DESTDIR
)$(docdir
)/tig
98 for doc in
$(HTMLDOC
); do \
99 sed
's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \
101 *.html
) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(docdir)/tig/$$doc" ;; \
106 install-release-doc-html
:
107 GIT_INDEX_FILE
=.tmp-doc-index git read-tree
origin/release
108 GIT_INDEX_FILE
=.tmp-doc-index git checkout-index
-f
--prefix=.
/ $(HTMLDOC
)
110 $(MAKE
) install-doc-html
112 install-doc
: install-doc-man install-doc-html
113 install-release-doc
: install-release-doc-man install-release-doc-html
116 $(RM
) -r
$(TARNAME
) *.spec tig-
*.
tar.gz tig-
*.
tar.gz.md5
117 $(RM
) $(PROGS
) $(TESTS
) core
*.o
*.xml
120 $(RM
) -r manual.html-chunked autom4te.cache
121 $(RM
) *.toc
$(ALLDOC
) aclocal.m4 configure
122 $(RM
) config.h config.log config.make config.status config.h.in
125 for file in
$(TXTDOC
) tig.c
; do \
126 aspell
--lang
=en
--dont-backup \
127 --personal
=.
/contrib
/aspell.dict
check $$file; \
133 dist: configure tig.spec
134 @mkdir
-p
$(TARNAME
) && \
135 cp Makefile tig.spec configure config.h.in aclocal.m4
$(TARNAME
) && \
136 sed
-i
"s/VERSION\s=\s[0-9]\+[.][0-9]\+/VERSION = $(VERSION)/" $(TARNAME
)/Makefile
137 git archive
--format
=tar --prefix=$(TARNAME
)/ HEAD | \
138 tar --delete
$(TARNAME
)/Makefile
> $(TARNAME
).
tar && \
139 tar rf
$(TARNAME
).
tar `find $(TARNAME)/*` && \
140 gzip
-f
-9 $(TARNAME
).
tar && \
141 md5sum
$(TARNAME
).
tar.gz
> $(TARNAME
).
tar.gz.md5
145 rpmbuild
-ta
$(TARNAME
).
tar.gz
147 configure
: configure.ac acinclude.m4
148 $(AUTORECONF
) -v
-I contrib
150 .PHONY
: all all-debug doc doc-man doc-html
install install-doc \
151 install-doc-man install-doc-html
clean spell-check
dist rpm
153 io.o
: io.c io.h tig.h
154 graph.o
: graph.c graph.h tig.h
155 refs.o
: refs.c refs.h tig.h
156 tig.o
: tig.c tig.h graph.h io.h refs.h git.h
157 tig
: tig.o io.o graph.o refs.o
158 test-graph.o
: test-graph.c io.h tig.h graph.h
159 test-graph
: io.o graph.o
161 tig.spec
: contrib
/tig.spec.in
162 sed
-e
's/@@VERSION@@/$(RPM_VERSION)/g' \
163 -e
's/@@RELEASE@@/$(RPM_RELEASE)/g' < $< > $@
165 manual.html
: manual.toc
166 manual.toc
: manual.txt
167 sed
-n
'/^\[\[/,/\(---\|~~~\)/p' < $< | while read line
; do \
169 "----"*) echo
". <<$$ref>>"; ref
= ;; \
170 "~~~~"*) echo
"- <<$$ref>>"; ref
= ;; \
171 "[["*"]]") ref
="$$line" ;; \
172 *) ref
="$$ref, $$line" ;; \
173 esac
; done | sed
's/\[\[\(.*\)\]\]/\1/' > $@
175 README.html
: README SITES INSTALL asciidoc.conf
176 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
-a readme
$<
178 NEWS.html
: NEWS asciidoc.conf
179 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
$<
181 tigmanual
.7: manual.txt
183 %.1.html
: %.1.txt asciidoc.conf
184 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d manpage
$<
186 %.1.xml
: %.1.txt asciidoc.conf
187 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
189 %.5.html
: %.5.txt asciidoc.conf
190 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d manpage
$<
192 %.5.xml
: %.5.txt asciidoc.conf
193 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
195 %.7.xml
: %.7.txt asciidoc.conf
196 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
198 %.html
: %.txt asciidoc.conf
199 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
-n
$<
201 %.xml
: %.txt asciidoc.conf
202 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d article
$<
207 %.html-chunked
: %.xml
208 $(XMLTO
) html
-o
$@
$<