Check the value returned by fopen() during display initialization
[tig] / Makefile
CommitLineData
5f7b975a
JH
1prefix = $(HOME)
2bindir= $(prefix)/bin
3mandir = $(prefix)/man
bb8afc29 4docdir = $(prefix)/share/doc
5f7b975a
JH
5# DESTDIR=
6
c9a2f784 7LDLIBS = -lcurses
900666fc 8CFLAGS = -Wall -O2
19f862bd 9DFLAGS = -g -DDEBUG -Werror
b801d8b2 10PROGS = tig
8eb62770 11DOCS = tig.1.html tig.1 tigrc.5.html tigrc.5 \
de8f9b2b
JF
12 manual.toc manual.html manual.html-chunked manual.pdf \
13 README.html
e2beda18
JF
14
15ifneq (,$(wildcard .git))
9074d9b6
JF
16VERSION = $(shell git-describe)
17WTDIRTY = $(shell git-diff-index --name-only HEAD 2>/dev/null)
18CFLAGS += '-DVERSION="$(VERSION)$(if $(WTDIRTY),-dirty)"'
e2beda18 19endif
800a900c 20
a7bc4b14 21all: $(PROGS)
82e78006
JF
22all-debug: $(PROGS)
23all-debug: CFLAGS += $(DFLAGS)
c92615b1 24doc: $(DOCS)
800a900c 25
05f1685b 26install: all
a7bc4b14 27 for prog in $(PROGS); do \
5f7b975a 28 install $$prog $(DESTDIR)$(bindir); \
4c6fabc2
JF
29 done
30
c92615b1 31install-doc: doc
bb8afc29
JF
32 mkdir -p $(DESTDIR)$(mandir)/man1 \
33 $(DESTDIR)$(mandir)/man5 \
34 $(DESTDIR)$(docdir)/tig
4c6fabc2
JF
35 for doc in $(DOCS); do \
36 case "$$doc" in \
5f7b975a
JH
37 *.1) install $$doc $(DESTDIR)$(mandir)/man1 ;; \
38 *.5) install $$doc $(DESTDIR)$(mandir)/man5 ;; \
bb8afc29 39 *.html) install $$doc $(DESTDIR)$(docdir)/tig ;; \
4c6fabc2 40 esac \
a7bc4b14 41 done
05f1685b
JF
42
43clean:
d839253b 44 rm -rf manual.html-chunked
de8f9b2b 45 rm -f $(PROGS) $(DOCS) core *.xml
05f1685b 46
57bdf034 47spell-check:
8eb62770 48 aspell --lang=en --check tig.1.txt tigrc.5.txt manual.txt
57bdf034 49
0e92d312
JF
50strip: all
51 strip $(PROGS)
52
c92615b1 53.PHONY: all all-debug doc install install-doc clean spell-check
a7bc4b14 54
9783cb12
JF
55manual.toc: manual.txt
56 sed -n '/^\[\[/,/\(---\|~~~\)/p' < $< | while read line; do \
57 case "$$line" in \
58 "-----"*) echo ". <<$$ref>>"; ref= ;; \
59 "~~~~~"*) echo "- <<$$ref>>"; ref= ;; \
60 "[["*"]]") ref="$$line" ;; \
61 *) ref="$$ref, $$line" ;; \
62 esac; done | sed 's/\[\[\(.*\)\]\]/\1/' > $@
63
b801d8b2
JF
64tig: tig.c
65
b8ae9346 66README.html: README
511147de 67 asciidoc -b xhtml11 -d article -a readme $<
b8ae9346 68
de8f9b2b
JF
69%.pdf : %.xml
70 docbook2pdf $<
71
a7bc4b14 72%.1.html : %.1.txt
4c6fabc2 73 asciidoc -b xhtml11 -d manpage $<
a7bc4b14
JF
74
75%.1.xml : %.1.txt
4c6fabc2 76 asciidoc -b docbook -d manpage $<
a7bc4b14
JF
77
78%.1 : %.1.xml
79 xmlto man $<
cb7f42cd
JF
80
81%.5.html : %.5.txt
82 asciidoc -b xhtml11 -d manpage $<
83
84%.5.xml : %.5.txt
85 asciidoc -b docbook -d manpage $<
86
87%.5 : %.5.xml
88 xmlto man $<
d839253b
JF
89
90%.html : %.txt
9783cb12 91 asciidoc -b xhtml11 -d article -n $<
d839253b
JF
92
93%.xml : %.txt
94 asciidoc -b docbook -d article $<
95
96%.html-chunked : %.xml
97 xmlto html -o $@ $<
604da3b7
JF
98
99# Maintainer stuff
100sync-docs:
101 cg switch release
102 -cg merge -n master
103 cg commit -m "Merge with master"
104 make doc
105 cg commit -m "Sync docs"
106 cg switch master