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