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