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 \ |
9783cb12 | 11 | manual.toc 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 | |
9783cb12 JF |
50 | manual.toc: manual.txt |
51 | sed -n '/^\[\[/,/\(---\|~~~\)/p' < $< | while read line; do \ | |
52 | case "$$line" in \ | |
53 | "-----"*) echo ". <<$$ref>>"; ref= ;; \ | |
54 | "~~~~~"*) echo "- <<$$ref>>"; ref= ;; \ | |
55 | "[["*"]]") ref="$$line" ;; \ | |
56 | *) ref="$$ref, $$line" ;; \ | |
57 | esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@ | |
58 | ||
b801d8b2 JF |
59 | tig: tig.c |
60 | ||
b8ae9346 | 61 | README.html: README |
511147de | 62 | asciidoc -b xhtml11 -d article -a readme $< |
b8ae9346 | 63 | |
a7bc4b14 | 64 | %.1.html : %.1.txt |
4c6fabc2 | 65 | asciidoc -b xhtml11 -d manpage $< |
a7bc4b14 JF |
66 | |
67 | %.1.xml : %.1.txt | |
4c6fabc2 | 68 | asciidoc -b docbook -d manpage $< |
a7bc4b14 JF |
69 | |
70 | %.1 : %.1.xml | |
71 | xmlto man $< | |
cb7f42cd JF |
72 | |
73 | %.5.html : %.5.txt | |
74 | asciidoc -b xhtml11 -d manpage $< | |
75 | ||
76 | %.5.xml : %.5.txt | |
77 | asciidoc -b docbook -d manpage $< | |
78 | ||
79 | %.5 : %.5.xml | |
80 | xmlto man $< | |
d839253b JF |
81 | |
82 | %.html : %.txt | |
9783cb12 | 83 | asciidoc -b xhtml11 -d article -n $< |
d839253b JF |
84 | |
85 | %.xml : %.txt | |
86 | asciidoc -b docbook -d article $< | |
87 | ||
88 | %.html-chunked : %.xml | |
89 | xmlto html -o $@ $< |