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 kernel specific configuration
10 kernel_name
:= $(shell sh
-c
'uname -s 2>/dev/null || echo unknown')
11 -include contrib
/config.make-
$(kernel_name
)
13 # Include setting from the configure script
17 bindir ?
= $(prefix)/bin
18 datarootdir ?
= $(prefix)/share
19 sysconfdir ?
= $(prefix)/etc
20 docdir ?
= $(datarootdir
)/doc
21 mandir ?
= $(datarootdir
)/man
24 ifneq (,$(wildcard .git
))
25 GITDESC
= $(subst tig-
,,$(shell git describe
))
26 WTDIRTY
= $(if
$(shell git diff-index HEAD
2>/dev
/null
),-dirty
)
27 VERSION
= $(GITDESC
)$(WTDIRTY
)
30 VERSION
= $(DIST_VERSION
)
33 # Split the version "TAG-OFFSET-gSHA1-DIRTY" into "TAG OFFSET"
34 # and append 0 as a fallback offset for "exact" tagged versions.
35 RPM_VERLIST
= $(filter-out g
% dirty
,$(subst -, ,$(VERSION
))) 0
36 RPM_VERSION
= $(word 1,$(RPM_VERLIST
))
37 RPM_RELEASE
= $(word 2,$(RPM_VERLIST
))$(if
$(WTDIRTY
),.dirty
)
41 DFLAGS
= -g
-DDEBUG
-Werror
-O0
44 SOURCE
= tig.c tig.h io.c io.h graph.c graph.h
45 TXTDOC
= tig
.1.txt tigrc
.5.txt manual.txt NEWS README INSTALL BUGS
46 MANDOC
= tig
.1 tigrc
.5 tigmanual
.7
47 HTMLDOC
= tig
.1.html tigrc
.5.html manual.html README.html NEWS.html
48 ALLDOC
= $(MANDOC
) $(HTMLDOC
) manual.html-chunked manual.pdf
50 # Never include the release number in the tarname for tagged
52 ifneq ($(if
$(DIST_VERSION
),$(words $(RPM_VERLIST
))),2)
53 TARNAME
= tig-
$(RPM_VERSION
)-$(RPM_RELEASE
)
55 TARNAME
= tig-
$(RPM_VERSION
)
58 override CPPFLAGS
+= '-DTIG_VERSION="$(VERSION)"'
59 override CPPFLAGS
+= '-DSYSCONFDIR="$(sysconfdir)"'
61 AUTORECONF ?
= autoreconf
63 ASCIIDOC_FLAGS
= -aversion
=$(VERSION
) -asysconfdir
=$(sysconfdir
)
65 DOCBOOK2PDF ?
= docbook2pdf
67 all: $(PROGS
) $(TESTS
)
68 all-debug
: $(PROGS
) $(TESTS
)
69 all-debug
: CFLAGS
+= $(DFLAGS
)
75 mkdir
-p
$(DESTDIR
)$(bindir) && \
76 for prog in
$(PROGS
); do \
77 install -p
-m
0755 "$$prog" "$(DESTDIR)$(bindir)"; \
80 install-doc-man
: doc-man
81 mkdir
-p
$(DESTDIR
)$(mandir)/man1 \
82 $(DESTDIR
)$(mandir)/man5 \
83 $(DESTDIR
)$(mandir)/man7
84 for doc in
$(MANDOC
); do \
85 sed
's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \
87 *.1) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man1/$$doc" ;; \
88 *.5) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man5/$$doc" ;; \
89 *.7) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(mandir)/man7/$$doc" ;; \
94 install-release-doc-man
:
95 GIT_INDEX_FILE
=.tmp-doc-index git read-tree
origin/release
96 GIT_INDEX_FILE
=.tmp-doc-index git checkout-index
-f
--prefix=.
/ $(MANDOC
)
98 $(MAKE
) install-doc-man
100 install-doc-html
: doc-html
101 mkdir
-p
$(DESTDIR
)$(docdir
)/tig
102 for doc in
$(HTMLDOC
); do \
103 sed
's#++SYSCONFDIR++#$(sysconfdir)#' < "$$doc" > "$$doc+"; \
105 *.html
) install -p
-m
0644 "$$doc+" "$(DESTDIR)$(docdir)/tig/$$doc" ;; \
110 install-release-doc-html
:
111 GIT_INDEX_FILE
=.tmp-doc-index git read-tree
origin/release
112 GIT_INDEX_FILE
=.tmp-doc-index git checkout-index
-f
--prefix=.
/ $(HTMLDOC
)
114 $(MAKE
) install-doc-html
116 install-doc
: install-doc-man install-doc-html
117 install-release-doc
: install-release-doc-man install-release-doc-html
120 $(RM
) -r
$(TARNAME
) *.spec tig-
*.
tar.gz tig-
*.
tar.gz.md5
121 $(RM
) $(PROGS
) $(TESTS
) core
*.o
*.xml
124 $(RM
) -r manual.html-chunked autom4te.cache
125 $(RM
) *.toc
$(ALLDOC
) aclocal.m4 configure
126 $(RM
) config.h config.log config.make config.status config.h.in
129 for file in
$(TXTDOC
) tig.c
; do \
130 aspell
--lang
=en
--dont-backup \
131 --personal
=.
/contrib
/aspell.dict
check $$file; \
137 dist: configure tig.spec
138 @mkdir
-p
$(TARNAME
) && \
139 cp Makefile tig.spec configure config.h.in aclocal.m4
$(TARNAME
) && \
140 sed
-i
"s/VERSION\s=\s[0-9]\+[.][0-9]\+/VERSION = $(VERSION)/" $(TARNAME
)/Makefile
141 git archive
--format
=tar --prefix=$(TARNAME
)/ HEAD | \
142 tar --delete
$(TARNAME
)/Makefile
> $(TARNAME
).
tar && \
143 tar rf
$(TARNAME
).
tar `find $(TARNAME)/*` && \
144 gzip
-f
-9 $(TARNAME
).
tar && \
145 md5sum
$(TARNAME
).
tar.gz
> $(TARNAME
).
tar.gz.md5
149 rpmbuild
-ta
$(TARNAME
).
tar.gz
151 configure
: configure.ac acinclude.m4
152 $(AUTORECONF
) -v
-I contrib
154 .PHONY
: all all-debug doc doc-man doc-html
install install-doc \
155 install-doc-man install-doc-html
clean spell-check
dist rpm
157 io.o
: io.c io.h tig.h
158 graph.o
: graph.c graph.h tig.h
159 refs.o
: refs.c refs.h tig.h
160 tig.o
: tig.c tig.h graph.h io.h refs.h git.h
161 tig
: tig.o io.o graph.o refs.o
162 test-graph.o
: test-graph.c io.h tig.h graph.h
163 test-graph
: io.o graph.o
165 tig.spec
: contrib
/tig.spec.in
166 sed
-e
's/@@VERSION@@/$(RPM_VERSION)/g' \
167 -e
's/@@RELEASE@@/$(RPM_RELEASE)/g' < $< > $@
169 manual.html
: manual.toc
170 manual.toc
: manual.txt
171 sed
-n
'/^\[\[/,/\(---\|~~~\)/p' < $< | while read line
; do \
173 "----"*) echo
". <<$$ref>>"; ref
= ;; \
174 "~~~~"*) echo
"- <<$$ref>>"; ref
= ;; \
175 "[["*"]]") ref
="$$line" ;; \
176 *) ref
="$$ref, $$line" ;; \
177 esac
; done | sed
's/\[\[\(.*\)\]\]/\1/' > $@
179 README.html
: README SITES INSTALL asciidoc.conf
180 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
-a readme
$<
182 NEWS.html
: NEWS asciidoc.conf
183 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
$<
185 tigmanual
.7: manual.txt
187 %.1.html
: %.1.txt asciidoc.conf
188 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d manpage
$<
190 %.1.xml
: %.1.txt asciidoc.conf
191 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
193 %.5.html
: %.5.txt asciidoc.conf
194 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d manpage
$<
196 %.5.xml
: %.5.txt asciidoc.conf
197 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
199 %.7.xml
: %.7.txt asciidoc.conf
200 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d manpage
$<
202 %.html
: %.txt asciidoc.conf
203 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b xhtml11
-d article
-n
$<
205 %.xml
: %.txt asciidoc.conf
206 $(ASCIIDOC
) $(ASCIIDOC_FLAGS
) -b docbook
-d article
$<
211 %.html-chunked
: %.xml
212 $(XMLTO
) html
-o
$@
$<