cogito: understand permissions written as "100755"
[cogito.git] / Documentation / Makefile
blobf404cdc1411a44d2c315d19e3a7239495ccd8680
1 CG_IGNORE=$(wildcard ../cg-X* ../cg-*.*)
2 CG_SRC=$(filter-out $(CG_IGNORE), $(wildcard ../cg*))
4 PACKAGE=cogito
6 MAN1_TXT=$(patsubst ../cg%,cg%.1.txt,$(CG_SRC))
7 MAN7_TXT=$(PACKAGE).7.txt cg-ref.7.txt
9 DOC_HTML=$(patsubst %.txt,%.html,$(MAN1_TXT) $(MAN7_TXT)) cg-ref.html introduction.html
11 DOC_MAN1=$(patsubst %.txt,%,$(MAN1_TXT))
12 DOC_MAN7=$(patsubst %.txt,%,$(MAN7_TXT))
14 DOC_PDF=$(patsubst %.txt,%.pdf,$(MAN1_TXT) $(MAN7_TXT)) cg-ref.pdf introduction.pdf
16 prefix?="$(HOME)"
17 mandir?=$(prefix)/man
18 man1=$(mandir)/man1
19 man7=$(mandir)/man7
20 docdir=$(prefix)/share/doc/$(PACKAGE)
21 txtdir=$(docdir)/txt
22 htmldir=$(docdir)/html
24 INSTALL?=install
27 # Please note that there is a minor bug in asciidoc.
28 # The version after 6.0.3 _will_ include the patch found here:
29 # http://marc.theaimsgroup.com/?l=git&m=111558757202243&w=2
31 # Until that version is released you may have to apply the patch
32 # yourself - yes, all 6 characters of it!
35 all: html man txt
37 html: $(DOC_HTML)
39 man: man1 man7
40 man1: $(DOC_MAN1)
41 man7: $(DOC_MAN7)
43 pdf: $(DOC_PDF)
45 txt: txt1 txt7
46 txt1: $(MAN1_TXT)
47 txt7: $(MAN7_TXT)
50 install: man txt
51 $(INSTALL) -m755 -d $(DESTDIR)/$(txtdir)
52 $(INSTALL) $(MAN1_TXT) $(MAN7_TXT) $(DESTDIR)/$(txtdir)
53 $(INSTALL) -m755 -d $(DESTDIR)/$(man1) $(DESTDIR)/$(man7)
54 $(INSTALL) $(DOC_MAN1) $(DESTDIR)/$(man1)
55 $(INSTALL) $(DOC_MAN7) $(DESTDIR)/$(man7)
57 install-html: html
58 $(INSTALL) -m755 -d $(DESTDIR)/$(htmldir)
59 $(INSTALL) $(DOC_HTML) $(DESTDIR)/$(htmldir)
61 test:
62 $(MAKE) -C tutorial-script test
64 clean:
65 $(MAKE) -C tutorial-script clean
66 rm -f *.xml *.html *.pdf *.1 *.7 cg*.[17].txt $(PACKAGE).7.txt
68 .PRECIOUS: cg%.txt introduction.txt
70 %.1.html : %.1.txt
71 asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
73 %.7.html : %.7.txt
74 asciidoc -b xhtml11 -d manpage -f asciidoc.conf $<
76 %.html : %.txt
77 asciidoc -b xhtml11 -d article -f asciidoc.conf -o $@ $<
79 %.1.xml : %.1.txt
80 asciidoc -b docbook -d manpage -f asciidoc.conf $<
82 %.7.xml : %.7.txt
83 asciidoc -b docbook -d manpage -f asciidoc.conf $<
85 %.xml : %.txt
86 asciidoc -b docbook -d article -f asciidoc.conf $<
88 %.1 : %.1.xml
89 xmlto man $<
91 %.7 : %.7.xml
92 xmlto man $<
94 %.pdf : %.xml
95 docbook2pdf $<
97 $(PACKAGE).7.txt : make-$(PACKAGE)-asciidoc
98 ./make-$(PACKAGE)-asciidoc > $@
100 cg-ref.7.txt : cg-ref.txt make-cg-ref-asciidoc
101 CGPACKAGE=$(PACKAGE) ./make-cg-ref-asciidoc $< > $@
103 # It seems that cg%.txt won't match this so use an explicit rule
104 cg.1.txt : ../cg make-cg-asciidoc
105 CGPACKAGE=$(PACKAGE) ./make-cg-asciidoc $< > $@
107 cg-%.1.txt : ../cg-% make-cg-asciidoc
108 CGPACKAGE=$(PACKAGE) ./make-cg-asciidoc $< > $@
110 introduction.txt: ../README
111 sed -e 's/\([a-zA-Z0-9_-]*\)(\([0-9]\))/gitlink:\1[\2]/g' $< >$@