Commit | Line | Data |
---|---|---|
5f7b975a JH |
1 | prefix = $(HOME) |
2 | bindir= $(prefix)/bin | |
3 | mandir = $(prefix)/man | |
bb8afc29 | 4 | docdir = $(prefix)/share/doc |
5f7b975a JH |
5 | # DESTDIR= |
6 | ||
c9a2f784 | 7 | LDLIBS = -lcurses |
900666fc | 8 | CFLAGS = -Wall -O2 |
19f862bd | 9 | DFLAGS = -g -DDEBUG -Werror |
b801d8b2 | 10 | PROGS = tig |
8eb62770 | 11 | DOCS = tig.1.html tig.1 tigrc.5.html tigrc.5 \ |
9783cb12 | 12 | manual.toc manual.html manual.html-chunked README.html \ |
e2beda18 JF |
13 | |
14 | ifneq (,$(wildcard .git)) | |
9074d9b6 JF |
15 | VERSION = $(shell git-describe) |
16 | WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null) | |
17 | CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"' | |
e2beda18 | 18 | endif |
800a900c | 19 | |
a7bc4b14 | 20 | all: $(PROGS) |
82e78006 JF |
21 | all-debug: $(PROGS) |
22 | all-debug: CFLAGS += $(DFLAGS) | |
c92615b1 | 23 | doc: $(DOCS) |
800a900c | 24 | |
05f1685b | 25 | install: all |
a7bc4b14 | 26 | for prog in $(PROGS); do \ |
5f7b975a | 27 | install $$prog $(DESTDIR)$(bindir); \ |
4c6fabc2 JF |
28 | done |
29 | ||
c92615b1 | 30 | install-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 | |
42 | clean: | |
d839253b | 43 | rm -rf manual.html-chunked |
8855ada4 | 44 | rm -f $(PROGS) $(DOCS) core |
05f1685b | 45 | |
57bdf034 | 46 | spell-check: |
8eb62770 | 47 | aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt |
57bdf034 | 48 | |
0e92d312 JF |
49 | strip: all |
50 | strip $(PROGS) | |
51 | ||
c92615b1 | 52 | .PHONY: all all-debug doc install install-doc clean spell-check |
a7bc4b14 | 53 | |
9783cb12 JF |
54 | manual.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 |
63 | tig: tig.c |
64 | ||
b8ae9346 | 65 | README.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 $@ $< |