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