Back to home page

LXR

 
 

    


0001 include ../../scripts/Makefile.include
0002 include ../../scripts/utilities.mak
0003 
0004 MAN1_TXT= \
0005         $(filter-out $(addsuffix .txt, $(ARTICLES) $(SP_ARTICLES)), \
0006                 $(wildcard perf-*.txt)) \
0007         perf.txt
0008 MAN5_TXT=
0009 MAN7_TXT=
0010 
0011 MAN_TXT = $(MAN1_TXT) $(MAN5_TXT) $(MAN7_TXT)
0012 _MAN_XML=$(patsubst %.txt,%.xml,$(MAN_TXT))
0013 _MAN_HTML=$(patsubst %.txt,%.html,$(MAN_TXT))
0014 
0015 MAN_XML=$(addprefix $(OUTPUT),$(_MAN_XML))
0016 MAN_HTML=$(addprefix $(OUTPUT),$(_MAN_HTML))
0017 
0018 ARTICLES =
0019 # with their own formatting rules.
0020 SP_ARTICLES =
0021 API_DOCS = $(patsubst %.txt,%,$(filter-out technical/api-index-skel.txt technical/api-index.txt, $(wildcard technical/api-*.txt)))
0022 SP_ARTICLES += $(API_DOCS)
0023 SP_ARTICLES += technical/api-index
0024 
0025 _DOC_HTML = $(_MAN_HTML)
0026 _DOC_HTML+=$(patsubst %,%.html,$(ARTICLES) $(SP_ARTICLES))
0027 DOC_HTML=$(addprefix $(OUTPUT),$(_DOC_HTML))
0028 
0029 _DOC_MAN1=$(patsubst %.txt,%.1,$(MAN1_TXT))
0030 _DOC_MAN5=$(patsubst %.txt,%.5,$(MAN5_TXT))
0031 _DOC_MAN7=$(patsubst %.txt,%.7,$(MAN7_TXT))
0032 
0033 DOC_MAN1=$(addprefix $(OUTPUT),$(_DOC_MAN1))
0034 DOC_MAN5=$(addprefix $(OUTPUT),$(_DOC_MAN5))
0035 DOC_MAN7=$(addprefix $(OUTPUT),$(_DOC_MAN7))
0036 
0037 # Make the path relative to DESTDIR, not prefix
0038 ifndef DESTDIR
0039 prefix?=$(HOME)
0040 endif
0041 bindir?=$(prefix)/bin
0042 htmldir?=$(prefix)/share/doc/perf-doc
0043 pdfdir?=$(prefix)/share/doc/perf-doc
0044 mandir?=$(prefix)/share/man
0045 man1dir=$(mandir)/man1
0046 man5dir=$(mandir)/man5
0047 man7dir=$(mandir)/man7
0048 
0049 ASCIIDOC=asciidoc
0050 ASCIIDOC_EXTRA = --unsafe
0051 MANPAGE_XSL = manpage-normal.xsl
0052 XMLTO_EXTRA =
0053 INSTALL?=install
0054 RM ?= rm -f
0055 DOC_REF = origin/man
0056 HTML_REF = origin/html
0057 
0058 infodir?=$(prefix)/share/info
0059 MAKEINFO=makeinfo
0060 INSTALL_INFO=install-info
0061 DOCBOOK2X_TEXI=docbook2x-texi
0062 DBLATEX=dblatex
0063 XMLTO=xmlto
0064 ifndef PERL_PATH
0065         PERL_PATH = /usr/bin/perl
0066 endif
0067 
0068 -include ../config.mak.autogen
0069 -include ../config.mak
0070 
0071 _tmp_tool_path := $(call get-executable,$(ASCIIDOC))
0072 ifeq ($(_tmp_tool_path),)
0073         missing_tools = $(ASCIIDOC)
0074 endif
0075 
0076 _tmp_tool_path := $(call get-executable,$(XMLTO))
0077 ifeq ($(_tmp_tool_path),)
0078         missing_tools += $(XMLTO)
0079 endif
0080 
0081 #
0082 # For asciidoc ...
0083 #       -7.1.2, no extra settings are needed.
0084 #       8.0-,   set ASCIIDOC8.
0085 #
0086 
0087 #
0088 # For docbook-xsl ...
0089 #       -1.68.1,        set ASCIIDOC_NO_ROFF? (based on changelog from 1.73.0)
0090 #       1.69.0,         no extra settings are needed?
0091 #       1.69.1-1.71.0,  set DOCBOOK_SUPPRESS_SP?
0092 #       1.71.1,         no extra settings are needed?
0093 #       1.72.0,         set DOCBOOK_XSL_172.
0094 #       1.73.0-,        set ASCIIDOC_NO_ROFF
0095 #
0096 
0097 #
0098 # If you had been using DOCBOOK_XSL_172 in an attempt to get rid
0099 # of 'the ".ft C" problem' in your generated manpages, and you
0100 # instead ended up with weird characters around callouts, try
0101 # using ASCIIDOC_NO_ROFF instead (it works fine with ASCIIDOC8).
0102 #
0103 
0104 ifdef ASCIIDOC8
0105 ASCIIDOC_EXTRA += -a asciidoc7compatible
0106 endif
0107 ifdef DOCBOOK_XSL_172
0108 ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
0109 MANPAGE_XSL = manpage-1.72.xsl
0110 else
0111         ifdef ASCIIDOC_NO_ROFF
0112         # docbook-xsl after 1.72 needs the regular XSL, but will not
0113         # pass-thru raw roff codes from asciidoc.conf, so turn them off.
0114         ASCIIDOC_EXTRA += -a perf-asciidoc-no-roff
0115         endif
0116 endif
0117 ifdef MAN_BOLD_LITERAL
0118 XMLTO_EXTRA += -m manpage-bold-literal.xsl
0119 endif
0120 ifdef DOCBOOK_SUPPRESS_SP
0121 XMLTO_EXTRA += -m manpage-suppress-sp.xsl
0122 endif
0123 
0124 SHELL_PATH ?= $(SHELL)
0125 # Shell quote;
0126 SHELL_PATH_SQ = $(subst ','\'',$(SHELL_PATH))
0127 
0128 #
0129 # Please note that there is a minor bug in asciidoc.
0130 # The version after 6.0.3 _will_ include the patch found here:
0131 #   http://marc.theaimsgroup.com/?l=perf&m=111558757202243&w=2
0132 #
0133 # Until that version is released you may have to apply the patch
0134 # yourself - yes, all 6 characters of it!
0135 #
0136 
0137 QUIET_SUBDIR0  = +$(MAKE) -C # space to separate -C and subdir
0138 QUIET_SUBDIR1  =
0139 
0140 ifneq ($(findstring $(MAKEFLAGS),w),w)
0141 PRINT_DIR = --no-print-directory
0142 else # "make -w"
0143 NO_SUBDIR = :
0144 endif
0145 
0146 ifneq ($(findstring $(MAKEFLAGS),s),s)
0147 ifneq ($(V),1)
0148         QUIET_ASCIIDOC  = @echo '  ASCIIDOC '$@;
0149         QUIET_XMLTO     = @echo '  XMLTO    '$@;
0150         QUIET_DB2TEXI   = @echo '  DB2TEXI  '$@;
0151         QUIET_MAKEINFO  = @echo '  MAKEINFO '$@;
0152         QUIET_DBLATEX   = @echo '  DBLATEX  '$@;
0153         QUIET_XSLTPROC  = @echo '  XSLTPROC '$@;
0154         QUIET_GEN       = @echo '  GEN      '$@;
0155         QUIET_STDERR    = 2> /dev/null
0156         QUIET_SUBDIR0   = +@subdir=
0157         QUIET_SUBDIR1   = ;$(NO_SUBDIR) \
0158                            echo '  SUBDIR   ' $$subdir; \
0159                           $(MAKE) $(PRINT_DIR) -C $$subdir
0160         export V
0161 endif
0162 endif
0163 
0164 all: html man
0165 
0166 html: $(DOC_HTML)
0167 
0168 $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7): asciidoc.conf
0169 
0170 man: man1 man5 man7
0171 man1: $(DOC_MAN1)
0172 man5: $(DOC_MAN5)
0173 man7: $(DOC_MAN7)
0174 
0175 info: $(OUTPUT)perf.info $(OUTPUT)perfman.info
0176 
0177 pdf: $(OUTPUT)user-manual.pdf
0178 
0179 install: install-man
0180 
0181 check-man-tools:
0182 ifdef missing_tools
0183         $(error "You need to install $(missing_tools) for man pages")
0184 endif
0185 
0186 do-install-man: man
0187         $(call QUIET_INSTALL, Documentation-man) \
0188                 $(INSTALL) -d -m 755 $(DESTDIR)$(man1dir); \
0189 #               $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir); \
0190 #               $(INSTALL) -d -m 755 $(DESTDIR)$(man7dir); \
0191                 $(INSTALL) -m 644 $(DOC_MAN1) $(DESTDIR)$(man1dir); \
0192 #               $(INSTALL) -m 644 $(DOC_MAN5) $(DESTDIR)$(man5dir); \
0193 #               $(INSTALL) -m 644 $(DOC_MAN7) $(DESTDIR)$(man7dir)
0194 
0195 install-man: check-man-tools man
0196 
0197 ifdef missing_tools
0198   DO_INSTALL_MAN = $(warning Please install $(missing_tools) to have the man pages installed)
0199 else
0200   DO_INSTALL_MAN = do-install-man
0201 endif
0202 
0203 try-install-man: $(DO_INSTALL_MAN)
0204 
0205 install-info: info
0206         $(call QUIET_INSTALL, Documentation-info) \
0207                 $(INSTALL) -d -m 755 $(DESTDIR)$(infodir); \
0208                 $(INSTALL) -m 644 $(OUTPUT)perf.info $(OUTPUT)perfman.info $(DESTDIR)$(infodir); \
0209         if test -r $(DESTDIR)$(infodir)/dir; then \
0210                 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perf.info ;\
0211                 $(INSTALL_INFO) --info-dir=$(DESTDIR)$(infodir) perfman.info ;\
0212         else \
0213           echo "No directory found in $(DESTDIR)$(infodir)" >&2 ; \
0214         fi
0215 
0216 install-pdf: pdf
0217         $(call QUIET_INSTALL, Documentation-pdf) \
0218                 $(INSTALL) -d -m 755 $(DESTDIR)$(pdfdir); \
0219                 $(INSTALL) -m 644 $(OUTPUT)user-manual.pdf $(DESTDIR)$(pdfdir)
0220 
0221 #install-html: html
0222 #       '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(DESTDIR)$(htmldir)
0223 
0224 
0225 #
0226 # Determine "include::" file references in asciidoc files.
0227 #
0228 $(OUTPUT)doc.dep : $(wildcard *.txt) build-docdep.perl
0229         $(QUIET_GEN)$(RM) $@+ $@ && \
0230         $(PERL_PATH) ./build-docdep.perl >$@+ $(QUIET_STDERR) && \
0231         mv $@+ $@
0232 
0233 -include $(OUPTUT)doc.dep
0234 
0235 _cmds_txt = cmds-ancillaryinterrogators.txt \
0236         cmds-ancillarymanipulators.txt \
0237         cmds-mainporcelain.txt \
0238         cmds-plumbinginterrogators.txt \
0239         cmds-plumbingmanipulators.txt \
0240         cmds-synchingrepositories.txt \
0241         cmds-synchelpers.txt \
0242         cmds-purehelpers.txt \
0243         cmds-foreignscminterface.txt
0244 cmds_txt=$(addprefix $(OUTPUT),$(_cmds_txt))
0245 
0246 $(cmds_txt): $(OUTPUT)cmd-list.made
0247 
0248 $(OUTPUT)cmd-list.made: cmd-list.perl ../command-list.txt $(MAN1_TXT)
0249         $(QUIET_GEN)$(RM) $@ && \
0250         $(PERL_PATH) ./cmd-list.perl ../command-list.txt $(QUIET_STDERR) && \
0251         date >$@
0252 
0253 CLEAN_FILES =                                                                   \
0254         $(MAN_XML) $(addsuffix +,$(MAN_XML))                                    \
0255         $(MAN_HTML) $(addsuffix +,$(MAN_HTML))                                  \
0256         $(DOC_HTML) $(DOC_MAN1) $(DOC_MAN5) $(DOC_MAN7)                         \
0257         $(OUTPUT)*.texi $(OUTPUT)*.texi+ $(OUTPUT)*.texi++                      \
0258         $(OUTPUT)perf.info $(OUTPUT)perfman.info                                \
0259         $(OUTPUT)howto-index.txt $(OUTPUT)howto/*.html $(OUTPUT)doc.dep         \
0260         $(OUTPUT)technical/api-*.html $(OUTPUT)technical/api-index.txt          \
0261         $(cmds_txt) $(OUTPUT)*.made
0262 clean:
0263         $(call QUIET_CLEAN, Documentation) $(RM) $(CLEAN_FILES)
0264 
0265 $(MAN_HTML): $(OUTPUT)%.html : %.txt
0266         $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
0267         $(ASCIIDOC) -b xhtml11 -d manpage -f asciidoc.conf \
0268                 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
0269         mv $@+ $@
0270 
0271 $(OUTPUT)%.1 $(OUTPUT)%.5 $(OUTPUT)%.7 : $(OUTPUT)%.xml
0272         $(QUIET_XMLTO)$(RM) $@ && \
0273         $(XMLTO) -o $(OUTPUT). -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
0274 
0275 $(OUTPUT)%.xml : %.txt
0276         $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
0277         $(ASCIIDOC) -b docbook -d manpage -f asciidoc.conf \
0278                 $(ASCIIDOC_EXTRA) -aperf_version=$(PERF_VERSION) -o $@+ $< && \
0279         mv $@+ $@
0280 
0281 XSLT = docbook.xsl
0282 XSLTOPTS = --xinclude --stringparam html.stylesheet docbook-xsl.css 
0283 
0284 $(OUTPUT)user-manual.html: $(OUTPUT)user-manual.xml
0285         $(QUIET_XSLTPROC)xsltproc $(XSLTOPTS) -o $@ $(XSLT) $<
0286 
0287 $(OUTPUT)perf.info: $(OUTPUT)user-manual.texi
0288         $(QUIET_MAKEINFO)$(MAKEINFO) --no-split -o $@ $(OUTPUT)user-manual.texi
0289 
0290 $(OUTPUT)user-manual.texi: $(OUTPUT)user-manual.xml
0291         $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
0292         $(DOCBOOK2X_TEXI) $(OUTPUT)user-manual.xml --encoding=UTF-8 --to-stdout >$@++ && \
0293         $(PERL_PATH) fix-texi.perl <$@++ >$@+ && \
0294         rm $@++ && \
0295         mv $@+ $@
0296 
0297 $(OUTPUT)user-manual.pdf: $(OUTPUT)user-manual.xml
0298         $(QUIET_DBLATEX)$(RM) $@+ $@ && \
0299         $(DBLATEX) -o $@+ -p /etc/asciidoc/dblatex/asciidoc-dblatex.xsl -s /etc/asciidoc/dblatex/asciidoc-dblatex.sty $< && \
0300         mv $@+ $@
0301 
0302 $(OUTPUT)perfman.texi: $(MAN_XML) cat-texi.perl
0303         $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
0304         ($(foreach xml,$(MAN_XML),$(DOCBOOK2X_TEXI) --encoding=UTF-8 \
0305                 --to-stdout $(xml) &&) true) > $@++ && \
0306         $(PERL_PATH) cat-texi.perl $@ <$@++ >$@+ && \
0307         rm $@++ && \
0308         mv $@+ $@
0309 
0310 $(OUTPUT)perfman.info: $(OUTPUT)perfman.texi
0311         $(QUIET_MAKEINFO)$(MAKEINFO) --no-split --no-validate $*.texi
0312 
0313 $(patsubst %.txt,%.texi,$(MAN_TXT)): %.texi : %.xml
0314         $(QUIET_DB2TEXI)$(RM) $@+ $@ && \
0315         $(DOCBOOK2X_TEXI) --to-stdout $*.xml >$@+ && \
0316         mv $@+ $@
0317 
0318 howto-index.txt: howto-index.sh $(wildcard howto/*.txt)
0319         $(QUIET_GEN)$(RM) $@+ $@ && \
0320         '$(SHELL_PATH_SQ)' ./howto-index.sh $(wildcard howto/*.txt) >$@+ && \
0321         mv $@+ $@
0322 
0323 $(patsubst %,%.html,$(ARTICLES)) : %.html : %.txt
0324         $(QUIET_ASCIIDOC)$(ASCIIDOC) -b xhtml11 $*.txt
0325 
0326 WEBDOC_DEST = /pub/software/tools/perf/docs
0327 
0328 $(patsubst %.txt,%.html,$(wildcard howto/*.txt)): %.html : %.txt
0329         $(QUIET_ASCIIDOC)$(RM) $@+ $@ && \
0330         sed -e '1,/^$$/d' $< | $(ASCIIDOC) -b xhtml11 - >$@+ && \
0331         mv $@+ $@
0332 
0333 # UNIMPLEMENTED
0334 #install-webdoc : html
0335 #       '$(SHELL_PATH_SQ)' ./install-webdoc.sh $(WEBDOC_DEST)
0336 
0337 # quick-install: quick-install-man
0338 
0339 # quick-install-man:
0340 #       '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(DOC_REF) $(DESTDIR)$(mandir)
0341 
0342 #quick-install-html:
0343 #       '$(SHELL_PATH_SQ)' ./install-doc-quick.sh $(HTML_REF) $(DESTDIR)$(htmldir)