Correct error checking
[tig] / Makefile
CommitLineData
4c6fabc2 1PREFIX = $(HOME)
c9a2f784 2LDLIBS = -lcurses
900666fc 3CFLAGS = -Wall -O2
19f862bd 4DFLAGS = -g -DDEBUG -Werror
b801d8b2 5PROGS = tig
d839253b
JF
6DOCS = tig.1.txt tig.1.html tig.1 tigrc.5.html tigrc.5 \
7 manual.html manual.html-chunked README.html
e2beda18
JF
8
9ifneq (,$(wildcard .git))
9074d9b6
JF
10VERSION = $(shell git-describe)
11WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)
12CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"'
e2beda18 13endif
800a900c 14
a7bc4b14 15all: $(PROGS)
82e78006
JF
16all-debug: $(PROGS)
17all-debug: CFLAGS += $(DFLAGS)
c92615b1 18doc: $(DOCS)
800a900c 19
05f1685b 20install: all
a7bc4b14 21 for prog in $(PROGS); do \
4c6fabc2
JF
22 install $$prog $(PREFIX)/bin; \
23 done
24
c92615b1 25install-doc: doc
4c6fabc2
JF
26 for doc in $(DOCS); do \
27 case "$$doc" in \
28 *.1) install $$doc $(PREFIX)/man/man1 ;; \
cb7f42cd 29 *.5) install $$doc $(PREFIX)/man/man5 ;; \
4c6fabc2 30 esac \
a7bc4b14 31 done
05f1685b
JF
32
33clean:
d839253b 34 rm -rf manual.html-chunked
8855ada4 35 rm -f $(PROGS) $(DOCS) core
05f1685b 36
57bdf034
JF
37spell-check:
38 aspell --lang=en --check tig.1.txt
39
c92615b1 40.PHONY: all all-debug doc install install-doc clean spell-check
a7bc4b14 41
b801d8b2
JF
42tig: tig.c
43
44tig.1.txt: tig.c
b76c2afc 45 sed -n '/\/\*\*/,/\*\*\//p' < $< | \
660e09ad 46 sed 's/.*\*\*\/.*//' | \
b76c2afc 47 sed '/^[^*]*\*\*/d' | \
b801d8b2 48 sed 's/\*\///;s/^[^*]*\* *//' > $@
a7bc4b14 49
b8ae9346
JF
50README.html: README
51 asciidoc -b xhtml11 -d article -f web.conf $<
52
a7bc4b14 53%.1.html : %.1.txt
4c6fabc2 54 asciidoc -b xhtml11 -d manpage $<
a7bc4b14
JF
55
56%.1.xml : %.1.txt
4c6fabc2 57 asciidoc -b docbook -d manpage $<
a7bc4b14
JF
58
59%.1 : %.1.xml
60 xmlto man $<
cb7f42cd
JF
61
62%.5.html : %.5.txt
63 asciidoc -b xhtml11 -d manpage $<
64
65%.5.xml : %.5.txt
66 asciidoc -b docbook -d manpage $<
67
68%.5 : %.5.xml
69 xmlto man $<
d839253b
JF
70
71%.html : %.txt
72 asciidoc -b xhtml11 -d article $<
73
74%.xml : %.txt
75 asciidoc -b docbook -d article $<
76
77%.html-chunked : %.xml
78 xmlto html -o $@ $<