doc/man: create lttng-help(1) and update/fix content
[lttng-tools.git] / doc / man / Makefile.am
CommitLineData
ceb84f55
PP
1# Man pages are only built if the --enable-build-man-pages option was passed
2# to the configure script.
3#
4# They should always be built before creating a distribution tarball.
5
6# function which adds the source directory prefix and adds a given suffix
7manaddsuffix = $(addsuffix $(1),$(addprefix $(srcdir)/,$(2)))
8
9# List only the names without the .*.txt extension here:
10MAN1_NAMES = \
ba50d967 11 lttng \
7bf169bd 12 lttng-create \
9d4408b8 13 lttng-destroy \
b3903b3a 14 lttng-set-session \
44f5039e 15 lttng-save \
30ec772c 16 lttng-load \
fb58d659 17 lttng-start \
e85eccc8 18 lttng-stop \
79e094df 19 lttng-version \
b4867b3b 20 lttng-view \
4bf0a332 21 lttng-enable-channel \
2e4886b8 22 lttng-disable-channel \
882108c6 23 lttng-add-context \
89dbeff8 24 lttng-list \
65226554 25 lttng-calibrate \
882443a6 26 lttng-track \
18d6fa61 27 lttng-untrack \
afaad15a
PP
28 lttng-status \
29 lttng-help
ceb84f55
PP
30MAN3_NAMES =
31MAN8_NAMES =
32MAN1_NO_ASCIIDOC_NAMES = lttng-crash
33MAN3_NO_ASCIIDOC_NAMES =
34MAN8_NO_ASCIIDOC_NAMES = lttng-relayd lttng-sessiond
35
36# man pages destinations
37MAN1 = $(call manaddsuffix,.1,$(MAN1_NAMES))
38MAN3 = $(call manaddsuffix,.3,$(MAN3_NAMES))
39MAN8 = $(call manaddsuffix,.8,$(MAN8_NAMES))
40MAN1_NO_ASCIIDOC = $(call manaddsuffix,.1,$(MAN1_NO_ASCIIDOC_NAMES))
41MAN3_NO_ASCIIDOC = $(call manaddsuffix,.3,$(MAN3_NO_ASCIIDOC_NAMES))
42MAN8_NO_ASCIIDOC = $(call manaddsuffix,.8,$(MAN8_NO_ASCIIDOC_NAMES))
43MAN = $(MAN1) $(MAN3) $(MAN8)
44
45# those are always installed since they are written in troff
46dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
47dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
48dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
49
50# only build man pages if it was enabled
51if BUILD_MAN_PAGES
52# dist + install
53dist_man1_MANS += $(MAN1)
54dist_man3_MANS += $(MAN3)
55dist_man8_MANS += $(MAN8)
56
57# AsciiDoc sources and outputs
58MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
59MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
60MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
61MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
62MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
63
64# common AsciiDoc source files
65COMMON_TXT = \
66 $(srcdir)/common-footer.txt \
83f27f71 67 $(srcdir)/common-cmd-footer.txt \
ba50d967
PP
68 $(srcdir)/common-cmd-options-head.txt \
69 $(srcdir)/common-cmd-help-options.txt
ceb84f55
PP
70
71# config
72ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
73XSL_FILES = \
74 manpage.xsl \
75 manpage-base.xsl \
76 manpage-bold-literal.xsl \
77 manpage-ulinks.xsl
78XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
79
80# common dependencies
81COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
82
83# tools
84ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
85 -a lttng_version=$(PACKAGE_VERSION)
86ADOC_DOCBOOK = $(ADOC) -b docbook
87XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
88
89# recipes
90%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
91 $(ADOC_DOCBOOK) -o $@ $<
92
93%.1: %.1.xml $(XSL_SRC_FILES)
94 $(XTO) $<
95
96%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
97 $(ADOC_DOCBOOK) -o $@ $<
98
99%.3: %.3.xml $(XSL_SRC_FILES)
100 $(XTO) $<
101
102%.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
103 $(ADOC_DOCBOOK) -o $@ $<
104
105%.8: %.8.xml $(XSL_SRC_FILES)
106 $(XTO) $<
107
108clean-local:
109 rm -rf $(MAN_XML)
110 rm -rf $(MAN)
111else
112if IN_GIT_REPO
113# we are in the Git repo: the man pages should be built for distribution
114dist-hook:
115 @echo
116 @echo 'Error: Please build the man pages before creating a tarball.'
117 @echo
118 @false
119else
120# we are in the tarball, hence the man pages are already built
121dist_man1_MANS += $(MAN1)
122dist_man3_MANS += $(MAN3)
123dist_man8_MANS += $(MAN8)
124endif # IN_GIT_REPO
125endif # BUILD_MAN_PAGES
This page took 0.040086 seconds and 4 git commands to generate.