source: rtems-tools/doc/asciidoc/doc/main.aap @ f91e023

4.104.115
Last change on this file since f91e023 was f91e023, checked in by Chris Johns <chrisj@…>, on 02/17/14 at 07:04:46

Add the documentation.

  • Property mode set to 100644
File size: 8.1 KB
Line 
1#####################################################################
2#
3# A-A-P file for making AsciiDoc distribution documentation.
4# (you can obtain A-A-P from http://www.a-a-p.org)
5#
6# Stuart Rackham <srackham@gmail.com>
7#####################################################################
8
9:execute ../common.aap
10
11ASCIIDOC = python ../asciidoc.py -a revnumber=$(VERS)@ -a revdate="$(DATE)@"
12A2X = python ../a2x.py
13
14:syseval which fop | :assign FOP
15@if not _no.FOP:
16    :syseval which fop.sh | :assign FOP
17:syseval which lynx | :assign LYNX          # Converts HTML to text.
18:syseval which xmllint | :assign XMLLINT    # Validates XML.
19:syseval which dblatex | :assign DBLATEX    # Converts DocBook XML to PDF.
20:syseval which aspell | :assign ASPELL
21:syseval which xsltproc | :assign XSLTPROC
22
23ROOT = asciidoc asciidoc.1
24INFILES = $*(ROOT).txt
25CHUNK_DIR = ./asciidoc.chunked
26HTMLHELP_DIR = ./asciidoc.htmlhelp
27HTMLHELP_FILE = asciidoc
28
29OUTFILES = $*(ROOT).html $*(ROOT).css.html $*(ROOT).css-embedded.html \
30        asciidoc.pdf asciidoc.1.man a2x.1.man \
31        article.html book.html book-multi.html asciidoc.xml asciidoc.1.xml \
32        ../BUGS ../CHANGELOG ../README ../INSTALL \
33        latex-backend.html \
34        $HTMLHELP_DIR/index.html \
35        $CHUNK_DIR/index.html \
36        article.pdf \
37        latexmath.pdf \
38        latex-filter.pdf \
39        source-highlight-filter.pdf \
40        music-filter.pdf \
41        book.epub \
42        article-standalone.html \
43        article-html5-toc2.html
44
45TEST_FILES = $*(ROOT).css-embedded.html
46        article.css-embedded.html book.css-embedded.html \
47        article.xml book.xml book-multi.xml asciidoc.xml asciidoc.1.xml \
48        asciidoc.1.html a2x.1.xml music-filter.xml \
49        book.epub asciidoc.epub \
50
51
52#####################################################################
53# Filetype build rules.
54#####################################################################
55
56:rule %.epub : %.txt
57    :sys $A2X -f epub -d book --epubcheck --icons $source
58
59:rule %.text : %.txt
60    # Convert AsciiDoc to HTML then use lynx(1) to convert HTML to text.
61    @if not _no.LYNX:
62        :print WARNING: lynx(1) unavailable: skipping $target file generation
63    @else:
64        opt = -f ../text.conf
65        @if source_list[0] == 'asciidoc.1.txt':
66            opt += -d manpage
67        @else:
68            opt += -n
69        :sys $ASCIIDOC $opt -b html4 -o - $source | \
70            lynx -dump -stdin > $target
71
72:rule %.css.html : %.txt
73    opt =
74    @if source_list[0] == 'asciidoc.1.txt':
75        opt += -d manpage
76    @else:
77        opt += -n
78        opt += -a toc -a toclevels=2 -a scriptsdir=../javascripts
79    :sys $ASCIIDOC $opt -b xhtml11 -a linkcss -a icons -a stylesdir=../stylesheets -o $target $(source[0])
80    @if _no.XMLLINT:
81        :sys $XMLLINT --nonet --noout --valid $target
82    @else:
83        :print WARNING: xmllint(1) unavailable: skipping validation
84
85:rule %.css-embedded.html : %.txt
86    opt =
87    @if source_list[0] == 'asciidoc.1.txt':
88        opt += -d manpage
89    @else:
90        opt += -n
91        opt += -a toc -a toclevels=2
92    :sys $ASCIIDOC -b xhtml11 $opt -o $target $(source[0])
93    @if _no.XMLLINT:
94        :sys $XMLLINT --nonet --noout --valid $target
95    @else:
96        :print WARNING: xmllint(1) unavailable: skipping validation
97
98:rule %.xml : %.txt
99    opt =
100    @if source_list[0] in ('asciidoc.1.txt','a2x.1.txt'):
101        opt += -d manpage
102    @else:
103        opt += -n
104    @if source_list[0] == 'asciidoc.txt' or source_list[0].startswith('book'):
105        opt += -d book
106    :sys $ASCIIDOC $opt -b docbook $(source[0])
107    @if _no.XMLLINT:
108        :sys $XMLLINT --nonet --noout --valid $target
109    @else:
110        :print WARNING: xmllint(1) unavailable: skipping validation
111
112:rule %.sgml : %.txt
113    opt =
114    @if source_list[0] in ('asciidoc.1.txt','a2x.1.txt'):
115        opt += -d manpage
116    @if source_list[0] == 'asciidoc.txt' or source_list[0].startswith('book'):
117        opt += -d book
118    :sys $ASCIIDOC $opt -b docbook-sgml $(source[0])
119
120:rule %.html: %.xml
121    :sys $XSLTPROC --nonet --stringparam admon.textlabel 0 --stringparam html.stylesheet ./docbook-xsl.css ../docbook-xsl/xhtml.xsl $source >$target
122
123:rule %.man : %.xml
124    :sys $XSLTPROC --nonet ../docbook-xsl/manpage.xsl $source
125    :sys touch $target  # Dummy target.
126
127:rule %.fo: %.xml
128    :sys $XSLTPROC --nonet --stringparam admon.textlabel 0 ../docbook-xsl/fo.xsl $source >$target
129
130# This kludge forces the User Guide and LaTeX related PDFs to be generated
131# using dblatex so we include a dblatex example in the distribution.
132@if _no.DBLATEX:
133    asciidoc.pdf: asciidoc.txt
134        :sys $ASCIIDOC -b docbook $(source[0])
135        :sys $DBLATEX -p ../dblatex/asciidoc-dblatex.xsl -s ../dblatex/asciidoc-dblatex.sty -o $target asciidoc.xml
136    latexmath.pdf: latexmath.xml
137        :sys $DBLATEX -p ../dblatex/asciidoc-dblatex.xsl -s ../dblatex/asciidoc-dblatex.sty -o $target $source
138    latex-filter.pdf: latex-filter.xml
139        :sys $DBLATEX -p ../dblatex/asciidoc-dblatex.xsl -s ../dblatex/asciidoc-dblatex.sty -o $target $source
140
141# Force the Source Highlighter PDF to be generated using dblatex
142# because dblatex has builtin source code highlighting.
143@if _no.DBLATEX:
144    source-highlight-filter.pdf: source-highlight-filter.xml
145        :sys $DBLATEX -p ../dblatex/asciidoc-dblatex.xsl -s ../dblatex/asciidoc-dblatex.sty -o $target $source
146
147@if _no.FOP:
148    :rule %.pdf: %.fo
149        :sys $FOP $source $target
150@elif _no.DBLATEX:
151    # Fall back to dblatex if no FOP.
152    :rule %.pdf: %.xml
153        :sys $DBLATEX -p ../dblatex/asciidoc-dblatex.xsl -s ../dblatex/asciidoc-dblatex.sty -o $target $source
154@else:
155    :rule %.pdf:
156        :print WARNING: PDF processor  unavailable: skipping $target file generation
157
158
159#####################################################################
160# Explicit file generation (cases that don't fit the rules).
161#####################################################################
162
163article-standalone.html: article.txt
164    :sys $ASCIIDOC -a data-uri -a icons -a toc -a max-width=55em -o $target $source
165
166article-html5-toc2.html: article.txt
167    :sys $ASCIIDOC -b html5 -a icons -a toc2 -a theme=flask -o $target $source
168
169asciidoc.1.html: asciidoc.1.txt
170    :sys $ASCIIDOC -d manpage -b html4 $source
171    @if _no.XMLLINT:
172        :sys $XMLLINT --nonet --noout --valid --html $target
173    @else:
174        :print WARNING: xmllint(1) unavailable: skipping validation
175
176# User Guide 'chunked' into linked HTML pages.
177$CHUNK_DIR/index.html: asciidoc.txt
178    :sys $A2X -fchunked -dbook --icons -D ./ asciidoc.txt
179
180# HTML Help formatted User Guide.
181$HTMLHELP_DIR/index.html: asciidoc.xml
182    :sys $A2X -fhtmlhelp -dbook --icons -D ./ asciidoc.txt
183
184../BUGS: ../BUGS.text
185    # Make BUGS.text and copy to BUGS.
186    :copy ../BUGS.text ../BUGS
187
188../CHANGELOG: ../CHANGELOG.text
189    # Make CHANGELOG.text and copy to CHANGELOG.
190    :copy ../CHANGELOG.text ../CHANGELOG
191
192../README: ../README.text
193    # Make README.text and copy to README.
194    :copy ../README.text ../README
195
196../INSTALL: ../INSTALL.text
197    # Make INSTALL.text and copy to INSTALL.
198    :copy ../INSTALL.text ../INSTALL
199
200asciimathml.html: asciimathml.txt
201    :sys $ASCIIDOC -a asciimath $source
202    # No xmllint(1) checking -- fails on embedded JavaScript.
203
204latexmathml.html: latexmathml.txt
205    :sys $ASCIIDOC -a latexmath $source
206    # No xmllint(1) checking -- fails on embedded JavaScript.
207
208
209#####################################################################
210# Build commands.
211#####################################################################
212
213all: $OUTFILES
214
215clean:
216    :del {f} $OUTFILES $TEST_FILES
217    :del {f} *.bak          # Remove aspell backups.
218
219spell: $INFILES ../CHANGELOG.txt ../README.txt ../BUGS.txt ../INSTALL.txt \
220        a2x.1.txt faq.txt asciidocapi.txt testasciidoc.txt \
221        epub-notes.txt publishing-ebooks-with-asciidoc.txt \
222        source-highlight-filter.txt \
223        slidy.txt slidy-example.txt
224    # Interactively spell check all files.
225    @for s in source_list:
226        :sys {i} $ASPELL check -p ./asciidoc.dict $s
227
228clean_testfiles:
229    :del {f} $TEST_FILES
230    :del {f} music*.png     # Force Lilypond to run.
231
232test: clean_testfiles $TEST_FILES
233    # Force generation and validation of .html and Docbook (.xml) files.
Note: See TracBrowser for help on using the repository browser.