+# SPDX-License-Identifier: LGPL-2.1-only
+
# Man pages are only built if they are enabled at configure time.
#
# They should always be built before creating a distribution tarball.
lttng-gen-tp
MAN3_NAMES = \
lttng-ust \
- tracef \
- tracelog \
lttng-ust-dl \
- lttng-ust-cyg-profile
+ lttng-ust-cyg-profile \
+ lttng_ust_tracef \
+ lttng_ust_tracelog \
+ tracef \
+ tracelog
+
+# Man page aliases (generated from other sources):
+MAN3_ALIASES = lttng_ust_vtracef.3 lttng_ust_vtracelog.3
# troff man pages:
-MAN3_TROFF = do_tracepoint.3 tracepoint.3 tracepoint_enabled.3
+MAN3_TROFF = \
+ do_tracepoint.3 \
+ lttng_ust_do_tracepoint.3 \
+ lttng_ust_tracepoint.3 \
+ lttng_ust_tracepoint_enabled.3 \
+ tracepoint.3 \
+ tracepoint_enabled.3
# AsciiDoc sources and outputs:
MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
# Man pages destinations:
MAN1 = $(addsuffix .1,$(MAN1_NAMES))
-MAN3 = $(addsuffix .3,$(MAN3_NAMES))
+MAN3 = $(addsuffix .3,$(MAN3_NAMES)) $(MAN3_ALIASES)
MAN = $(MAN1) $(MAN3)
-if MAN_PAGES_OPT
+if ENABLE_MAN_PAGES
# At this point, we know the user asked to build the man pages.
if HAVE_ASCIIDOC_XMLTO
xmlto_verbose_ = $(xmlto_verbose_@AM_DEFAULT_V@)
xmlto_verbose_0 = @echo " XMLTO " $@;
+xmlto_verbose_out = $(xmlto_verbose_out_@AM_V@)
+xmlto_verbose_out_ = $(xmlto_verbose_out_@AM_DEFAULT_V@)
+xmlto_verbose_out_0 = 2>/dev/null
+
# Tools to execute:
ADOC = $(asciidoc_verbose)$(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
- -a lttng_ust_register_timeout="@LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS@" \
-a mansource="LTTng" \
-a manmanual="LTTng Manual" \
-a manversion="$(PACKAGE_VERSION)"
$(ADOC_DOCBOOK) -o $@ $<
%.1: %.1.xml $(XSL_FILE)
- $(XTO) $< 2>/dev/null
+ $(XTO) $< $(xmlto_verbose_out)
%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
$(ADOC_DOCBOOK) -o $@ $<
+# These pair of files are generated by a single invocation of xmlto, use
+# an empty rule that depends on a fake intermediate file to track the
+# dependencies without resorting to Group Targets which were only
+# introduced in GNU Make 4.3.
+lttng_ust_tracef.3 lttng_ust_vtracef.3: lttng_ust_tracef.3.alias
+ @# Empty recipe to mark lttng_ust_tracef.3 and lttng_ust_vtracef.3 as rebuilt
+
+lttng_ust_tracelog.3 lttng_ust_vtracelog.3: lttng_ust_tracelog.3.alias
+ @# Empty recipe to mark lttng_ust_tracelog.3 and lttng_ust_vtracelog.3 as rebuilt
+
+
+.INTERMEDIATE: tracef.3.alias tracelog.3.alias lttng_ust_tracef.3.alias lttng_ust_tracelog.3.alias
+
+tracef.3.alias: tracef.3.xml $(XSL_FILE)
+ $(XTO) $< $(xmlto_verbose_out)
+
+tracelog.3.alias: tracelog.3.xml $(XSL_FILE)
+ $(XTO) $< $(xmlto_verbose_out)
+
+lttng_ust_tracef.3.alias: lttng_ust_tracef.3.xml $(XSL_FILE)
+ $(XTO) $< $(xmlto_verbose_out)
+
+lttng_ust_tracelog.3.alias: lttng_ust_tracelog.3.xml $(XSL_FILE)
+ $(XTO) $< $(xmlto_verbose_out)
+
%.3: %.3.xml $(XSL_FILE)
- $(XTO) $< 2>/dev/null
+ $(XTO) $< $(xmlto_verbose_out)
# Only clean the generated files if we have the tools to generate them again.
CLEANFILES = $(MAN_XML) $(MAN)
@echo $(ERR_MSG)
@false
endif # HAVE_ASCIIDOC_XMLTO
-endif # MAN_PAGES_OPT
+endif # ENABLE_MAN_PAGES
# Start with empty distributed/installed man pages:
dist_man1_MANS =
dist_man3_MANS =
EXTRA_DIST =
-if MAN_PAGES_OPT
+if ENABLE_MAN_PAGES
# Building man pages: we can install and distribute them.
dist_man1_MANS += $(MAN1)
dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
-else # MAN_PAGES_OPT
+else # ENABLE_MAN_PAGES
# Those are not known by automake yet because dist_man3_MANS is empty
# at this point, so make sure they are distributed.
EXTRA_DIST += $(MAN3_TROFF)
-endif # MAN_PAGES_OPT
+endif # ENABLE_MAN_PAGES
-if !MAN_PAGES_OPT
+if !ENABLE_MAN_PAGES
dist-hook:
@echo "Error: Please enable the man pages before creating a distribution tarball."
@false
-endif # !MAN_PAGES_OPT
+endif # !ENABLE_MAN_PAGES
# Always distribute the source files.
EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF) README.md