doc/man: create lttng-load(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
PP
15 lttng-save \
16 lttng-load
ceb84f55
PP
17MAN3_NAMES =
18MAN8_NAMES =
19MAN1_NO_ASCIIDOC_NAMES = lttng-crash
20MAN3_NO_ASCIIDOC_NAMES =
21MAN8_NO_ASCIIDOC_NAMES = lttng-relayd lttng-sessiond
22
23# man pages destinations
24MAN1 = $(call manaddsuffix,.1,$(MAN1_NAMES))
25MAN3 = $(call manaddsuffix,.3,$(MAN3_NAMES))
26MAN8 = $(call manaddsuffix,.8,$(MAN8_NAMES))
27MAN1_NO_ASCIIDOC = $(call manaddsuffix,.1,$(MAN1_NO_ASCIIDOC_NAMES))
28MAN3_NO_ASCIIDOC = $(call manaddsuffix,.3,$(MAN3_NO_ASCIIDOC_NAMES))
29MAN8_NO_ASCIIDOC = $(call manaddsuffix,.8,$(MAN8_NO_ASCIIDOC_NAMES))
30MAN = $(MAN1) $(MAN3) $(MAN8)
31
32# those are always installed since they are written in troff
33dist_man1_MANS = $(MAN1_NO_ASCIIDOC)
34dist_man3_MANS = $(MAN3_NO_ASCIIDOC)
35dist_man8_MANS = $(MAN8_NO_ASCIIDOC)
36
37# only build man pages if it was enabled
38if BUILD_MAN_PAGES
39# dist + install
40dist_man1_MANS += $(MAN1)
41dist_man3_MANS += $(MAN3)
42dist_man8_MANS += $(MAN8)
43
44# AsciiDoc sources and outputs
45MAN1_TXT = $(call manaddsuffix,.1.txt,$(MAN1_NAMES))
46MAN3_TXT = $(call manaddsuffix,.3.txt,$(MAN3_NAMES))
47MAN8_TXT = $(call manaddsuffix,.8.txt,$(MAN8_NAMES))
48MAN_TXT = $(MAN1_TXT) $(MAN3_TXT) $(MAN8_TXT)
49MAN_XML = $(patsubst $(srcdir)/%.txt,%.xml,$(MAN_TXT))
50
51# common AsciiDoc source files
52COMMON_TXT = \
53 $(srcdir)/common-footer.txt \
83f27f71 54 $(srcdir)/common-cmd-footer.txt \
ba50d967
PP
55 $(srcdir)/common-cmd-options-head.txt \
56 $(srcdir)/common-cmd-help-options.txt
ceb84f55
PP
57
58# config
59ASCIIDOC_CONF = $(srcdir)/asciidoc.conf
60XSL_FILES = \
61 manpage.xsl \
62 manpage-base.xsl \
63 manpage-bold-literal.xsl \
64 manpage-ulinks.xsl
65XSL_SRC_FILES = $(addprefix $(srcdir)/xsl/,$(XSL_FILES))
66
67# common dependencies
68COMMON_DEPS = $(ASCIIDOC_CONF) $(COMMON_TXT)
69
70# tools
71ADOC = $(ASCIIDOC) -f $(ASCIIDOC_CONF) -d manpage \
72 -a lttng_version=$(PACKAGE_VERSION)
73ADOC_DOCBOOK = $(ADOC) -b docbook
74XTO = $(XMLTO) -m $(firstword $(XSL_SRC_FILES)) man
75
76# recipes
77%.1.xml: $(srcdir)/%.1.txt $(COMMON_DEPS)
78 $(ADOC_DOCBOOK) -o $@ $<
79
80%.1: %.1.xml $(XSL_SRC_FILES)
81 $(XTO) $<
82
83%.3.xml: $(srcdir)/%.3.txt $(COMMON_DEPS)
84 $(ADOC_DOCBOOK) -o $@ $<
85
86%.3: %.3.xml $(XSL_SRC_FILES)
87 $(XTO) $<
88
89%.8.xml: $(srcdir)/%.8.txt $(COMMON_DEPS)
90 $(ADOC_DOCBOOK) -o $@ $<
91
92%.8: %.8.xml $(XSL_SRC_FILES)
93 $(XTO) $<
94
95clean-local:
96 rm -rf $(MAN_XML)
97 rm -rf $(MAN)
98else
99if IN_GIT_REPO
100# we are in the Git repo: the man pages should be built for distribution
101dist-hook:
102 @echo
103 @echo 'Error: Please build the man pages before creating a tarball.'
104 @echo
105 @false
106else
107# we are in the tarball, hence the man pages are already built
108dist_man1_MANS += $(MAN1)
109dist_man3_MANS += $(MAN3)
110dist_man8_MANS += $(MAN8)
111endif # IN_GIT_REPO
112endif # BUILD_MAN_PAGES
This page took 0.038757 seconds and 4 git commands to generate.