Ingo Molnar | c1c2365 | 2009-05-30 12:38:51 +0200 | [diff] [blame] | 1 | MAN1_TXT= \ |
| 2 | $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \ |
| 3 | $(wildcard perf-*.txt)) \ |
| 4 | perf.txt |
| 5 | MAN5_TXT= |
| 6 | MAN7_TXT= |
| 7 | |
| 8 | MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT) |
| 9 | MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT)) |
| 10 | MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT)) |
| 11 | |
| 12 | DOC_HTML=$(MAN_HTML) |
| 13 | |
| 14 | ARTICLES = |
| 15 | # with their own formatting rules. |
| 16 | SP_ARTICLES = |
| 17 | API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt))) |
| 18 | SP_ARTICLES += $(API_DOCS) |
| 19 | SP_ARTICLES += technical/api-index |
| 20 | |
| 21 | DOC_HTML += $(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES)) |
| 22 | |
| 23 | DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT)) |
| 24 | DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT)) |
| 25 | DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT)) |
| 26 | |
| 27 | prefix?=$(HOME) |
| 28 | bindir?=$(prefix)/bin |
| 29 | htmldir?=$(prefix)/share/doc/perf-doc |
| 30 | pdfdir?=$(prefix)/share/doc/perf-doc |
| 31 | mandir?=$(prefix)/share/man |
| 32 | man1dir=$(mandir)/man1 |
| 33 | man5dir=$(mandir)/man5 |
| 34 | man7dir=$(mandir)/man7 |
| 35 | # DESTDIR= |
| 36 | |
| 37 | ASCIIDOC=asciidoc |
Kyle McMartin | b395cd8 | 2009-08-18 12:41:25 -0400 | [diff] [blame] | 38 | ASCIIDOC_EXTRA = --unsafe |
Ingo Molnar | c1c2365 | 2009-05-30 12:38:51 +0200 | [diff] [blame] | 39 | MANPAGE_XSL = manpage-normal.xsl |
| 40 | XMLTO_EXTRA = |
| 41 | INSTALL?=install |
| 42 | RM ?= rm -f |
| 43 | DOC_REF = origin/man |
| 44 | HTML_REF = origin/html |
| 45 | |
| 46 | infodir?=$(prefix)/share/info |
| 47 | MAKEINFO=makeinfo |
| 48 | INSTALL_INFO=install-info |
| 49 | DOCBOOK2X_TEXI=docbook2x-texi |
| 50 | DBLATEX=dblatex |
| 51 | ifndef PERL_PATH |
| 52 | PERL_PATH = /usr/bin/perl |
| 53 | endif |
| 54 | |
| 55 | -include ../config.mak.autogen |
| 56 | -include ../config.mak |
| 57 | |
| 58 | # |
| 59 | # For asciidoc ... |
| 60 | # -7.1.2, no extra settings are needed. |
| 61 | # 8.0-, set ASCIIDOC8. |
| 62 | # |
| 63 | |
| 64 | # |
| 65 | # For docbook-xsl ... |
| 66 | # -1.68.1, set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0) |
| 67 | # 1.69.0, no extra settings are needed? |
| 68 | # 1.69.1-1.71.0, set DOCBOOK_SUPPRESS_SP? |
| 69 | # 1.71.1, no extra settings are needed? |
| 70 | # 1.72.0, set DOCBOOK_XSL_172. |
| 71 | # 1.73.0-, set ASCIIDOC_NO_ROFF |
| 72 | # |
| 73 | |
| 74 | # |
| 75 | # If you had been using DOCBOOK_XSL_172 in an attempt to get rid |
| 76 | # of 'the ".ft C" problem' in your generated manpages, and you |
| 77 | # instead ended up with weird characters around callouts, try |
| 78 | # using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8). |
| 79 | # |
| 80 | |
| 81 | ifdef ASCIIDOC8 |
| 82 | ASCIIDOC_EXTRA += -a asciidoc7compatible |
| 83 | endif |
| 84 | ifdef DOCBOOK_XSL_172 |
| 85 | ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff |
| 86 | MANPAGE_XSL = manpage-1.72.xsl |
| 87 | else |
| 88 | ifdef ASCIIDOC_NO_ROFF |
| 89 | # docbook-xsl after 1.72 needs the regular XSL, but will not |
| 90 | # pass-thru raw roff codes from asciidoc.conf, so turn them off. |
| 91 | ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff |
| 92 | endif |
| 93 | endif |
| 94 | ifdef MAN_BOLD_LITERAL |
| 95 | XMLTO_EXTRA += -m manpage-bold-literal.xsl |
| 96 | endif |
| 97 | ifdef DOCBOOK_SUPPRESS_SP |
| 98 | XMLTO_EXTRA += -m manpage-suppress-sp.xsl |
| 99 | endif |
| 100 | |
| 101 | SHELL_PATH ?= $(SHELL) |
| 102 | # Shell quote; |
| 103 | SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH)) |
| 104 | |
| 105 | # |
| 106 | # Please note that there is a minor bug in asciidoc. |
| 107 | # The version after 6.0.3 _will_ include the patch found here: |
| 108 | # http://marc.theaimsgroup.com/?l=perf&m=111558757202243&w=2 |
| 109 | # |
| 110 | # Until that version is released you may have to apply the patch |
| 111 | # yourself - yes, all 6 characters of it! |
| 112 | # |
| 113 | |
| 114 | QUIET_SUBDIR0 = +$(MAKE) -C # space to separate -C and subdir |
| 115 | QUIET_SUBDIR1 = |
| 116 | |
| 117 | ifneq ($(findstring $(MAKEFLAGS),w),w) |
| 118 | PRINT_DIR = --no-print-directory |
| 119 | else # "make -w" |
| 120 | NO_SUBDIR = : |
| 121 | endif |
| 122 | |
| 123 | ifneq ($(findstring $(MAKEFLAGS),s),s) |
| 124 | ifndef V |
| 125 | QUIET_ASCIIDOC = @echo ' ' ASCIIDOC $@; |
| 126 | QUIET_XMLTO = @echo ' ' XMLTO $@; |
| 127 | QUIET_DB2TEXI = @echo ' ' DB2TEXI $@; |
| 128 | QUIET_MAKEINFO = @echo ' ' MAKEINFO $@; |
| 129 | QUIET_DBLATEX = @echo ' ' DBLATEX $@; |
| 130 | QUIET_XSLTPROC = @echo ' ' XSLTPROC $@; |
| 131 | QUIET_GEN = @echo ' ' GEN $@; |
| 132 | QUIET_STDERR = 2> /dev/null |
| 133 | QUIET_SUBDIR0 = +@subdir= |
| 134 | QUIET_SUBDIR1 = ;$(NO_SUBDIR) echo ' ' SUBDIR $$subdir; \ |
| 135 | $(MAKE) $(PRINT_DIR) -C $$subdir |
| 136 | export V |
| 137 | endif |
| 138 | endif |
| 139 | |
| 140 | all: html man |
| 141 | |
| 142 | html: $(DOC_HTML) |
| 143 | |
| 144 | $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf |
| 145 | |
| 146 | man: man1 man5 man7 |
| 147 | man1: $(DOC_MAN1) |
| 148 | man5: $(DOC_MAN5) |
| 149 | man7: $(DOC_MAN7) |
| 150 | |
| 151 | info: perf.info perfman.info |
| 152 | |
| 153 | pdf: user-manual.pdf |
| 154 | |
| 155 | install: install-man |
| 156 | |
| 157 | install-man: man |
| 158 | $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir) |
| 159 | # $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir) |
| 160 | # $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir) |
| 161 | $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir) |
| 162 | # $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir) |
| 163 | # $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir) |
| 164 | |
| 165 | install-info: info |
| 166 | $(INSTALL) -d -m 755 $(DESTDIR)$(infodir) |
| 167 | $(INSTALL) -m 644 perf.info perfman.info $(DESTDIR)$(infodir) |
| 168 | if test -r $(DESTDIR)$(infodir)/dir; then \ |
| 169 | $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perf.info ;\ |
| 170 | $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perfman.info ;\ |
| 171 | else \ |
| 172 | echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \ |
| 173 | fi |
| 174 | |
| 175 | install-pdf: pdf |
| 176 | $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir) |
| 177 | $(INSTALL) -m 644 user-manual.pdf $(DESTDIR)$(pdfdir) |
| 178 | |
| 179 | install-html: html |
| 180 | '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir) |
| 181 | |
| 182 | ../PERF-VERSION-FILE: .FORCE-PERF-VERSION-FILE |
| 183 | $(QUIET_SUBDIR0)../ $(QUIET_SUBDIR1) PERF-VERSION-FILE |
| 184 | |
| 185 | -include ../PERF-VERSION-FILE |
| 186 | |
| 187 | # |
| 188 | # Determine "include::" file references in asciidoc files. |
| 189 | # |
| 190 | doc.dep : $(wildcard *.txt) build-docdep.perl |
| 191 | $(QUIET_GEN)$(RM) $@+ $@ && \ |
| 192 | $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \ |
| 193 | mv $@+ $@ |
| 194 | |
| 195 | -include doc.dep |
| 196 | |
| 197 | cmds_txt = cmds-ancillaryinterrogators.txt \ |
| 198 | cmds-ancillarymanipulators.txt \ |
| 199 | cmds-mainporcelain.txt \ |
| 200 | cmds-plumbinginterrogators.txt \ |
| 201 | cmds-plumbingmanipulators.txt \ |
| 202 | cmds-synchingrepositories.txt \ |
| 203 | cmds-synchelpers.txt \ |
| 204 | cmds-purehelpers.txt \ |
| 205 | cmds-foreignscminterface.txt |
| 206 | |
| 207 | $(cmds_txt): cmd-list.made |
| 208 | |
| 209 | cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT) |
| 210 | $(QUIET_GEN)$(RM) $@ && \ |
| 211 | $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \ |
| 212 | date >$@ |
| 213 | |
| 214 | clean: |
| 215 | $(RM) *.xml *.xml+ *.html *.html+ *.1 *.5 *.7 |
| 216 | $(RM) *.texi *.texi+ *.texi++ perf.info perfman.info |
| 217 | $(RM) howto-index.txt howto/*.html doc.dep |
| 218 | $(RM) technical/api-*.html technical/api-index.txt |
| 219 | $(RM) $(cmds_txt) *.made |
| 220 | |
| 221 | $(MAN_HTML): %.html : %.txt |
| 222 | $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ |
| 223 | $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \ |
| 224 | $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \ |
| 225 | mv $@+ $@ |
| 226 | |
| 227 | %.1 %.5 %.7 : %.xml |
| 228 | $(QUIET_XMLTO)$(RM) $@ && \ |
| 229 | xmlto -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $< |
| 230 | |
| 231 | %.xml : %.txt |
| 232 | $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ |
| 233 | $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \ |
| 234 | $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \ |
| 235 | mv $@+ $@ |
| 236 | |
| 237 | XSLT = docbook.xsl |
| 238 | XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css |
| 239 | |
| 240 | user-manual.html: user-manual.xml |
| 241 | $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $< |
| 242 | |
| 243 | perf.info: user-manual.texi |
| 244 | $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ user-manual.texi |
| 245 | |
| 246 | user-manual.texi: user-manual.xml |
| 247 | $(QUIET_DB2TEXI)$(RM) $@+ $@ && \ |
| 248 | $(DOCBOOK2X_TEXI) user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \ |
| 249 | $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \ |
| 250 | rm $@++ && \ |
| 251 | mv $@+ $@ |
| 252 | |
| 253 | user-manual.pdf: user-manual.xml |
| 254 | $(QUIET_DBLATEX)$(RM) $@+ $@ && \ |
| 255 | $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \ |
| 256 | mv $@+ $@ |
| 257 | |
| 258 | perfman.texi: $(MAN_XML) cat-texi.perl |
| 259 | $(QUIET_DB2TEXI)$(RM) $@+ $@ && \ |
| 260 | ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \ |
| 261 | --to-stdout $(xml) &&) true) > $@++ && \ |
| 262 | $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \ |
| 263 | rm $@++ && \ |
| 264 | mv $@+ $@ |
| 265 | |
| 266 | perfman.info: perfman.texi |
| 267 | $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi |
| 268 | |
| 269 | $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml |
| 270 | $(QUIET_DB2TEXI)$(RM) $@+ $@ && \ |
| 271 | $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \ |
| 272 | mv $@+ $@ |
| 273 | |
| 274 | howto-index.txt: howto-index.sh $(wildcard howto/*.txt) |
| 275 | $(QUIET_GEN)$(RM) $@+ $@ && \ |
| 276 | '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \ |
| 277 | mv $@+ $@ |
| 278 | |
| 279 | $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt |
| 280 | $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt |
| 281 | |
| 282 | WEBDOC_DEST = /pub/software/tools/perf/docs |
| 283 | |
| 284 | $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt |
| 285 | $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \ |
| 286 | sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \ |
| 287 | mv $@+ $@ |
| 288 | |
| 289 | install-webdoc : html |
| 290 | '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST) |
| 291 | |
| 292 | quick-install: quick-install-man |
| 293 | |
| 294 | quick-install-man: |
| 295 | '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir) |
| 296 | |
| 297 | quick-install-html: |
| 298 | '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir) |
| 299 | |
| 300 | .PHONY: .FORCE-PERF-VERSION-FILE |