]>
Commit | Line | Data |
---|---|---|
795ca3e5 | 1 | # |
6606c3ae | 2 | # Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved. |
ca905681 | 3 | # Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved. |
795ca3e5 | 4 | # |
7f8f8bfa | 5 | # This file is part of LVM2. |
795ca3e5 | 6 | # |
6606c3ae AK |
7 | # This copyrighted material is made available to anyone wishing to use, |
8 | # modify, copy, or redistribute it subject to the terms and conditions | |
9 | # of the GNU General Public License v.2. | |
795ca3e5 | 10 | # |
6606c3ae AK |
11 | # You should have received a copy of the GNU General Public License |
12 | # along with this program; if not, write to the Free Software Foundation, | |
fcbef05a | 13 | # Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
795ca3e5 AK |
14 | |
15 | srcdir = @srcdir@ | |
16 | top_srcdir = @top_srcdir@ | |
db8b5af9 | 17 | top_builddir = @top_builddir@ |
795ca3e5 | 18 | |
7a475bef JT |
19 | ifeq ($(V),1) |
20 | Q= | |
21 | else | |
22 | Q=@ | |
23 | endif | |
24 | ||
0ed230fa | 25 | FSADMMAN = fsadm.8 |
12ba43cc | 26 | LVMIMPORTVDOMAN = lvm_import_vdo.8 |
c698ee14 | 27 | BLKDEACTIVATEMAN = blkdeactivate.8 |
c5782bcf | 28 | DMEVENTDMAN = dmeventd.8 |
a4a6a7a5 | 29 | DMFILEMAPDMAN = dmfilemapd.8 |
cc17210b | 30 | LVMPOLLDMAN = lvmpolld.8 |
f5a3b05c | 31 | LVMLOCKDMAN = lvmlockd.8 lvmlockctl.8 |
cc17210b | 32 | CMIRRORDMAN = cmirrord.8 |
5987562c | 33 | LVMDBUSDMAN = lvmdbusd.8 |
fe70b03d | 34 | |
ef91884b | 35 | MAN5=lvm.conf.5 |
00900748 | 36 | MAN7=lvmsystemid.7 lvmreport.7 lvmraid.7 lvmautoactivation.7 |
679116a9 | 37 | |
19a59cc5 | 38 | MAN8=lvm.8 lvmdump.8 lvm-fullreport.8 lvm-lvpoll.8 \ |
67421379 | 39 | lvcreate.8 lvchange.8 lvmconfig.8 lvconvert.8 lvdisplay.8 \ |
ca905681 AK |
40 | lvextend.8 lvreduce.8 lvremove.8 lvrename.8 lvresize.8 lvs.8 \ |
41 | lvscan.8 pvchange.8 pvck.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \ | |
42 | pvresize.8 pvs.8 pvscan.8 vgcfgbackup.8 vgcfgrestore.8 vgchange.8 \ | |
43 | vgck.8 vgcreate.8 vgconvert.8 vgdisplay.8 vgexport.8 vgextend.8 \ | |
44 | vgimport.8 vgimportclone.8 vgmerge.8 vgmknodes.8 vgreduce.8 vgremove.8 \ | |
45 | vgrename.8 vgs.8 vgscan.8 vgsplit.8 \ | |
83fe6e72 | 46 | lvmsar.8 lvmsadc.8 lvmdiskscan.8 lvmdevices.8 vgimportdevices.8 |
4af09a94 | 47 | MAN8SO=lvm-config.8 lvm-dumpconfig.8 |
a4a6a7a5 | 48 | MAN8DM=dmsetup.8 dmstats.8 |
044f92e4 | 49 | MAN8CLUSTER= |
81410c8f | 50 | |
520bd935 | 51 | ifeq (,$(findstring $(MAKECMDGOALS), distclean all_man install_all_man)) |
679116a9 | 52 | MAN7 += lvmcache.7 lvmthin.7 lvmvdo.7 |
12ba43cc | 53 | MAN8+=$(FSADMMAN) $(LVMPOLLDMAN) $(LVMLOCKDMAN) $(LVMDBUSDMAN) $(LVMIMPORTVDOMAN) |
a4a6a7a5 | 54 | MAN8DM+=$(BLKDEACTIVATEMAN) $(DMEVENTDMAN) $(DMFILEMAPDMAN) |
9d2b9e5b | 55 | MAN8CLUSTER+=$(CMIRRORDMAN) |
81410c8f | 56 | else |
cc17210b AK |
57 | ifeq ("@FSADM@", "yes") |
58 | MAN8+=$(FSADMMAN) | |
ed48cb26 ZK |
59 | endif |
60 | ||
12ba43cc ZK |
61 | ifeq ("@LVMIMPORTVDO@", "yes") |
62 | MAN8+=$(LVMIMPORTVDOMAN) | |
cc17210b | 63 | endif |
6d2a26f6 | 64 | |
5987562c AK |
65 | ifeq ("@BUILD_LVMDBUSD@", "yes") |
66 | MAN8+=$(LVMDBUSDMAN) | |
67 | endif | |
68 | ||
cc17210b AK |
69 | ifeq ("@BUILD_LVMPOLLD@", "yes") |
70 | MAN8+=$(LVMPOLLDMAN) | |
71 | endif | |
72 | ||
73 | ifeq ("@BUILD_LVMLOCKD@", "yes") | |
74 | MAN8+=$(LVMLOCKDMAN) | |
75 | endif | |
76 | ||
77 | ifeq ("@BLKDEACTIVATE@", "yes") | |
78 | MAN8DM+=$(BLKDEACTIVATEMAN) | |
79 | endif | |
80 | ||
95dd5bc7 | 81 | ifeq ("@BUILD_DMEVENTD@", "yes") |
cc17210b AK |
82 | MAN8DM+=$(DMEVENTDMAN) |
83 | endif | |
b73a7867 | 84 | |
658d524d | 85 | ifeq ("@BUILD_DMFILEMAPD@", "yes") |
a4a6a7a5 MC |
86 | MAN8DM+=$(DMFILEMAPDMAN) |
87 | endif | |
88 | ||
cc17210b AK |
89 | ifeq ("@BUILD_CMIRRORD@", "yes") |
90 | MAN8CLUSTER+=$(CMIRRORDMAN) | |
91 | endif | |
679116a9 ZK |
92 | |
93 | ifeq ("@CACHE@", "internal") | |
94 | MAN7 += lvmcache.7 | |
95 | else | |
96 | ifeq ("@WRITECACHE@", "internal") | |
97 | MAN7 += lvmcache.7 | |
98 | endif | |
99 | endif | |
100 | ||
101 | ifeq ("@THIN@", "internal") | |
102 | MAN7 += lvmthin.7 | |
103 | endif | |
104 | ||
105 | ifeq ("@VDO@", "internal") | |
106 | MAN7 += lvmvdo.7 | |
107 | endif | |
108 | ||
6d2a26f6 AK |
109 | endif |
110 | ||
76602ee8 | 111 | MAN5DIR=$(mandir)/man5 |
6d2a26f6 | 112 | MAN7DIR=$(mandir)/man7 |
76602ee8 | 113 | MAN8DIR=$(mandir)/man8 |
795ca3e5 | 114 | |
5e7bc8d8 | 115 | MANGENERATOR=$(top_builddir)/tools/man-generator |
ca905681 AK |
116 | TESTMAN=test.gen |
117 | ||
814aebc4 | 118 | include $(top_builddir)/make.tmpl |
795ca3e5 | 119 | |
67421379 | 120 | CLEAN_TARGETS+=$(MAN5) $(MAN7) $(MAN8) $(MAN8SO) $(MAN8:%.8=%.8_gen) $(MAN8CLUSTER) \ |
ee8fb031 | 121 | $(MAN8DM) $(TESTMAN) |
cab8ea7c | 122 | |
598c92ff | 123 | all: man device-mapper |
5951ef33 | 124 | |
ca905681 | 125 | .PHONY: man install_man5 install_man7 install_man8 pregenerated_man |
5951ef33 | 126 | |
77b69aa7 | 127 | device-mapper: $(MAN8DM) |
0782ad50 | 128 | |
ee8fb031 | 129 | man: $(MAN5) $(MAN7) $(MAN8) $(MAN8SO) $(MAN8CLUSTER) |
5951ef33 | 130 | |
548c09ac AK |
131 | all_man: man |
132 | ||
ee8fb031 | 133 | $(MAN5) $(MAN7) $(MAN8) $(MAN8SO) $(MAN8DM) $(MAN8CLUSTER): Makefile |
5951ef33 | 134 | |
fccd6e03 | 135 | $(MANGENERATOR): |
88ad83e3 | 136 | $(SHOW) " [MAKE] $<" |
fccd6e03 ZK |
137 | $(Q) $(MAKE) -C $(top_builddir) tools |
138 | ||
ca905681 | 139 | # Test whether or not the man page generator works |
5e7bc8d8 | 140 | $(TESTMAN): $(MANGENERATOR) Makefile |
88ad83e3 | 141 | $(SHOW) " [TSTMAN] $@" |
39eee85f | 142 | $(Q) - $(MANGENERATOR) --primary lvmconfig > $@ |
ca905681 AK |
143 | |
144 | SEE_ALSO=$(srcdir)/see_also.end | |
145 | ||
270ed9bc AK |
146 | .PRECIOUS: %.8_gen |
147 | ||
ca905681 | 148 | %.8_gen: $(srcdir)/%.8_des $(srcdir)/%.8_end $(MANGENERATOR) $(TESTMAN) |
0c68c19c | 149 | $(Q)set -e ; ( \ |
ca905681 | 150 | if [ ! -s $(TESTMAN) ] ; then \ |
54f98c94 ZK |
151 | cat $(srcdir)/$(@:%.8_gen=%.8_pregen) \ |
152 | $(srcdir)/$(basename $@).8_end $(SEE_ALSO) ; \ | |
ca905681 AK |
153 | else \ |
154 | MANCMD=$(basename $@) && \ | |
93467f0d HM |
155 | $(MANGENERATOR) --primary $$MANCMD $< && \ |
156 | $(MANGENERATOR) --secondary $$MANCMD && \ | |
54f98c94 | 157 | cat $(srcdir)/$(basename $@).8_end $(SEE_ALSO) ; \ |
ca905681 AK |
158 | fi \ |
159 | ) > $@ | |
160 | ||
dc934b13 ZK |
161 | # |
162 | # When EDITLINE_LIBS is defined, we are compiling with libedit | |
163 | # | |
164 | ifneq ("$(EDITLINE_LIBS)", "") | |
165 | DEFAULT_LIBLINE=editline | |
166 | else | |
167 | DEFAULT_LIBLINE=readline | |
168 | endif | |
169 | ||
ca905681 | 170 | define SUBSTVARS |
f5efe1be | 171 | $(SED) -e "s+#VERSION#+$(LVM_VERSION)+" \ |
3aab8731 HM |
172 | -e "s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+" \ |
173 | -e "s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+" \ | |
174 | -e "s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+" \ | |
175 | -e "s+#DEFAULT_PROFILE_DIR#+$(DEFAULT_PROFILE_DIR)+" \ | |
176 | -e "s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+" \ | |
177 | -e "s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+" \ | |
0004ffa7 | 178 | -e "s+#LVM_PATH#+@bindir@/lvm+" \ |
c1b5f38b ZK |
179 | -e "s+#DEFAULT_RUN_DIR#+$(DEFAULT_RUN_DIR)+" \ |
180 | -e "s+#DEFAULT_PID_DIR#+$(DEFAULT_PID_DIR)+" \ | |
3aab8731 | 181 | -e "s+#SYSTEMD_GENERATOR_DIR#+$(SYSTEMD_GENERATOR_DIR)+" \ |
dc934b13 | 182 | -e "s+#DEFAULT_LIBLINE#+$(DEFAULT_LIBLINE)+" \ |
a9d7a9d1 | 183 | -e "s+#DEFAULT_DMEVENTD_EXIT_ON_PATH#+$(DEFAULT_DMEVENTD_EXIT_ON_PATH)+" \ |
3aab8731 | 184 | -e "s+#DEFAULT_MANGLING#+$(DEFAULT_MANGLING)+" $< > $@ |
ca905681 AK |
185 | endef |
186 | ||
adfdfd9c ZK |
187 | # Escape any '-' to '\-' (except ^.TH line) |
188 | # and fix unwanted changes: | |
189 | # '\\-' back to '\-' | |
190 | # words like 'device\-mapper' back to 'device-mapper', | |
191 | # \[\->] \[<\-] back to \[->], \[<-] | |
192 | # however for some words i.e. '*-pool' we want '*\-pool' | |
193 | # also 'vg-lv,[systemd-]machine-id,lvm-full,lvm-lvpoll' should go with \- | |
7f312618 | 194 | # |
36cac411 | 195 | define ESCAPEHYPHENS |
adfdfd9c ZK |
196 | $(SED) -i -e "/^.TH/ !s+-+\\\-+g" \ |
197 | -e "s+\\\[\]-+\\\-+g" \ | |
198 | -e "s+\(^\|[^[:alnum:]\-]\)\([[:alpha:]]\{1,\}\)\\\-\((\|[([:alpha:]]\{2,\}\)+\1\2-\3+g" \ | |
199 | -e "s+\([[:alpha:]]\)-\(pool\)+\1\\\-\2+g" \ | |
200 | -e "s+[\][[]\(<\{0,1\}\)\\\-+\\\[\1-+g" \ | |
201 | -e "s+\(vg.\{1,\}[^\]\)-lv+\1\\\-lv+g" \ | |
202 | -e "s+systemd-machine+systemd\\\-machine+g" \ | |
203 | -e "s+machine-id+machine\\\-id+g" \ | |
204 | -e "s+lvm-full+lvm\\\-full+g" \ | |
205 | -e "s+lvm-lvpoll+lvm\\\-lvpoll+g" \ | |
fe6fb1ec | 206 | -e "s+\([[:digit:]]\)\s\([KMGTPE]iB\)+\1\\\ \2+g" \ |
adfdfd9c | 207 | $@ |
36cac411 HM |
208 | endef |
209 | ||
adfdfd9c ZK |
210 | .PHONY: checksed |
211 | checksed: | |
212 | $(Q) echo "cmd -a -b retry -c ret --use-policy -d" > $@ | |
213 | $(Q) echo "cmd \fI-u\fB -d retry \fI--use-pol --use-poli 4.0 --use \"-L|--size\"" >> $@ | |
214 | $(Q) echo "cmd --use-pol" >> $@ | |
215 | $(Q) echo "cmd --[raid]use device-mapper thin-pool \fB-\fP sdb1:1000-1999 \fB-t\fP|\fB--test\fP -? -o-field3" >> $@ | |
216 | $(Q) echo "cmd -dd---- \[->] \[<-] -*- -o#field5 -o-field3 -d" >> $@ | |
217 | $(Q) echo "-d" >> $@ | |
218 | $(Q) echo ".TH 2.03.12(2)-git" >> $@ | |
219 | $(Q) echo "--verbose" >> $@ | |
220 | $(Q) echo ".BR -- [ raid ] most -- [ raid ] most" >> $@ | |
221 | $(Q) echo ".BR | --verbose|--verb --verbose --verbose --verbose --verbose" >> $@ | |
222 | $(Q) echo "skip - unint --aa-dd- --aa-dd-- ---aa-dd 4.0 \-a\-b" >> $@ | |
223 | $(Q) echo "cmd \-a \-b retry \-c ret \-\-use\-policy \-d" > $@-e | |
224 | $(Q) echo "cmd \fI\-u\fB \-d retry \fI\-\-use\-pol \-\-use\-poli 4.0 \-\-use \"\-L|\-\-size\"" >> $@-e | |
225 | $(Q) echo "cmd \-\-use\-pol" >> $@-e | |
226 | $(Q) echo "cmd \-\-[raid]use device-mapper thin\-pool \fB\-\fP sdb1:1000\-1999 \fB\-t\fP|\fB\-\-test\fP \-? \-o\-field3" >> $@-e | |
227 | $(Q) echo "cmd \-dd\-\-\-\- \[->] \[<-] \-*\- \-o#field5 \-o\-field3 \-d" >> $@-e | |
228 | $(Q) echo "\-d" >> $@-e | |
229 | $(Q) echo ".TH 2.03.12(2)-git" >> $@-e | |
230 | $(Q) echo "\-\-verbose" >> $@-e | |
231 | $(Q) echo ".BR \-\- [ raid ] most \-\- [ raid ] most" >> $@-e | |
232 | $(Q) echo ".BR | \-\-verbose|\-\-verb \-\-verbose \-\-verbose \-\-verbose \-\-verbose" >> $@-e | |
233 | $(Q) echo "skip \- unint \-\-aa\-dd\- \-\-aa\-dd\-\- \-\-\-aa\-dd 4.0 \-a\-b" >> $@-e | |
234 | $(Q) $(ESCAPEHYPHENS) | |
235 | $(Q) echo "--- H Y P H E N A T E D ---" | |
236 | $(Q) cat $@ | |
237 | $(Q) diff -u $@-e $@ | |
238 | $(Q) $(RM) $@ $@-e | |
239 | ||
ca905681 | 240 | %.5: $(srcdir)/%.5_main |
88ad83e3 | 241 | $(SHOW) " [MAN] $@" |
7a475bef JT |
242 | $(Q) $(SUBSTVARS) |
243 | $(Q) $(ESCAPEHYPHENS) | |
ca905681 AK |
244 | |
245 | %.7: $(srcdir)/%.7_main | |
88ad83e3 | 246 | $(SHOW) " [MAN] $@" |
7a475bef JT |
247 | $(Q) $(SUBSTVARS) |
248 | $(Q) $(ESCAPEHYPHENS) | |
ca905681 AK |
249 | |
250 | %.8: $(srcdir)/%.8_main | |
88ad83e3 | 251 | $(SHOW) " [MAN] $@" |
7a475bef JT |
252 | $(Q) $(SUBSTVARS) |
253 | $(Q) $(ESCAPEHYPHENS) | |
ca905681 AK |
254 | |
255 | %.8: %.8_gen | |
88ad83e3 | 256 | $(SHOW) " [MAN] $@" |
7a475bef JT |
257 | $(Q) $(SUBSTVARS) |
258 | $(Q) $(ESCAPEHYPHENS) | |
698abdde | 259 | |
e9921ffd | 260 | $(MAN8SO): lvmconfig.8 |
88ad83e3 | 261 | $(SHOW) " [MAN] $@" |
7a475bef | 262 | $(Q) echo ".so $<" > $@ |
67421379 | 263 | |
23b059e7 | 264 | install_man5: $(MAN5) |
88ad83e3 | 265 | $(SHOW) " [INSTALL] $^" |
7a475bef | 266 | $(Q) $(INSTALL) -d $(MAN5DIR) |
520bd935 | 267 | $(Q) $(INSTALL_DATA) $^ $(MAN5DIR)/ |
23b059e7 | 268 | |
422b3b0f | 269 | install_man7: $(MAN7) |
88ad83e3 | 270 | $(SHOW) " [INSTALL] $^" |
7a475bef | 271 | $(Q) $(INSTALL) -d $(MAN7DIR) |
520bd935 | 272 | $(Q) $(INSTALL_DATA) $^ $(MAN7DIR)/ |
6d2a26f6 | 273 | |
4af09a94 | 274 | install_man8: $(MAN8) $(MAN8SO) |
88ad83e3 | 275 | $(SHOW) " [INSTALL] $^" |
7a475bef | 276 | $(Q) $(INSTALL) -d $(MAN8DIR) |
520bd935 | 277 | $(Q) $(INSTALL_DATA) $^ $(MAN8DIR)/ |
23b059e7 | 278 | |
6d2a26f6 | 279 | install_lvm2: install_man5 install_man7 install_man8 |
23b059e7 ZK |
280 | |
281 | install_cluster: $(MAN8CLUSTER) | |
1ddc68cc | 282 | ifdef MAN8CLUSTER |
88ad83e3 | 283 | $(SHOW) " [INSTALL] $^" |
7a475bef | 284 | $(Q) $(INSTALL) -d $(MAN8DIR) |
520bd935 | 285 | $(Q) $(INSTALL_DATA) $^ $(MAN8DIR)/ |
1ddc68cc | 286 | endif |
23b059e7 ZK |
287 | |
288 | install_device-mapper: $(MAN8DM) | |
88ad83e3 | 289 | $(SHOW) " [INSTALL] $^" |
7a475bef | 290 | $(Q) $(INSTALL) -d $(MAN8DIR) |
520bd935 | 291 | $(Q) $(INSTALL_DATA) $^ $(MAN8DIR)/ |
0b502933 | 292 | |
a058fab1 | 293 | install: install_lvm2 install_device-mapper install_cluster |
cc17210b | 294 | |
548c09ac | 295 | install_all_man: install install_systemd_generators |
ca905681 AK |
296 | |
297 | # Copy generated man pages back to source tree as fallback for machines where generator doesn't work | |
54f98c94 | 298 | pregenerated_man: $(MANGENERATOR) $(TESTMAN) |
88ad83e3 | 299 | $(SHOW) " [GENERATE] $^" |
54f98c94 | 300 | $(Q) set -e ; test -s $(TESTMAN) && for i in $(srcdir)/*.8_des; do \ |
ca905681 | 301 | CMD=`basename $$i .8_des`; \ |
54f98c94 ZK |
302 | ( $(MANGENERATOR) --primary $$CMD $$i && \ |
303 | $(MANGENERATOR) --secondary $$CMD ) \ | |
304 | > $(srcdir)/$$CMD.8_pregen ; \ | |
ca905681 AK |
305 | done |
306 | ||
307 | generate: pregenerated_man |