Lots of documentation 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.html tig.1
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 install-docs: docs
20         for doc in $(DOCS); do \
21                 case "$$doc" in \
22                 *.1) install $$doc $(PREFIX)/man/man1 ;; \
23                 esac \
24         done
25
26 clean:
27         rm -f $(PROGS) $(DOCS) core
28
29 .PHONY: all docs install clean
30
31 tig: tig.c
32
33 tig.1.txt: tig.c
34         sed -n '/\/\*\*/,/\*\*\//p' < $< | \
35         sed 's/.*\*\*\///' | \
36         sed '/^[^*]*\*\*/d' | \
37         sed 's/\*\///;s/^[^*]*\* *//' > $@
38
39 %.1.html : %.1.txt
40         asciidoc -b xhtml11 -d manpage $<
41
42 %.1.xml : %.1.txt
43         asciidoc -b docbook -d manpage $<
44
45 %.1 : %.1.xml
46         xmlto man $<