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