X-Git-Url: http://git.efficios.com/?p=lttng-tools.git;a=blobdiff_plain;f=doc%2Fman%2FMakefile.am;h=5ae6ffbe30da3d4755deed80d5ccfb9e591414f1;hp=0a10e86532fc91eaa4cacd6caaef28d012b9f1f2;hb=2463b7879c00298daa79744cdaae82ac061a4ed8;hpb=882443a6d87be3c1d3d862794c87882d7bcde1bc diff --git a/doc/man/Makefile.am b/doc/man/Makefile.am index 0a10e8653..5ae6ffbe3 100644 --- a/doc/man/Makefile.am +++ b/doc/man/Makefile.am @@ -1,5 +1,6 @@ -# Man pages are only built if the --enable-build-man-pages option was passed -# to the configure script. +# SPDX-License-Identifier: GPL-2.0-only + +# Man pages are only built if they are enabled at configure time. # # They should always be built before creating a distribution tarball. @@ -22,35 +23,29 @@ MAN1_NAMES = \ lttng-disable-channel \ lttng-add-context \ lttng-list \ - lttng-calibrate \ lttng-track \ - lttng-untrack -MAN3_NAMES = -MAN8_NAMES = -MAN1_NO_ASCIIDOC_NAMES = lttng-crash -MAN3_NO_ASCIIDOC_NAMES = -MAN8_NO_ASCIIDOC_NAMES = lttng-relayd lttng-sessiond - -# man pages destinations -MAN1 = $(call manaddsuffix,.1,$(MAN1_NAMES)) -MAN3 = $(call manaddsuffix,.3,$(MAN3_NAMES)) -MAN8 = $(call manaddsuffix,.8,$(MAN8_NAMES)) -MAN1_NO_ASCIIDOC = $(call manaddsuffix,.1,$(MAN1_NO_ASCIIDOC_NAMES)) -MAN3_NO_ASCIIDOC = $(call manaddsuffix,.3,$(MAN3_NO_ASCIIDOC_NAMES)) -MAN8_NO_ASCIIDOC = $(call manaddsuffix,.8,$(MAN8_NO_ASCIIDOC_NAMES)) -MAN = $(MAN1) $(MAN3) $(MAN8) + lttng-untrack \ + lttng-status \ + lttng-help \ + lttng-snapshot \ + lttng-enable-event \ + lttng-disable-event \ + lttng-crash \ + lttng-metadata \ + lttng-regenerate \ + lttng-rotate \ + lttng-enable-rotation \ + lttng-disable-rotation \ + lttng-clear \ + lttng-add-trigger \ + lttng-remove-trigger \ + lttng-list-triggers -# those are always installed since they are written in troff -dist_man1_MANS = $(MAN1_NO_ASCIIDOC) -dist_man3_MANS = $(MAN3_NO_ASCIIDOC) -dist_man8_MANS = $(MAN8_NO_ASCIIDOC) - -# only build man pages if it was enabled -if BUILD_MAN_PAGES -# dist + install -dist_man1_MANS += $(MAN1) -dist_man3_MANS += $(MAN3) -dist_man8_MANS += $(MAN8) +MAN3_NAMES = +MAN8_NAMES = lttng-sessiond lttng-relayd +MAN1_NO_ASCIIDOC_NAMES = +MAN3_NO_ASCIIDOC_NAMES = lttng-health-check +MAN8_NO_ASCIIDOC_NAMES = # AsciiDoc sources and outputs MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES)) @@ -68,56 +63,138 @@ COMMON_TXT = \ # config ASCIIDOC_CONF = $(srcdir)/asciidoc.conf -XSL_FILES = \ - manpage.xsl \ - manpage-base.xsl \ - manpage-bold-literal.xsl \ - manpage-ulinks.xsl -XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES)) +ASCIIDOC_ATTRS_CONF = $(builddir)/asciidoc-attrs.conf +XSL_FILE = $(srcdir)/manpage.xsl # common dependencies COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT) +# man pages destinations +MAN1 = $(addsuffix .1,$(MAN1_NAMES)) +MAN3 = $(addsuffix .3,$(MAN3_NAMES)) +MAN8 = $(addsuffix .8,$(MAN8_NAMES)) +MAN1_NO_ASCIIDOC = $(addsuffix .1,$(MAN1_NO_ASCIIDOC_NAMES)) +MAN3_NO_ASCIIDOC = $(addsuffix .3,$(MAN3_NO_ASCIIDOC_NAMES)) +MAN8_NO_ASCIIDOC = $(addsuffix .8,$(MAN8_NO_ASCIIDOC_NAMES)) +MAN = $(MAN1) $(MAN3) $(MAN8) + +# initially empty +CLEANFILES = + +if EMBED_HELP +mantoh_verbose = $(mantoh_verbose_@AM_V@) +mantoh_verbose_ = $(mantoh_verbose_@AM_DEFAULT_V@) +mantoh_verbose_0 = @echo " MANTOH " $@; + +MAN1_H = $(addsuffix .1.h,$(MAN1_NAMES)) +MAN3_H = $(addsuffix .3.h,$(MAN3_NAMES)) +MAN8_H = $(addsuffix .8.h,$(MAN8_NAMES)) +MAN_H = $(MAN1_H) $(MAN3_H) $(MAN8_H) +MAN_H_RECIPE = \ + $(mantoh_verbose_0)\ + MANWIDTH=80 @MANPROG@ --encoding=UTF-8 --no-hyphenation --no-justification --local-file $< > $@ ; \ + $(SED) -i 's/\\/\\\\/g' $@ ; \ + $(SED) -i 's/"/\\"/g' $@ ; \ + $(SED) -i 's/^\(.*\)$$/"\1\\n"/' $@ + +%.1.h: %.1 + $(MAN_H_RECIPE) + +%.3.h: %.3 + $(MAN_H_RECIPE) + +%.8.h: %.8 + $(MAN_H_RECIPE) + +all-local: $(MAN_H) + +CLEANFILES += $(MAN_H) +endif # EMBED_HELP + +if MAN_PAGES_OPT +# at this point, we know the user asked to build the man pages +if HAVE_ASCIIDOC_XMLTO + +asciidoc_verbose = $(asciidoc_verbose_@AM_V@) +asciidoc_verbose_ = $(asciidoc_verbose_@AM_DEFAULT_V@) +asciidoc_verbose_0 = @echo " ASCIIDOC " $@; + +xmlto_verbose = $(xmlto_verbose_@AM_V@) +xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@) +xmlto_verbose_0 = @echo " XMLTO " $@; + # tools -ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \ - -a lttng_version=$(PACKAGE_VERSION) +ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -f $(ASCIIDOC_ATTRS_CONF) -d manpage ADOC_DOCBOOK = $(ADOC) -b docbook -XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man +XTO = $(xmlto_verbose)$(XMLTO) -m $(XSL_FILE) man + +# only add this dependency if we can build the man pages because it's +# a file generated by the configure script, so it's more recent than +# the pregenerated man pages in a tarball +COMMON_DEPS += $(ASCIIDOC_ATTRS_CONF) # recipes %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS) $(ADOC_DOCBOOK) -o $@ $< -%.1: %.1.xml $(XSL_SRC_FILES) - $(XTO) $< +%.1: %.1.xml $(XSL_FILE) + $(XTO) $< 2>/dev/null %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS) $(ADOC_DOCBOOK) -o $@ $< -%.3: %.3.xml $(XSL_SRC_FILES) - $(XTO) $< +%.3: %.3.xml $(XSL_FILE) + $(XTO) $< 2>/dev/null %.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS) $(ADOC_DOCBOOK) -o $@ $< -%.8: %.8.xml $(XSL_SRC_FILES) - $(XTO) $< +%.8: %.8.xml $(XSL_FILE) + $(XTO) $< 2>/dev/null -clean-local: - rm -rf $(MAN_XML) - rm -rf $(MAN) -else -if IN_GIT_REPO -# we are in the Git repo: the man pages should be built for distribution -dist-hook: - @echo - @echo 'Error: Please build the man pages before creating a tarball.' - @echo +# only clean the generated files if we have the tools to generate them again +CLEANFILES += $(MAN_XML) $(MAN) +else # HAVE_ASCIIDOC_XMLTO +# create man page targets used to stop the build if we want to +# build the man pages, but we don't have the necessary tools to do so +ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing." +ERR_MSG += "Make sure both tools are installed and run the configure script again." + +%.1: $(srcdir)/%.1.txt $(COMMON_DEPS) + @echo $(ERR_MSG) + @false + +%.3: $(srcdir)/%.3.txt $(COMMON_DEPS) + @echo $(ERR_MSG) + @false + +%.8: $(srcdir)/%.8.txt $(COMMON_DEPS) + @echo $(ERR_MSG) @false -else -# we are in the tarball, hence the man pages are already built +endif # HAVE_ASCIIDOC_XMLTO +endif # MAN_PAGES_OPT + +# those are always installed since they are directly written in troff +dist_man1_MANS = $(MAN1_NO_ASCIIDOC) +dist_man3_MANS = $(MAN3_NO_ASCIIDOC) +dist_man8_MANS = $(MAN8_NO_ASCIIDOC) + +if MAN_PAGES_OPT +# building man pages: we can install and distribute them dist_man1_MANS += $(MAN1) dist_man3_MANS += $(MAN3) dist_man8_MANS += $(MAN8) -endif # IN_GIT_REPO -endif # BUILD_MAN_PAGES +endif # MAN_PAGES_OPT + +if !MAN_PAGES_OPT +dist-hook: + @echo "Error: Please enable the man pages before creating a distribution tarball." + @false +endif # !MAN_PAGES_OPT + +# always distribute the source files +EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) \ + $(ASCIIDOC_CONF) $(ASCIIDOC_ATTRS_CONF).in + +# keep generated man pages that can be considered intermediate files +.PRECIOUS: %.1 %.3 %.8