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