doc/man: linklttng macro -> man macro
[lttng-tools.git] / doc / man / Makefile.am
... / ...
CommitLineData
1# Man pages are only built if they are enabled at configure time.
2#
3# They should always be built before creating a distribution tarball.
4
5# function which adds the source directory prefix and adds a given suffix
6manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
7
8# List only the names without the .*.txt extension here:
9MAN1_NAMES = \
10 lttng \
11 lttng-create \
12 lttng-destroy \
13 lttng-set-session \
14 lttng-save \
15 lttng-load \
16 lttng-start \
17 lttng-stop \
18 lttng-version \
19 lttng-view \
20 lttng-enable-channel \
21 lttng-disable-channel \
22 lttng-add-context \
23 lttng-list \
24 lttng-calibrate \
25 lttng-track \
26 lttng-untrack \
27 lttng-status \
28 lttng-help \
29 lttng-snapshot \
30 lttng-enable-event \
31 lttng-disable-event \
32 lttng-crash \
33 lttng-metadata
34MAN3_NAMES =
35MAN8_NAMES = lttng-sessiond lttng-relayd
36MAN1_NO_ASCIIDOC_NAMES =
37MAN3_NO_ASCIIDOC_NAMES = lttng-health-check
38MAN8_NO_ASCIIDOC_NAMES =
39
40# AsciiDoc sources and outputs
41MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
42MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
43MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
44MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
45MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
46
47# common AsciiDoc source files
48COMMON_TXT = \
49 $(srcdir)/common-footer.txt \
50 $(srcdir)/common-cmd-footer.txt \
51 $(srcdir)/common-cmd-options-head.txt \
52 $(srcdir)/common-cmd-help-options.txt
53
54# config
55ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
56XSL_FILES = \
57 manpage.xsl \
58 manpage-callouts.xsl \
59 manpage-bold-literal.xsl \
60 manpage-links.xsl
61XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
62
63# common dependencies
64COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
65
66# man pages destinations
67MAN1 = $(addsuffix .1,$(MAN1_NAMES))
68MAN3 = $(addsuffix .3,$(MAN3_NAMES))
69MAN8 = $(addsuffix .8,$(MAN8_NAMES))
70MAN1_NO_ASCIIDOC = $(addsuffix .1,$(MAN1_NO_ASCIIDOC_NAMES))
71MAN3_NO_ASCIIDOC = $(addsuffix .3,$(MAN3_NO_ASCIIDOC_NAMES))
72MAN8_NO_ASCIIDOC = $(addsuffix .8,$(MAN8_NO_ASCIIDOC_NAMES))
73MAN = $(MAN1) $(MAN3) $(MAN8)
74
75if MAN_PAGES_OPT
76# at this point, we know the user asked to build the man pages
77if HAVE_ASCIIDOC_XMLTO
78# tools
79ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
80 -a lttng_version="$(PACKAGE_VERSION)"
81ADOC_DOCBOOK = $(ADOC) -b docbook
82XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
83
84# recipes
85%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
86 $(ADOC_DOCBOOK) -o $@ $<
87
88%.1: %.1.xml $(XSL_SRC_FILES)
89 $(XTO) $<
90
91%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
92 $(ADOC_DOCBOOK) -o $@ $<
93
94%.3: %.3.xml $(XSL_SRC_FILES)
95 $(XTO) $<
96
97%.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
98 $(ADOC_DOCBOOK) -o $@ $<
99
100%.8: %.8.xml $(XSL_SRC_FILES)
101 $(XTO) $<
102
103# only clean the generated files if we have the tools to generate them again
104CLEANFILES = $(MAN_XML) $(MAN)
105else # HAVE_ASCIIDOC_XMLTO
106# create man page targets used to stop the build if we want to
107# build the man pages, but we don't have the necessary tools to do so
108ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
109ERR_MSG += "Make sure both tools are installed and run the configure script again."
110
111%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
112 @echo $(ERR_MSG)
113 @false
114
115%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
116 @echo $(ERR_MSG)
117 @false
118
119%.8: $(srcdir)/%.8.txt $(COMMON_DEPS)
120 @echo $(ERR_MSG)
121 @false
122endif # HAVE_ASCIIDOC_XMLTO
123endif # MAN_PAGES_OPT
124
125# those are always installed since they are directly written in troff
126dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
127dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
128dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
129
130if MAN_PAGES_OPT
131# building man pages: we can install and distribute them
132dist_man1_MANS += $(MAN1)
133dist_man3_MANS += $(MAN3)
134dist_man8_MANS += $(MAN8)
135endif # MAN_PAGES_OPT
136
137if !MAN_PAGES_OPT
138dist-hook:
139 @echo "Error: Please enable the man pages before creating a distribution tarball."
140 @false
141endif # !MAN_PAGES_OPT
142
143# always distribute the source files
144EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_SRC_FILES) $(ASCIIDOC_CONF)
This page took 0.023555 seconds and 4 git commands to generate.