1 # Man pages are only built if the --enable-build-man-pages option was passed
2 # to the configure script.
4 # They should always be built before creating a distribution tarball.
6 # function which adds the source directory prefix and adds a given suffix
7 manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
9 # List only the names without the .*.txt extension here:
21 lttng-enable-channel \
22 lttng-disable-channel \
35 MAN8_NAMES = lttng-sessiond lttng-relayd
36 MAN1_NO_ASCIIDOC_NAMES =
37 MAN3_NO_ASCIIDOC_NAMES = lttng-health-check
38 MAN8_NO_ASCIIDOC_NAMES =
40 # man pages destinations
41 MAN1 = $(call manaddsuffix,.1,$(MAN1_NAMES))
42 MAN3 = $(call manaddsuffix,.3,$(MAN3_NAMES))
43 MAN8 = $(call manaddsuffix,.8,$(MAN8_NAMES))
44 MAN1_NO_ASCIIDOC = $(call manaddsuffix,.1,$(MAN1_NO_ASCIIDOC_NAMES))
45 MAN3_NO_ASCIIDOC = $(call manaddsuffix,.3,$(MAN3_NO_ASCIIDOC_NAMES))
46 MAN8_NO_ASCIIDOC = $(call manaddsuffix,.8,$(MAN8_NO_ASCIIDOC_NAMES))
47 MAN = $(MAN1) $(MAN3) $(MAN8)
49 # those are always installed since they are written in troff
50 dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
51 dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
52 dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
54 # only build man pages if it was enabled
57 dist_man1_MANS += $(MAN1)
58 dist_man3_MANS += $(MAN3)
59 dist_man8_MANS += $(MAN8)
61 # AsciiDoc sources and outputs
62 MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
63 MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
64 MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
65 MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
66 MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
68 # common AsciiDoc source files
70 $(srcdir)/common-footer.txt \
71 $(srcdir)/common-cmd-footer.txt \
72 $(srcdir)/common-cmd-options-head.txt \
73 $(srcdir)/common-cmd-help-options.txt
76 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
80 manpage-bold-literal.xsl \
82 XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
85 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
88 ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
89 -a lttng_version=$(PACKAGE_VERSION)
90 ADOC_DOCBOOK = $(ADOC) -b docbook
91 XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
94 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
95 $(ADOC_DOCBOOK) -o $@ $<
97 %.1: %.1.xml $(XSL_SRC_FILES)
100 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
101 $(ADOC_DOCBOOK) -o $@ $<
103 %.3: %.3.xml $(XSL_SRC_FILES)
106 %.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
107 $(ADOC_DOCBOOK) -o $@ $<
109 %.8: %.8.xml $(XSL_SRC_FILES)
117 # we are in the Git repo: the man pages should be built for distribution
120 @echo 'Error: Please build the man pages before creating a tarball.'
124 # we are in the tarball, hence the man pages are already built
125 dist_man1_MANS += $(MAN1)
126 dist_man3_MANS += $(MAN3)
127 dist_man8_MANS += $(MAN8)
129 endif # BUILD_MAN_PAGES