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