sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 1 | |
| 2 | ##------------------------------------------------------------- |
| 3 | ## HACK: stuff to avoid making the print docs if installing the |
| 4 | ## tools to do so is impractical / too difficult |
| 5 | ##------------------------------------------------------------- |
| 6 | |
| 7 | # Comment out the next line to skip building print docs. The default |
| 8 | # is not to skip building print docs. Note, after changing it |
| 9 | # you of course need to re-run configure to make it take effect. |
njn | 54cd560 | 2005-09-30 02:17:40 +0000 | [diff] [blame] | 10 | BUILD_ALL_DOCS=yes |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 11 | |
| 12 | ##------------------------------------------------------------- |
| 13 | ## END OF HACK |
| 14 | ##------------------------------------------------------------- |
| 15 | |
| 16 | |
njn | f7c00b1 | 2005-07-19 21:46:19 +0000 | [diff] [blame] | 17 | SUBDIRS = xml lib images internals |
sewardj | de4a1d0 | 2002-03-22 01:27:54 +0000 | [diff] [blame] | 18 | |
njn | f7c00b1 | 2005-07-19 21:46:19 +0000 | [diff] [blame] | 19 | EXTRA_DIST = README |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 20 | |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 21 | |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 22 | ##------------------------------------------------------------------- |
| 23 | ## Below here is more ordinary make stuff... |
| 24 | ##------------------------------------------------------------------- |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 25 | myxmldir = $(top_srcdir)/docs/xml |
| 26 | myimgdir = $(top_srcdir)/docs/images |
| 27 | mylibdir = $(top_srcdir)/docs/lib |
| 28 | |
| 29 | myhtmldir = $(top_builddir)/docs/html |
| 30 | myprintdir = $(top_builddir)/docs/print |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 31 | |
de | 252c614 | 2005-11-27 04:10:00 +0000 | [diff] [blame] | 32 | websitedir = $(top_builddir)/docs/website |
| 33 | valkyriedir = $(top_builddir)/docs/vg-html |
| 34 | downloadsdir = $(top_builddir)/docs/downloads |
| 35 | vgdir = $(top_builddir)/docs/valgrind |
| 36 | |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 37 | XML_CATALOG_FILES = /etc/xml/catalog |
| 38 | |
| 39 | # file to log print output to |
| 40 | LOGFILE = print.log |
| 41 | |
| 42 | # validation stuff |
| 43 | XMLLINT = xmllint |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 44 | LINT_FLAGS = --noblanks --noout --xinclude --postvalid --noent |
| 45 | # validate with docbook 4.3 'cos it supports xml:base natively |
| 46 | VALID_FLAGS = --dtdvalid http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 47 | XMLLINT_FLAGS = $(LINT_FLAGS) $(VALID_FLAGS) |
| 48 | |
| 49 | # stylesheet processor |
| 50 | XSLTPROC = xsltproc |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 51 | XSLTPROC_FLAGS = --nonet --xinclude |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 52 | |
| 53 | # stylesheets |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 54 | XSL_HTML_CHUNK_STYLE = $(mylibdir)/vg-html-chunk.xsl |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 55 | XSL_FO_STYLE = $(mylibdir)/vg-fo.xsl |
de | 9bec93c | 2005-11-25 05:36:48 +0000 | [diff] [blame] | 56 | XSL_TEXT_STYLE = $(mylibdir)/vg-faq2txt.xsl |
de | 252c614 | 2005-11-27 04:10:00 +0000 | [diff] [blame] | 57 | XSL_WEBSITE_STYLE = $(mylibdir)/vg-html-website.xsl |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 58 | XSL_MAN_STYLE = /usr/share/xml/docbook/stylesheet/nwalsh/1.69.0/manpages/docbook.xsl |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 59 | |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 60 | all-docs: FAQ.txt man-page html-docs print-docs |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 61 | |
| 62 | valid: |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 63 | $(XMLLINT) $(XMLLINT_FLAGS) $(myxmldir)/index.xml |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 64 | |
njn | 15d7c34 | 2005-09-30 01:43:32 +0000 | [diff] [blame] | 65 | # The text version of the FAQ. |
de | 9bec93c | 2005-11-25 05:36:48 +0000 | [diff] [blame] | 66 | FAQ.txt: |
| 67 | @echo "Generating the text version of the FAQ ..." |
| 68 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \ |
| 69 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./FAQ.txt $(XSL_TEXT_STYLE) $(myxmldir)/FAQ.xml |
sewardj | 163566b | 2005-11-01 03:08:41 +0000 | [diff] [blame] | 70 | |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 71 | # the valgrind manpage |
| 72 | man-page: |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 73 | if test ! -f $(XSL_MAN_STYLE); then \ |
| 74 | echo "Error: I can't find the file '$(XSL_MAN_STYLE)'"; \ |
| 75 | echo "Please check where it lives on your system, and" \ |
| 76 | "amend the line 'XSL_MAN_STYLE = ' in this Makefile."; \ |
| 77 | exit 1; \ |
| 78 | fi; |
de | bad57fc | 2005-12-03 22:33:29 +0000 | [diff] [blame] | 79 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \ |
| 80 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o ./ $(XSL_MAN_STYLE) $(myxmldir)/valgrind-manpage.xml |
| 81 | |
de | 9bec93c | 2005-11-25 05:36:48 +0000 | [diff] [blame] | 82 | # chunked html, on a chapter-by-chapter basis |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 83 | html-docs: |
| 84 | @echo "Generating html files..." |
njn | b026720 | 2005-07-25 21:12:40 +0000 | [diff] [blame] | 85 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \ |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 86 | mkdir -p $(myhtmldir) && \ |
| 87 | /bin/rm -fr $(myhtmldir)/ && \ |
| 88 | mkdir -p $(myhtmldir)/ && \ |
| 89 | mkdir -p $(myhtmldir)/images && \ |
| 90 | cp $(mylibdir)/vg_basic.css $(myhtmldir)/ && \ |
| 91 | cp $(myimgdir)/*.png $(myhtmldir)/images && \ |
| 92 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myhtmldir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 93 | |
| 94 | # pdf and postscript |
| 95 | print-docs: |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 96 | @echo "Generating PDF file: $(myprintdir)/index.pdf (please be patient)..."; |
njn | b026720 | 2005-07-25 21:12:40 +0000 | [diff] [blame] | 97 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) && \ |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 98 | mkdir -p $(myprintdir) && \ |
| 99 | mkdir -p $(myprintdir)/images && \ |
| 100 | cp $(myimgdir)/massif-graph-sm.png $(myprintdir)/images && \ |
| 101 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(myprintdir)/index.fo $(XSL_FO_STYLE) $(myxmldir)/index.xml && \ |
| 102 | (cd $(myprintdir) && \ |
njn | b026720 | 2005-07-25 21:12:40 +0000 | [diff] [blame] | 103 | ( pdfxmltex index.fo && \ |
| 104 | pdfxmltex index.fo && \ |
sewardj | 163566b | 2005-11-01 03:08:41 +0000 | [diff] [blame] | 105 | pdfxmltex index.fo ) &> $(LOGFILE) < /dev/null && \ |
njn | 804947e | 2005-09-13 04:10:45 +0000 | [diff] [blame] | 106 | echo "Generating PS file: $(myprintdir)/index.ps ..." && \ |
sewardj | 27eca03 | 2005-07-25 17:53:46 +0000 | [diff] [blame] | 107 | pdftops index.pdf && \ |
njn | b026720 | 2005-07-25 21:12:40 +0000 | [diff] [blame] | 108 | rm -f *.log *.aux *.fo *.out) |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 109 | |
| 110 | # If the docs have been built, install them. But don't worry if they have |
| 111 | # not -- developers do 'make install' not from a 'make dist'-ified distro all |
| 112 | # the time. |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 113 | # |
| 114 | # Note: this is done at 'make install' time. |
| 115 | # Note 2: the ifeq/else/endif have to be indented one space |
| 116 | # because otherwise it seems that automake thinks it should |
| 117 | # be the one to handle the else/endif parts, not GNU make |
| 118 | # as we intend. |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 119 | install-data-hook: |
| 120 | if test -r html ; then \ |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 121 | mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \ |
| 122 | cp -r html $(DESTDIR)$(datadir)/doc/valgrind; \ |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 123 | fi |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 124 | ifeq ($(BUILD_ALL_DOCS),yes) |
| 125 | if test -r index.pdf ; then \ |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 126 | mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \ |
sewardj | 645580e | 2005-07-25 23:36:58 +0000 | [diff] [blame] | 127 | cp index.pdf $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.pdf; \ |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 128 | fi |
| 129 | if test -r index.ps ; then \ |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 130 | mkdir -p $(DESTDIR)$(datadir)/doc/valgrind; \ |
sewardj | 645580e | 2005-07-25 23:36:58 +0000 | [diff] [blame] | 131 | cp index.ps $(DESTDIR)$(datadir)/doc/valgrind/valgrind_manual.ps; \ |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 132 | fi |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 133 | if test -r valgrind.1 ; then \ |
| 134 | mkdir -p $(DESTDIR)$(mandir)/man1; \ |
| 135 | cp valgrind.1 $(DESTDIR)$(mandir)/man1/valgrind.1; \ |
| 136 | fi |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 137 | endif |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 138 | |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 139 | # This is done at 'make dist' time. It builds the html docs, print |
| 140 | # docs and man page and copies them into the docs/ directory in the |
| 141 | # tarball. |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 142 | ifeq ($(BUILD_ALL_DOCS),yes) |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 143 | dist-hook: FAQ.txt html-docs print-docs man-page |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 144 | cp -r html $(distdir) |
njn | 15d7c34 | 2005-09-30 01:43:32 +0000 | [diff] [blame] | 145 | cp FAQ.txt $(distdir)/.. |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 146 | cp valgrind.1 $(distdir) |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 147 | cp print/index.pdf $(distdir) |
| 148 | cp print/index.ps $(distdir) |
| 149 | else |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 150 | dist-hook: FAQ.txt html-docs man-page |
njn | 15d7c34 | 2005-09-30 01:43:32 +0000 | [diff] [blame] | 151 | cp FAQ.txt $(distdir)/.. |
sewardj | d6bfc84 | 2005-07-25 23:01:43 +0000 | [diff] [blame] | 152 | cp -r html $(distdir) |
| 153 | endif |
njn | 3e986b2 | 2004-11-30 10:43:45 +0000 | [diff] [blame] | 154 | |
| 155 | distclean-local: |
| 156 | rm -rf html print |
njn | 15d7c34 | 2005-09-30 01:43:32 +0000 | [diff] [blame] | 157 | rm -f $(top_builddir)/FAQ.txt |
de | 252c614 | 2005-11-27 04:10:00 +0000 | [diff] [blame] | 158 | |
| 159 | |
| 160 | |
sewardj | e60fc58 | 2005-12-04 15:00:06 +0000 | [diff] [blame] | 161 | # ----------------------------------------------------------------------- |
| 162 | # Note: the rest of this file is nothing to do with the normal build |
| 163 | # tree. The stuff below contains special targets for web-site |
| 164 | # artefacts. |
de | 252c614 | 2005-11-27 04:10:00 +0000 | [diff] [blame] | 165 | |
| 166 | # chunked html with no html/body tags, css, or top nav, to fit into the website |
| 167 | website-docs: |
| 168 | @echo "Generating website html files ..." |
| 169 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) |
| 170 | /bin/rm -fr $(websitedir) |
| 171 | mkdir -p $(websitedir) |
| 172 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(websitedir)/ $(XSL_WEBSITE_STYLE) $(myxmldir)/index.xml |
| 173 | |
| 174 | # valkyrie carries around her own copy of the valgrind manual |
| 175 | valkyrie-docs: |
| 176 | @echo "Generating a set of valgrind docs for valkyrie..." |
| 177 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) |
| 178 | /bin/rm -fr $(valkyriedir) |
| 179 | mkdir -p $(valkyriedir) |
| 180 | mkdir -p $(valkyriedir)/images |
| 181 | cp $(mylibdir)/vg_basic.css $(valkyriedir)/ |
| 182 | cp $(myimgdir)/*.png $(valkyriedir)/images/ |
| 183 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(valkyriedir)/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml |
| 184 | |
| 185 | # html.tar.bz2, .pdf, .ps.bz2 files for downloading from the website |
| 186 | download-docs: |
| 187 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) |
| 188 | /bin/rm -fr $(downloadsdir) |
| 189 | mkdir -p $(downloadsdir) |
| 190 | @echo "" |
| 191 | @echo "Generating valgrind_manual.html.tar.bz2 ..." |
| 192 | export XML_CATALOG_FILES=$(XML_CATALOG_FILES) |
| 193 | /bin/rm -fr $(vgdir) |
| 194 | mkdir -p $(vgdir) |
| 195 | mkdir -p $(vgdir)/html |
| 196 | mkdir -p $(vgdir)/html/images |
| 197 | cp $(mylibdir)/vg_basic.css $(vgdir)/html/ |
| 198 | cp $(myimgdir)/*.png $(vgdir)/html/images/ |
| 199 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/html/ $(XSL_HTML_CHUNK_STYLE) $(myxmldir)/index.xml |
| 200 | (cd $(top_builddir)/docs/ && \ |
| 201 | (tar cfj $(downloadsdir)/valgrind_manual.html.tar.bz2 ./valgrind/html/ ) ) |
| 202 | /bin/rm -fr $(vgdir)/html/ |
| 203 | @echo "" |
| 204 | @echo "Generating valgrind_manual.pdf ..." |
| 205 | mkdir -p $(vgdir)/print |
| 206 | mkdir -p $(vgdir)/print/images |
| 207 | cp $(myimgdir)/massif-graph-sm.png $(vgdir)/print/images/ |
| 208 | $(XSLTPROC) $(XSLTPROC_FLAGS) -o $(vgdir)/print/manual.fo $(XSL_FO_STYLE) $(myxmldir)/index.xml |
| 209 | (cd $(vgdir)/print/ && \ |
| 210 | ( pdfxmltex manual.fo && \ |
| 211 | pdfxmltex manual.fo && \ |
| 212 | pdfxmltex manual.fo ) &> $(LOGFILE) < /dev/null ) |
| 213 | @echo "" |
| 214 | @echo "Generating valgrind_manual.ps.bz2 ..." |
| 215 | (cd $(vgdir)/print/ && \ |
| 216 | ( pdftops manual.pdf ) ) |
| 217 | mv $(vgdir)/print/manual.pdf $(downloadsdir)/valgrind_manual.pdf |
| 218 | mv $(vgdir)/print/manual.ps $(downloadsdir)/valgrind_manual.ps |
| 219 | bzip2 $(downloadsdir)/valgrind_manual.ps |
| 220 | /bin/rm -fr $(vgdir) |