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 \
34 MAN1_NO_ASCIIDOC_NAMES = lttng-crash
35 MAN3_NO_ASCIIDOC_NAMES =
36 MAN8_NO_ASCIIDOC_NAMES = lttng-relayd lttng-sessiond
38 # man pages destinations
39 MAN1 = $(call manaddsuffix,.1,$(MAN1_NAMES))
40 MAN3 = $(call manaddsuffix,.3,$(MAN3_NAMES))
41 MAN8 = $(call manaddsuffix,.8,$(MAN8_NAMES))
42 MAN1_NO_ASCIIDOC = $(call manaddsuffix,.1,$(MAN1_NO_ASCIIDOC_NAMES))
43 MAN3_NO_ASCIIDOC = $(call manaddsuffix,.3,$(MAN3_NO_ASCIIDOC_NAMES))
44 MAN8_NO_ASCIIDOC = $(call manaddsuffix,.8,$(MAN8_NO_ASCIIDOC_NAMES))
45 MAN = $(MAN1) $(MAN3) $(MAN8)
47 # those are always installed since they are written in troff
48 dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
49 dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
50 dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
52 # only build man pages if it was enabled
55 dist_man1_MANS += $(MAN1)
56 dist_man3_MANS += $(MAN3)
57 dist_man8_MANS += $(MAN8)
59 # AsciiDoc sources and outputs
60 MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
61 MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
62 MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
63 MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
64 MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
66 # common AsciiDoc source files
68 $(srcdir)/common-footer.txt \
69 $(srcdir)/common-cmd-footer.txt \
70 $(srcdir)/common-cmd-options-head.txt \
71 $(srcdir)/common-cmd-help-options.txt
74 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
78 manpage-bold-literal.xsl \
80 XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
83 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
86 ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
87 -a lttng_version=$(PACKAGE_VERSION)
88 ADOC_DOCBOOK = $(ADOC) -b docbook
89 XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
92 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
93 $(ADOC_DOCBOOK) -o $@ $<
95 %.1: %.1.xml $(XSL_SRC_FILES)
98 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
99 $(ADOC_DOCBOOK) -o $@ $<
101 %.3: %.3.xml $(XSL_SRC_FILES)
104 %.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
105 $(ADOC_DOCBOOK) -o $@ $<
107 %.8: %.8.xml $(XSL_SRC_FILES)
115 # we are in the Git repo: the man pages should be built for distribution
118 @echo 'Error: Please build the man pages before creating a tarball.'
122 # we are in the tarball, hence the man pages are already built
123 dist_man1_MANS += $(MAN1)
124 dist_man3_MANS += $(MAN3)
125 dist_man8_MANS += $(MAN8)
127 endif # BUILD_MAN_PAGES