Makefile.am: Re-organize xml sources.
[platform/upstream/gcc.git] / libstdc++-v3 / doc / Makefile.am
1 ## Makefile for the doc subdirectory of the GNU C++ Standard library.
2 ##
3 ## Copyright (C) 2008, 2009, 2010 Free Software Foundation, Inc.
4 ##
5 ## This file is part of the libstdc++ version 3 distribution.
6 ## Process this file with automake to produce Makefile.in.
7
8 ## This file is part of the GNU ISO C++ Library.  This library is free
9 ## software; you can redistribute it and/or modify it under the
10 ## terms of the GNU General Public License as published by the
11 ## Free Software Foundation; either version 3, or (at your option)
12 ## any later version.
13
14 ## This library is distributed in the hope that it will be useful,
15 ## but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ## GNU General Public License for more details.
18
19 ## You should have received a copy of the GNU General Public License along
20 ## with this library; see the file COPYING3.  If not see
21 ## <http://www.gnu.org/licenses/>.
22
23 include $(top_srcdir)/fragment.am
24
25 # Documentation Overview
26 #
27 # There are two main source materials for libstdc++ documentation.
28 # The first is the doxygen markup in libstdc++ sources. And the second
29 # is the docbook markup in doc/xml/. A third and more obscure option
30 # deals with charting performance tests.
31
32 # Default, points to current best sub-rule that is the best conversion.
33 # MAN
34 doc-man: doc-man-doxygen
35
36 # PDF
37 doc-pdf: doc-pdf-dblatex-docbook
38
39 # HTML
40 doc-html: doc-html-docbook
41
42
43 # Doxygen configuration
44 # Assumes doxygen, graphviz (with dot), pdflatex installed
45 doxygen_script=${top_srcdir}/scripts/run_doxygen
46 doxygen_outdir = ${glibcxx_builddir}/doc/doxygen
47 doc-html-doxygen:
48         -(srcdir=`cd ${top_srcdir}; ${PWD_COMMAND}`; \
49           builddir=`cd ..; ${PWD_COMMAND}`; \
50           ${SHELL} ${doxygen_script} \
51           --host_alias=${host_alias} --mode=html $${srcdir} $${builddir} YES)
52
53 doc-man-doxygen:
54         -(srcdir=`cd ${top_srcdir}; ${PWD_COMMAND}`; \
55           builddir=`cd ..; ${PWD_COMMAND}`; \
56           ${SHELL} ${doxygen_script} \
57           --host_alias=${host_alias} --mode=man $${srcdir} $${builddir} YES)
58
59 doc-xml-doxygen:
60         -(srcdir=`cd ${top_srcdir}; ${PWD_COMMAND}`; \
61           builddir=`cd ..; ${PWD_COMMAND}`; \
62           ${SHELL} ${doxygen_script} \
63           --host_alias=${host_alias} --mode=xml $${srcdir} $${builddir} NO)
64
65 doc-xml-single-doxygen: doc-xml-doxygen
66         @echo "Generating doxygen xml single file..."
67         $(XSLTPROC) ${doxygen_outdir}/xml/combine.xslt \
68         ${doxygen_outdir}/xml/index.xml > ${doxygen_outdir}/xml/api-spine.xml;
69
70 doc-latex-doxygen:
71         -(srcdir=`cd ${top_srcdir}; ${PWD_COMMAND}`; \
72           builddir=`cd ..; ${PWD_COMMAND}`; \
73           ${SHELL} ${doxygen_script} \
74           --host_alias=${host_alias} --mode=latex $${srcdir} $${builddir} NO)
75
76 # Chance of loooooonnggg wait time when creating this file.
77 doxygen_pdf = ${doxygen_outdir}/latex/refman.pdf
78
79 doc-pdf-doxygen: stamp-latex-doxygen
80         -(cd ${doxygen_outdir}/latex && $(MAKE) -i pdf;)
81         echo "Generating doxygen pdf file...";
82         if [ -f ${doxygen_pdf} ]; then \
83           echo "... ${doxygen_pdf}"; \
84         else \
85           echo "... error"; \
86           exit 12; \
87         fi
88
89 stamp-xml-doxygen:
90         @if [ ! -f stamp-xml-doxygen ]; then \
91           $(MAKE) doc-xml-single-doxygen; \
92         fi
93         $(STAMP) stamp-xml-doxygen
94
95 stamp-latex-doxygen:
96         @if [ ! -f stamp-latex-doxygen ]; then \
97           $(MAKE) doc-latex-doxygen; \
98         fi
99         $(STAMP) stamp-latex-doxygen
100
101 # Docbook configuration.
102 # Assumes
103 # libxslt
104 # dblatex
105 # pdflatex
106 # docbook-style-xsl
107 # emacs-nxml-mode
108 # xmlto passivetex
109 docbook_outdir = ${glibcxx_builddir}/doc/docbook
110 xml_dir = ${glibcxx_srcdir}/doc/xml
111
112 xml_sources_basic = \
113         ${xml_dir}/spine.xml \
114         ${xml_dir}/authors.xml \
115         ${xml_dir}/api.xml \
116         ${xml_dir}/faq.xml
117
118 xml_sources_manual = \
119         ${xml_dir}/manual/abi.xml \
120         ${xml_dir}/manual/algorithms.xml \
121         ${xml_dir}/manual/allocator.xml \
122         ${xml_dir}/manual/auto_ptr.xml \
123         ${xml_dir}/manual/atomics.xml \
124         ${xml_dir}/manual/backwards_compatibility.xml \
125         ${xml_dir}/manual/bitmap_allocator.xml \
126         ${xml_dir}/manual/build_hacking.xml \
127         ${xml_dir}/manual/codecvt.xml \
128         ${xml_dir}/manual/concurrency.xml \
129         ${xml_dir}/manual/concurrency_extensions.xml \
130         ${xml_dir}/manual/configure.xml \
131         ${xml_dir}/manual/containers.xml \
132         ${xml_dir}/manual/ctype.xml \
133         ${xml_dir}/manual/debug_mode.xml \
134         ${xml_dir}/manual/debug.xml \
135         ${xml_dir}/manual/diagnostics.xml \
136         ${xml_dir}/manual/evolution.xml \
137         ${xml_dir}/manual/extensions.xml \
138         ${xml_dir}/manual/internals.xml \
139         ${xml_dir}/manual/intro.xml \
140         ${xml_dir}/manual/io.xml \
141         ${xml_dir}/manual/iterators.xml \
142         ${xml_dir}/manual/locale.xml \
143         ${xml_dir}/manual/localization.xml \
144         ${xml_dir}/manual/messages.xml \
145         ${xml_dir}/manual/mt_allocator.xml \
146         ${xml_dir}/manual/numerics.xml \
147         ${xml_dir}/manual/parallel_mode.xml \
148         ${xml_dir}/manual/prerequisites.xml \
149         ${xml_dir}/manual/profile_mode.xml \
150         ${xml_dir}/manual/shared_ptr.xml \
151         ${xml_dir}/manual/spine.xml \
152         ${xml_dir}/manual/status_cxx1998.xml \
153         ${xml_dir}/manual/status_cxx200x.xml \
154         ${xml_dir}/manual/status_cxxtr1.xml \
155         ${xml_dir}/manual/status_cxxtr24733.xml \
156         ${xml_dir}/manual/strings.xml \
157         ${xml_dir}/manual/support.xml \
158         ${xml_dir}/manual/test.xml \
159         ${xml_dir}/manual/using.xml \
160         ${xml_dir}/manual/using_exceptions.xml \
161         ${xml_dir}/manual/utilities.xml \
162         ${xml_dir}/manual/appendix_free.xml \
163         ${xml_dir}/manual/appendix_contributing.xml \
164         ${xml_dir}/manual/appendix_porting.xml
165
166 xml_sources_extra = \
167         ${xml_dir}/gnu/fdl-1.2.xml \
168         ${xml_dir}/gnu/gpl-2.0.xml
169
170 xml_sources = \
171         ${xml_sources_basic} \
172         ${xml_sources_manual} \
173         ${xml_sources_extra}
174
175 xml_noinst = \
176         ${xml_dir}/book.txml \
177         ${xml_dir}/chapter.txml \
178         ${xml_dir}/class.txml \
179         ${xsl_dir}/doxygen2boostbook.xsl \
180         ${xsl_dir}/boostbook2docbook.xsl \
181         ${xsl_dir}/lookup.xsl
182
183
184 XSLTPROC       = xsltproc
185 XSLTPROC_FLAGS = --nonet --xinclude
186 XSL_STYLE_DIR = /usr/share/sgml/docbook/xsl-stylesheets
187 XSL_FO_STYLE = $(XSL_STYLE_DIR)/fo/docbook.xsl
188 XSL_HTML_STYLE = $(XSL_STYLE_DIR)/xhtml/chunk.xsl
189 #XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml/onechunk.xsl
190 XSL_HTML_SINGLE_STYLE = $(XSL_STYLE_DIR)/xhtml/docbook.xsl
191
192 ${docbook_outdir}/html:
193         mkdir -p ${docbook_outdir}/html
194
195 ${docbook_outdir}/pdf:
196         mkdir -p ${docbook_outdir}/pdf
197
198 ${docbook_outdir}/fo:
199         mkdir -p ${docbook_outdir}/fo
200
201 ${docbook_outdir}/xml:
202         mkdir -p ${docbook_outdir}/xml
203
204 # Validate existing XML structure.
205 XMLLINT = xmllint
206 #LINT_FLAGS = --debug --nonet --xinclude --nsclean --postvalid --nowarning
207 #LINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent
208 LINT_FLAGS = --postvalid --debug --xinclude --noent --noblanks  --nonet --noout
209 VALID_FLAGS = --dtdvalid http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd
210 XMLLINT_FLAGS = $(LINT_FLAGS) $(VALID_FLAGS)
211 doc-xml-validate-docbook: $(xml_sources)
212         @echo "Generating XML validation log..."
213         $(XMLLINT) $(XMLLINT_FLAGS) ${top_srcdir}/doc/xml/spine.xml
214
215 doc-xml-single-docbook: $(xml_sources) ${docbook_outdir}/xml
216         @echo "Generating XML single..."
217         $(XMLLINT) --xinclude --noent --noblanks \
218         -o ${docbook_outdir}/xml/spine-single.xml \
219         ${top_srcdir}/doc/xml/spine.xml
220
221 # HTML, index plus chapters
222 doc-html-docbook: $(xml_sources) ${docbook_outdir}/html
223         @echo "Generating html files..."
224         $(XSLTPROC) $(XSLTPROC_FLAGS) -o ${docbook_outdir}/html/ \
225         $(XSL_HTML_STYLE) ${top_srcdir}/doc/xml/spine.xml
226
227 # HTML, all one page
228 doc-html-single-docbook: $(xml_sources) ${docbook_outdir}/html
229         @echo "Generating html single file..."
230         $(XSLTPROC) $(XSLTPROC_FLAGS) -o ${docbook_outdir}/html/ \
231         $(XSL_HTML_SINGLE_STYLE) ${top_srcdir}/doc/xml/spine.xml
232
233 # FO
234 doc-fo-docbook: $(xml_sources) ${docbook_outdir}/fo
235         @echo "Generating FO files..."
236         $(XSLTPROC) $(XSLTPROC_FLAGS) -o ${docbook_outdir}/fo/spine.fo \
237         $(XSL_FO_STYLE) ${top_srcdir}/doc/xml/spine.xml
238
239 # PDF 1
240 # fop
241 FOP = fop
242 FOP_FLAGS = -d -r
243 doc-pdf-fop-xml-docbook: $(xml_sources) ${glibcxx_builddir}/doc/pdf
244         @echo "Generating pdf fop files from xml..."
245         $(FOP) $(FOP_FLAGS) -xml ${top_srcdir}/doc/xml/spine.xml \
246         -xsl $(XSL_FO_STYLE) -pdf ${docbook_outdir}/pdf/spine.pdf
247
248 doc-pdf-fop-fo-docbook: $(xml_sources) ${glibcxx_builddir}/doc/pdf doc-fo
249         @echo "Generating pdf fop files from fo..."
250         $(FOP) $(FOP_FLAGS) -fo ${docbook_outdir}/fo/spine.fo \
251         -pdf ${docbook_outdir}/pdf/spine.pdf
252
253 # PDF 2
254 # xmlto
255 XML2PDF = xmlto
256 XML2PDF_FLAGS = -v pdf --skip-validation -o pdf
257 doc-pdf-xmlto-docbook: $(xml_sources) ${docbook_outdir}/pdf
258         @echo "Generating pdf xmlto files..."
259         $(XML2PDF) $(XML2PDF_FLAGS) ${top_srcdir}/doc/xml/spine.xml
260
261 # PDF 3
262 # xmlroff
263 XMLROFF = xmlroff
264 XMLROFF_FLAGS = --format=pdf --backend=cairo --warn=1 --debug=1 --continue
265 doc-pdf-xmlroff-docbook: $(xml_sources) doc-fo
266         @echo "Generating pdf xmlroff files..."
267         $(XMLROFF) $(XMLROFF_FLAGS) ${docbook_outdir}/fo/spine.fo
268
269 # PDF 4
270 # prince
271 PRINCE = prince
272 PRINCE_FLAGS = --log prince.log -o pdf/spine.pdf
273 doc-pdf-prince-docbook: $(xml_sources) ${docbook_outdir}/pdf
274         @echo "Generating pdf prince files..."
275         $(PRINCE) $(PRINCE_FLAGS) ${top_srcdir}/xml/spine.xml
276
277 # PDF 5
278 # dblatex
279 DBLATEX_FLAGS = --dump --verbose --pdf -o ${docbook_outdir}/pdf/manual.pdf
280 doc-pdf-dblatex-docbook: $(xml_sources) ${docbook_outdir}/pdf
281         @echo "Generating pdf dblatex files..."
282         dblatex $(DBLATEX_FLAGS) ${top_srcdir}/doc/xml/spine.xml
283
284
285 # Performance doc and graph configuration.
286 # Assumes pychart, beautiful soup installed.
287 # Generates the plots and graphs for performance testing.
288 doc_performance_script=${top_srcdir}/scripts/make_graphs.py
289 doc-html-performance:
290         -@(chmod + ${doc_performance_script}; \
291         ${doc_performance_script} ${top_srcdir} \
292         ${glibcxx_builddir}/testsuite \
293         ${top_srcdir}/testsuite/data/make_graph_htmls.xml \
294         ${top_srcdir}/testsuite/data/make_graph_test_infos.xml local g++)
295
296 .PHONY: doc-doxygen-html doc-doxygen-man doc-performance
297
298 # By adding these files here, automake will remove them for 'make clean'
299 CLEANFILES = *.log
300
301 # To remove directories.
302 clean-local:
303         rm -rf man html pdf fo xml doxygen docbook stamp*