Btrfs progs v4.17.1
[btrfs-progs-unstable/devel.git] / Documentation / Makefile.in
blob184647c41940d3f097369dbfe9f41964b8bf0b2b
1 # Guard against environment variables
2 MAN8_TXT =
4 # Top level commands
5 MAN8_TXT += btrfs.asciidoc
6 MAN8_TXT += btrfs-convert.asciidoc
7 MAN8_TXT += btrfs-find-root.asciidoc
8 MAN8_TXT += btrfs-image.asciidoc
9 MAN8_TXT += btrfs-map-logical.asciidoc
10 MAN8_TXT += btrfs-select-super.asciidoc
11 MAN8_TXT += btrfstune.asciidoc
12 MAN8_TXT += fsck.btrfs.asciidoc
13 MAN8_TXT += mkfs.btrfs.asciidoc
15 # Sub commands for btrfs
16 MAN8_TXT += btrfs-subvolume.asciidoc
17 MAN8_TXT += btrfs-filesystem.asciidoc
18 MAN8_TXT += btrfs-balance.asciidoc
19 MAN8_TXT += btrfs-device.asciidoc
20 MAN8_TXT += btrfs-scrub.asciidoc
21 MAN8_TXT += btrfs-check.asciidoc
22 MAN8_TXT += btrfs-rescue.asciidoc
23 MAN8_TXT += btrfs-inspect-internal.asciidoc
24 MAN8_TXT += btrfs-send.asciidoc
25 MAN8_TXT += btrfs-receive.asciidoc
26 MAN8_TXT += btrfs-quota.asciidoc
27 MAN8_TXT += btrfs-qgroup.asciidoc
28 MAN8_TXT += btrfs-replace.asciidoc
29 MAN8_TXT += btrfs-restore.asciidoc
30 MAN8_TXT += btrfs-property.asciidoc
32 # Category 5 manual page
33 MAN5_TXT += btrfs-man5.asciidoc
35 MAN3_TXT += btrfs-ioctl.asciidoc
37 MAN_TXT = $(MAN3_TXT) $(MAN8_TXT) $(MAN5_TXT)
38 MAN_XML = $(patsubst %.asciidoc,%.xml,$(MAN_TXT))
39 MAN_HTML = $(patsubst %.asciidoc,%.html,$(MAN_TXT))
40 GZ_MAN3 = $(patsubst %.asciidoc,%.3.gz,$(MAN3_TXT))
41 GZ_MAN5 = $(patsubst %.asciidoc,%.5.gz,$(MAN5_TXT))
42 GZ_MAN8 = $(patsubst %.asciidoc,%.8.gz,$(MAN8_TXT))
44 mandir ?= $(prefix)/share/man
45 man3dir = $(mandir)/man3
46 man5dir = $(mandir)/man5
47 man8dir = $(mandir)/man8
49 ifeq (@ASCIIDOC_TOOL@,asciidoc)
50 ASCIIDOC = @ASCIIDOC@
51 ASCIIDOC_ARGS = -abtrfs_version=$(BTRFS_VERSION) -f asciidoc.conf
52 ASCIIDOC_HTML = html
53 ASCIIDOC_DOCBOOK = docbook
54 ASCIIDOC_DEPS = asciidoc.conf
55 endif
56 ifeq (@ASCIIDOC_TOOL@,asciidoctor)
57 ASCIIDOC = @ASCIIDOCTOR@
58 ASCIIDOC_ARGS = -abtrfs_version=$(BTRFS_VERSION)
59 ASCIIDOC_HTML = xhtml5
60 ASCIIDOC_DOCBOOK = docbook45
61 ASCIIDOC_DEPS =
62 endif
64 MANPAGE_XSL = manpage-normal.xsl
65 XMLTO = @XMLTO@
66 XMLTO_EXTRA =
67 XMLTO_EXTRA = -m manpage-bold-literal.xsl
68 GZIPCMD = @GZIP@
69 INSTALL = @INSTALL@
70 RM = @RM@
71 RMDIR = @RMDIR@
72 LN_S = @LN_S@
73 MV = @MV@
74 SED = @SED@
75 BTRFS_VERSION = $(shell $(SED) -n 's/.*PACKAGE_VERSION "\(.*\)"/\1/p'\
76 ../config.h)
78 ifneq ($(findstring $(MAKEFLAGS),s),s)
79 ifndef V
80 QUIET_RM = @
81 QUIET_ASCIIDOC = @echo " [ASCII] $@";
82 QUIET_XMLTO = @echo " [XMLTO] $@";
83 QUIET_GZIP = @echo " [GZ] $@";
84 endif
85 endif
87 all: man
88 man: man3 man5 man8
89 man3: $(GZ_MAN3)
90 man5: $(GZ_MAN5)
91 man8: $(GZ_MAN8)
92 html: $(MAN_HTML)
94 install: install-man
96 install-man: man
97 $(INSTALL) -d -m 755 $(DESTDIR)$(man5dir)
98 $(INSTALL) -d -m 755 $(DESTDIR)$(man8dir)
99 $(INSTALL) -m 644 $(GZ_MAN5) $(DESTDIR)$(man5dir)
100 # the source file name of btrfs.5 clashes with section 8 page, but we
101 # want to keep the code generic
102 $(MV) $(DESTDIR)$(man5dir)/btrfs-man5.5.gz $(DESTDIR)$(man5dir)/btrfs.5.gz
103 $(INSTALL) -m 644 $(GZ_MAN8) $(DESTDIR)$(man8dir)
104 $(LN_S) -f btrfs-check.8.gz $(DESTDIR)$(man8dir)/btrfsck.8.gz
106 uninstall:
107 cd $(DESTDIR)$(man8dir); rm -f btrfs-check.8.gz $(GZ_MAN8)
108 $(RMDIR) -p --ignore-fail-on-non-empty $(DESTDIR)$(man8dir)
110 clean:
111 $(QUIET_RM)$(RM) -f *.xml *.xml+ *.3 *.3.gz *.5 *.5.gz *.8 *.8.gz *.html
113 %.3.gz : %.3
114 $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@
116 %.5.gz : %.5
117 $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@
119 %.8.gz : %.8
120 $(QUIET_GZIP)$(GZIPCMD) -n -c $< > $@
122 %.3 : %.xml
123 $(QUIET_XMLTO)$(RM) -f $@ && \
124 $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
126 %.5 : %.xml
127 $(QUIET_XMLTO)$(RM) -f $@ && \
128 $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
130 %.8 : %.xml
131 $(QUIET_XMLTO)$(RM) -f $@ && \
132 $(XMLTO) -m $(MANPAGE_XSL) $(XMLTO_EXTRA) man $<
134 %.xml : %.asciidoc $(ASCIIDOC_DEPS)
135 $(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \
136 $(ASCIIDOC) $(ASCIIDOC_ARGS) -b $(ASCIIDOC_DOCBOOK) -d manpage -o $@+ $< && \
137 $(MV) $@+ $@
139 %.html : %.asciidoc $(ASCIIDOC_DEPS)
140 $(QUIET_ASCIIDOC)$(RM) -f $@+ $@ && \
141 $(ASCIIDOC) $(ASCIIDOC_ARGS) -b $(ASCIIDOC_HTML) -d article -o $@+ $< && \
142 $(MV) $@+ $@