Manual: fix page up keys
[tig] / Makefile
... / ...
CommitLineData
1prefix = $(HOME)
2bindir= $(prefix)/bin
3mandir = $(prefix)/man
4docdir = $(prefix)/share/doc
5# DESTDIR=
6
7LDLIBS = -lcurses
8CFLAGS = -Wall -O2
9DFLAGS = -g -DDEBUG -Werror
10PROGS = tig
11DOCS = tig.1.html tig.1 tigrc.5.html tigrc.5 \
12 manual.toc manual.html manual.html-chunked README.html \
13
14ifneq (,$(wildcard .git))
15VERSION = $(shell git-describe)
16WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)
17CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"'
18endif
19
20all: $(PROGS)
21all-debug: $(PROGS)
22all-debug: CFLAGS += $(DFLAGS)
23doc: $(DOCS)
24
25install: all
26 for prog in $(PROGS); do \
27 install $$prog $(DESTDIR)$(bindir); \
28 done
29
30install-doc: doc
31 mkdir -p $(DESTDIR)$(mandir)/man1 \
32 $(DESTDIR)$(mandir)/man5 \
33 $(DESTDIR)$(docdir)/tig
34 for doc in $(DOCS); do \
35 case "$$doc" in \
36 *.1) install $$doc $(DESTDIR)$(mandir)/man1 ;; \
37 *.5) install $$doc $(DESTDIR)$(mandir)/man5 ;; \
38 *.html) install $$doc $(DESTDIR)$(docdir)/tig ;; \
39 esac \
40 done
41
42clean:
43 rm -rf manual.html-chunked
44 rm -f $(PROGS) $(DOCS) core
45
46spell-check:
47 aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt
48
49strip: all
50 strip $(PROGS)
51
52.PHONY: all all-debug doc install install-doc clean spell-check
53
54manual.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
63tig: tig.c
64
65README.html: README
66 asciidoc -b xhtml11 -d article -a readme $<
67
68%.1.html : %.1.txt
69 asciidoc -b xhtml11 -d manpage $<
70
71%.1.xml : %.1.txt
72 asciidoc -b docbook -d manpage $<
73
74%.1 : %.1.xml
75 xmlto man $<
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 $<
85
86%.html : %.txt
87 asciidoc -b xhtml11 -d article -n $<
88
89%.xml : %.txt
90 asciidoc -b docbook -d article $<
91
92%.html-chunked : %.xml
93 xmlto html -o $@ $<