Lots of small improvements
[tig] / Makefile
1 PREFIX = $(HOME)
2 LDFLAGS = -lcurses
3 CFLAGS = '-DVERSION="$(VERSION)"' -Wall
4 DFLAGS = -g -DDEBUG
5 PROGS = tig
6 DOCS = tig.1.txt tig.1 tig.1.html
7 VERSION = $(shell git-describe)
8
9 all: $(PROGS)
10 all-debug: $(PROGS)
11 all-debug: CFLAGS += $(DFLAGS)
12 docs: $(DOCS)
13
14 install: all
15 for prog in $(PROGS); do \
16 install $$prog $(PREFIX)/bin; \
17 done
18
19
20 install-docs: docs
21 for doc in $(DOCS); do \
22 case "$$doc" in \
23 *.1) install $$doc $(PREFIX)/man/man1 ;; \
24 esac \
25 done
26
27 clean:
28 rm -f $(PROGS) $(DOCS)
29
30 .PHONY: all docs install clean
31
32 tig: tig.c
33
34 tig.1.txt: tig.c
35 sed -n '/\/\*\*/,/\*\*\//p' < $< | \
36 sed 's/.*\*\*\///' | \
37 sed '/^[^*]*\*\*/d' | \
38 sed 's/\*\///;s/^[^*]*\* *//' > $@
39
40 %.1.html : %.1.txt
41 asciidoc -b xhtml11 -d manpage $<
42
43 %.1.xml : %.1.txt
44 asciidoc -b docbook -d manpage $<
45
46 %.1 : %.1.xml
47 xmlto man $<