OOT build fix: asciidoc.conf is now generated at configure
[lttng-tools.git] / doc / man / Makefile.am
CommitLineData
6f6794a6 1# Man pages are only built if they are enabled at configure time.
ceb84f55
PP
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 = \
ba50d967 10 lttng \
7bf169bd 11 lttng-create \
9d4408b8 12 lttng-destroy \
b3903b3a 13 lttng-set-session \
44f5039e 14 lttng-save \
30ec772c 15 lttng-load \
fb58d659 16 lttng-start \
e85eccc8 17 lttng-stop \
79e094df 18 lttng-version \
b4867b3b 19 lttng-view \
4bf0a332 20 lttng-enable-channel \
2e4886b8 21 lttng-disable-channel \
882108c6 22 lttng-add-context \
89dbeff8 23 lttng-list \
65226554 24 lttng-calibrate \
882443a6 25 lttng-track \
18d6fa61 26 lttng-untrack \
afaad15a 27 lttng-status \
12397c59 28 lttng-help \
e9b06e2b 29 lttng-snapshot \
290294e8 30 lttng-enable-event \
aec4668a 31 lttng-disable-event \
11533074
JG
32 lttng-crash \
33 lttng-metadata
ceb84f55 34MAN3_NAMES =
f5595c32 35MAN8_NAMES = lttng-sessiond lttng-relayd
aec4668a 36MAN1_NO_ASCIIDOC_NAMES =
23225252 37MAN3_NO_ASCIIDOC_NAMES = lttng-health-check
f5595c32 38MAN8_NO_ASCIIDOC_NAMES =
ceb84f55 39
ceb84f55
PP
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 \
83f27f71 50 $(srcdir)/common-cmd-footer.txt \
ba50d967
PP
51 $(srcdir)/common-cmd-options-head.txt \
52 $(srcdir)/common-cmd-help-options.txt
ceb84f55
PP
53
54# config
fd5505f7 55ASCIIDOC_CONF = $(builddir)/asciidoc.conf
ceb84f55
PP
56XSL_FILES = \
57 manpage.xsl \
41af7458 58 manpage-callouts.xsl \
ceb84f55 59 manpage-bold-literal.xsl \
4d7f0487 60 manpage-links.xsl
ceb84f55
PP
61XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
62
63# common dependencies
64COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
65
a3eae3c9
PP
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
ceb84f55 78# tools
c93eadad 79ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage
ceb84f55
PP
80ADOC_DOCBOOK = $(ADOC) -b docbook
81XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
82
83# recipes
84%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
85 $(ADOC_DOCBOOK) -o $@ $<
86
87%.1: %.1.xml $(XSL_SRC_FILES)
88 $(XTO) $<
89
90%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
91 $(ADOC_DOCBOOK) -o $@ $<
92
93%.3: %.3.xml $(XSL_SRC_FILES)
94 $(XTO) $<
95
96%.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
97 $(ADOC_DOCBOOK) -o $@ $<
98
99%.8: %.8.xml $(XSL_SRC_FILES)
100 $(XTO) $<
101
a3eae3c9
PP
102# only clean the generated files if we have the tools to generate them again
103CLEANFILES = $(MAN_XML) $(MAN)
104else # HAVE_ASCIIDOC_XMLTO
105# create man page targets used to stop the build if we want to
106# build the man pages, but we don't have the necessary tools to do so
107ERR_MSG = "Error: Cannot build target because asciidoc or xmlto tool is missing."
108ERR_MSG += "Make sure both tools are installed and run the configure script again."
109
110%.1: $(srcdir)/%.1.txt $(COMMON_DEPS)
111 @echo $(ERR_MSG)
112 @false
113
114%.3: $(srcdir)/%.3.txt $(COMMON_DEPS)
115 @echo $(ERR_MSG)
116 @false
117
118%.8: $(srcdir)/%.8.txt $(COMMON_DEPS)
119 @echo $(ERR_MSG)
ceb84f55 120 @false
a3eae3c9
PP
121endif # HAVE_ASCIIDOC_XMLTO
122endif # MAN_PAGES_OPT
123
124# those are always installed since they are directly written in troff
125dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
126dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
127dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
128
129if MAN_PAGES_OPT
130# building man pages: we can install and distribute them
ceb84f55
PP
131dist_man1_MANS += $(MAN1)
132dist_man3_MANS += $(MAN3)
133dist_man8_MANS += $(MAN8)
a3eae3c9
PP
134endif # MAN_PAGES_OPT
135
2f1c0906
PP
136if !MAN_PAGES_OPT
137dist-hook:
138 @echo "Error: Please enable the man pages before creating a distribution tarball."
139 @false
140endif # !MAN_PAGES_OPT
141
a3eae3c9 142# always distribute the source files
3fa8d43b 143EXTRA_DIST = $(MAN_TXT) $(COMMON_TXT) $(XSL_SRC_FILES) $(ASCIIDOC_CONF).in
This page took 0.033094 seconds and 5 git commands to generate.