Add sync-docs rule to update docs in the release branch
[tig] / Makefile
CommitLineData
5f7b975a
JH
1prefix = $(HOME)
2bindir= $(prefix)/bin
3mandir = $(prefix)/man
bb8afc29 4docdir = $(prefix)/share/doc
5f7b975a
JH
5# DESTDIR=
6
c9a2f784 7LDLIBS = -lcurses
900666fc 8CFLAGS = -Wall -O2
19f862bd 9DFLAGS = -g -DDEBUG -Werror
b801d8b2 10PROGS = tig
8eb62770 11DOCS = tig.1.html tig.1 tigrc.5.html tigrc.5 \
9783cb12 12 manual.toc manual.html manual.html-chunked README.html \
e2beda18
JF
13
14ifneq (,$(wildcard .git))
9074d9b6
JF
15VERSION = $(shell git-describe)
16WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)
17CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"'
e2beda18 18endif
800a900c 19
a7bc4b14 20all: $(PROGS)
82e78006
JF
21all-debug: $(PROGS)
22all-debug: CFLAGS += $(DFLAGS)
c92615b1 23doc: $(DOCS)
800a900c 24
05f1685b 25install: all
a7bc4b14 26 for prog in $(PROGS); do \
5f7b975a 27 install $$prog $(DESTDIR)$(bindir); \
4c6fabc2
JF
28 done
29
c92615b1 30install-doc: doc
bb8afc29
JF
31 mkdir -p $(DESTDIR)$(mandir)/man1 \
32 $(DESTDIR)$(mandir)/man5 \
33 $(DESTDIR)$(docdir)/tig
4c6fabc2
JF
34 for doc in $(DOCS); do \
35 case "$$doc" in \
5f7b975a
JH
36 *.1) install $$doc $(DESTDIR)$(mandir)/man1 ;; \
37 *.5) install $$doc $(DESTDIR)$(mandir)/man5 ;; \
bb8afc29 38 *.html) install $$doc $(DESTDIR)$(docdir)/tig ;; \
4c6fabc2 39 esac \
a7bc4b14 40 done
05f1685b
JF
41
42clean:
d839253b 43 rm -rf manual.html-chunked
8855ada4 44 rm -f $(PROGS) $(DOCS) core
05f1685b 45
57bdf034 46spell-check:
8eb62770 47 aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt
57bdf034 48
0e92d312
JF
49strip: all
50 strip $(PROGS)
51
c92615b1 52.PHONY: all all-debug doc install install-doc clean spell-check
a7bc4b14 53
9783cb12
JF
54manual.toc: manual.txt
55 sed -n '/^\[\[/,/\(---\|~~~\)/p' < $< | while read line; do \
56 case "$$line" in \
57 "-----"*) echo ". <<$$ref>>"; ref= ;; \
58 "~~~~~"*) echo "- <<$$ref>>"; ref= ;; \
59 "[["*"]]") ref="$$line" ;; \
60 *) ref="$$ref, $$line" ;; \
61 esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@
62
b801d8b2
JF
63tig: tig.c
64
b8ae9346 65README.html: README
511147de 66 asciidoc -b xhtml11 -d article -a readme $<
b8ae9346 67
a7bc4b14 68%.1.html : %.1.txt
4c6fabc2 69 asciidoc -b xhtml11 -d manpage $<
a7bc4b14
JF
70
71%.1.xml : %.1.txt
4c6fabc2 72 asciidoc -b docbook -d manpage $<
a7bc4b14
JF
73
74%.1 : %.1.xml
75 xmlto man $<
cb7f42cd
JF
76
77%.5.html : %.5.txt
78 asciidoc -b xhtml11 -d manpage $<
79
80%.5.xml : %.5.txt
81 asciidoc -b docbook -d manpage $<
82
83%.5 : %.5.xml
84 xmlto man $<
d839253b
JF
85
86%.html : %.txt
9783cb12 87 asciidoc -b xhtml11 -d article -n $<
d839253b
JF
88
89%.xml : %.txt
90 asciidoc -b docbook -d article $<
91
92%.html-chunked : %.xml
93 xmlto html -o $@ $<
604da3b7
JF
94
95# Maintainer stuff
96sync-docs:
97 cg switch release
98 -cg merge -n master
99 cg commit -m "Merge with master"
100 make doc
101 cg commit -m "Sync docs"
102 cg switch master