4 docdir = $(prefix)/share/doc
7 # Get version either via git or from VERSION file
8 ifneq (,$(wildcard .git))
9 GITDESC = $(subst tig-,,$(shell git describe))
10 WTDIRTY = $(if $(shell git-diff-index HEAD 2>/dev/null),-dirty)
11 VERSION = $(GITDESC)$(WTDIRTY)
13 VERSION = $(shell test -f VERSION && cat VERSION || echo "unknown-version")
17 CFLAGS = -Wall -O2 '-DVERSION="$(VERSION)"'
18 DFLAGS = -g -DDEBUG -Werror
20 DOCS_MAN = tig.1 tigrc.5
21 DOCS_HTML = tig.1.html tigrc.5.html \
22 manual.html manual.html-chunked \
24 DOCS = $(DOCS_MAN) $(DOCS_HTML) \
29 all-debug: CFLAGS += $(DFLAGS)
32 doc-html: $(DOCS_HTML)
35 mkdir -p $(DESTDIR)$(bindir) && \
36 for prog in $(PROGS); do \
37 install $$prog $(DESTDIR)$(bindir); \
40 install-doc-man: doc-man
41 mkdir -p $(DESTDIR)$(mandir)/man1 \
42 $(DESTDIR)$(mandir)/man5
43 for doc in $(DOCS); do \
45 *.1) install $$doc $(DESTDIR)$(mandir)/man1 ;; \
46 *.5) install $$doc $(DESTDIR)$(mandir)/man5 ;; \
50 install-doc-html: doc-html
51 mkdir -p $(DESTDIR)$(docdir)/tig
52 for doc in $(DOCS); do \
54 *.html) install $$doc $(DESTDIR)$(docdir)/tig ;; \
58 install-doc: install-doc-man install-doc-html
61 rm -rf manual.html-chunked
62 rm -f $(PROGS) $(DOCS) core *.xml
65 aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt
70 .PHONY: all all-debug doc doc-man doc-html install install-doc install-doc-man install-doc-html clean spell-check
72 manual.html: manual.toc
73 manual.toc: manual.txt
74 sed -n '/^\[\[/,/\(---\|~~~\)/p' < $< | while read line; do \
76 "-----"*) echo ". <<$$ref>>"; ref= ;; \
77 "~~~~~"*) echo "- <<$$ref>>"; ref= ;; \
78 "[["*"]]") ref="$$line" ;; \
79 *) ref="$$ref, $$line" ;; \
80 esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@
85 asciidoc -b xhtml11 -d article -a readme $<
91 asciidoc -b xhtml11 -d manpage $<
94 asciidoc -b docbook -d manpage -aversion=$(VERSION) $<
97 xmlto -m manpage.xsl man $<
100 asciidoc -b xhtml11 -d manpage $<
103 asciidoc -b docbook -d manpage -aversion=$(VERSION) $<
106 xmlto -m manpage.xsl man $<
109 asciidoc -b xhtml11 -d article -n $<
112 asciidoc -b docbook -d article $<
114 %.html-chunked : %.xml
121 cg commit -m "Merge with master"
123 cg commit -m "Sync docs"