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:
20 lttng-enable-channel \
21 lttng-disable-channel \
36 MAN8_NAMES = lttng-sessiond lttng-relayd
37 MAN1_NO_ASCIIDOC_NAMES =
38 MAN3_NO_ASCIIDOC_NAMES = lttng-health-check
39 MAN8_NO_ASCIIDOC_NAMES =
41 # AsciiDoc sources and outputs
42 MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
43 MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
44 MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
45 MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
46 MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
48 # common AsciiDoc source files
50 $(srcdir)/common-footer.txt \
51 $(srcdir)/common-cmd-footer.txt \
52 $(srcdir)/common-cmd-options-head.txt \
53 $(srcdir)/common-cmd-help-options.txt
56 ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
57 ASCIIDOC_ATTRS_CONF = $(builddir)/asciidoc-attrs.conf
60 manpage-callouts.xsl \
61 manpage-bold-literal.xsl \
63 XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
66 COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT) $(ASCIIDOC_ATTRS_CONF)
68 # man pages destinations
69 MAN1 = $(addsuffix .1,$(MAN1_NAMES))
70 MAN3 = $(addsuffix .3,$(MAN3_NAMES))
71 MAN8 = $(addsuffix .8,$(MAN8_NAMES))
72 MAN1_NO_ASCIIDOC = $(addsuffix .1,$(MAN1_NO_ASCIIDOC_NAMES))
73 MAN3_NO_ASCIIDOC = $(addsuffix .3,$(MAN3_NO_ASCIIDOC_NAMES))
74 MAN8_NO_ASCIIDOC = $(addsuffix .8,$(MAN8_NO_ASCIIDOC_NAMES))
75 MAN = $(MAN1) $(MAN3) $(MAN8)
78 # at this point, we know the user asked to build the man pages
79 if HAVE_ASCIIDOC_XMLTO
81 ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -f $(ASCIIDOC_ATTRS_CONF) -d manpage
82 ADOC_DOCBOOK = $(ADOC) -b docbook
83 XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
86 %.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
87 $(ADOC_DOCBOOK) -o $@ $<
89 %.1: %.1.xml $(XSL_SRC_FILES)
92 %.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
93 $(ADOC_DOCBOOK) -o $@ $<
95 %.3: %.3.xml $(XSL_SRC_FILES)
98 %.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
99 $(ADOC_DOCBOOK) -o $@ $<
101 %.8: %.8.xml $(XSL_SRC_FILES)
104 # only clean the generated files if we have the tools to generate them again
105 CLEANFILES = $(MAN_XML) $(MAN)
106 else # HAVE_ASCIIDOC_XMLTO
107 # create man page targets used to stop the build if we want to
108 # build the man pages, but we don't have the necessary tools to do so
109 ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
110 ERR_MSG += "Make sure both tools are installed and run the configure script again."
112 %.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
116 %.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
120 %.8: $(srcdir)/%.8.txt $(COMMON_DEPS)
123 endif # HAVE_ASCIIDOC_XMLTO
124 endif # MAN_PAGES_OPT
126 # those are always installed since they are directly written in troff
127 dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
128 dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
129 dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
132 # building man pages: we can install and distribute them
133 dist_man1_MANS += $(MAN1)
134 dist_man3_MANS += $(MAN3)
135 dist_man8_MANS += $(MAN8)
136 endif # MAN_PAGES_OPT
140 @echo "Error: Please enable the man pages before creating a distribution tarball."
142 endif # !MAN_PAGES_OPT
144 # always distribute the source files
145 EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_SRC_FILES) \
146 $(ASCIIDOC_CONF) $(ASCIIDOC_ATTRS_CONF).in