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