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