1 # Man pages are only built if they are enabled at configure time.
3 # They should always be built before creating a distribution tarball.
5 # Function which adds the source directory prefix and adds a given suffix:
6 manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
8 # List only the names without the .*.txt extension here:
19 MAN3_TROFF = do_tracepoint.3 tracepoint.3 tracepoint_enabled.3
21 # AsciiDoc sources and outputs:
22 MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
23 MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
24 MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
25 MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
27 # Common AsciiDoc source files:
29 $(srcdir)/common-footer.txt \
30 $(srcdir)/common-authors.txt \
31 $(srcdir)/common-copyrights.txt \
32 $(srcdir)/log-levels.txt \
33 $(srcdir)/tracef-tracelog-limitations.txt
35 # AsciiDoc configuration and XSL files:
36 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
37 XSL_FILE = $(srcdir)/manpage.xsl
39 # Common dependencies:
40 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
42 # Man pages destinations:
43 MAN1 = $(addsuffix .1,$(MAN1_NAMES))
44 MAN3 = $(addsuffix .3,$(MAN3_NAMES))
48 # At this point, we know the user asked to build the man pages.
49 if HAVE_ASCIIDOC_XMLTO
51 ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
52 -a lttng_version="$(PACKAGE_VERSION)" \
53 -a lttng_ust_register_timeout="@LTTNG_UST_DEFAULT_CONSTRUCTOR_TIMEOUT_MS@"
55 ADOC_DOCBOOK = $(ADOC) -b docbook
56 XTO = $(XMLTO) -m $(XSL_FILE) man
59 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
60 $(ADOC_DOCBOOK) -o $@ $<
62 %.1: %.1.xml $(XSL_FILE)
65 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
66 $(ADOC_DOCBOOK) -o $@ $<
68 %.3: %.3.xml $(XSL_FILE)
71 # Only clean the generated files if we have the tools to generate them again.
72 CLEANFILES = $(MAN_XML) $(MAN)
73 else # HAVE_ASCIIDOC_XMLTO
74 # Create man page targets used to stop the build if we want to
75 # build the man pages, but we don't have the necessary tools to do so.
76 ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
77 ERR_MSG += "Make sure both tools are installed and run the configure script again."
79 %.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
83 %.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
86 endif # HAVE_ASCIIDOC_XMLTO
89 # Start with empty distributed/installed man pages:
95 # Building man pages: we can install and distribute them.
96 dist_man1_MANS += $(MAN1)
97 dist_man3_MANS += $(MAN3) $(MAN3_TROFF)
99 # Those are not known by automake yet because dist_man3_MANS is empty
100 # at this point, so make sure they are distributed.
101 EXTRA_DIST += $(MAN3_TROFF)
102 endif # MAN_PAGES_OPT
106 @echo "Error: Please enable the man pages before creating a distribution tarball."
108 endif # !MAN_PAGES_OPT
110 # Always distribute the source files.
111 EXTRA_DIST += $(MAN_TXT) $(COMMON_TXT) $(XSL_FILE) $(ASCIIDOC_CONF)