1
0
mirror of git://sourceware.org/git/lvm2.git synced 2025-01-02 01:18:26 +03:00
lvm2/man/Makefile.in
Heinz Mauelshagen 36cac41115 man-generator/man/help: simplify hyphen escaping
Commits a29bb6a14b
    ... 5c199d99f4
narrowed down on addressing the escaping of hyphens
in the dynamic creation of manuals whilst avoiding
them in creating help texts.  This lead to a sequence
of slipping through hyphens adrressed by additional
patches in aforementioned commit series.

On the other hand, postprocessing dynamically man-generator
created and statically provided manuals catches all hyphens
in need of escaping.

Changes:
- revert the above commits whilst keeping man-generator
  streamlining and the detection of any '\' when generating
  help texts in order to avoid escapes to slip in

- Dynamically escape hyphens in manaual pages using sed(1)
  in the respective Makefile targets

- remove any manually added escaping on hyphens from any
  static manual sources or headers
2017-03-27 16:49:39 +02:00

236 lines
6.3 KiB
Makefile

#
# Copyright (C) 2001-2004 Sistina Software, Inc. All rights reserved.
# Copyright (C) 2004-2017 Red Hat, Inc. All rights reserved.
#
# This file is part of LVM2.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions
# of the GNU General Public License v.2.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
srcdir = @srcdir@
top_srcdir = @top_srcdir@
top_builddir = @top_builddir@
FSADMMAN = fsadm.8
BLKDEACTIVATEMAN = blkdeactivate.8
DMEVENTDMAN = dmeventd.8
DMFILEMAPDMAN = dmfilemapd.8
LVMETADMAN = lvmetad.8
LVMPOLLDMAN = lvmpolld.8
LVMLOCKDMAN = lvmlockd.8 lvmlockctl.8
CLVMDMAN = clvmd.8
CMIRRORDMAN = cmirrord.8
LVMCACHEMAN = lvmcache.7
LVMTHINMAN = lvmthin.7
LVMDBUSDMAN = lvmdbusd.8
LVMRAIDMAN = lvmraid.7
MAN5=lvm.conf.5
MAN7=lvmsystemid.7 lvmreport.7
MAN8=lvm.8 lvmconf.8 lvmdump.8 lvm-config.8 lvm-dumpconfig.8 lvm-fullreport.8 \
lvm-lvpoll.8 lvcreate.8 lvchange.8 lvmconfig.8 lvconvert.8 lvdisplay.8 \
lvextend.8 lvreduce.8 lvremove.8 lvrename.8 lvresize.8 lvs.8 \
lvscan.8 pvchange.8 pvck.8 pvcreate.8 pvdisplay.8 pvmove.8 pvremove.8 \
pvresize.8 pvs.8 pvscan.8 vgcfgbackup.8 vgcfgrestore.8 vgchange.8 \
vgck.8 vgcreate.8 vgconvert.8 vgdisplay.8 vgexport.8 vgextend.8 \
vgimport.8 vgimportclone.8 vgmerge.8 vgmknodes.8 vgreduce.8 vgremove.8 \
vgrename.8 vgs.8 vgscan.8 vgsplit.8 \
lvmsar.8 lvmsadc.8 lvmdiskscan.8
MAN8DM=dmsetup.8 dmstats.8
MAN8CLUSTER=
MAN8SYSTEMD_GENERATORS=lvm2-activation-generator.8
ifeq ($(MAKECMDGOALS),all_man)
MAN_ALL="yes"
endif
ifeq ($(MAKECMDGOALS),install_all_man)
MAN_ALL="yes"
endif
ifeq ($(MAN_ALL),"yes")
MAN8+=$(FSADMMAN) $(LVMETADMAN) $(LVMPOLLDMAN) $(LVMLOCKDMAN) $(LVMDBUSDMAN)
MAN8DM+=$(BLKDEACTIVATEMAN) $(DMEVENTDMAN) $(DMFILEMAPDMAN)
MAN8CLUSTER+=$(CLVMDMAN) $(CMIRRORDMAN)
MAN7+=$(LVMCACHEMAN) $(LVMTHINMAN) $(LVMRAIDMAN)
else
ifeq ("@FSADM@", "yes")
MAN8+=$(FSADMMAN)
endif
ifeq ("@BUILD_LVMDBUSD@", "yes")
MAN8+=$(LVMDBUSDMAN)
endif
ifeq ("@BUILD_LVMETAD@", "yes")
MAN8+=$(LVMETADMAN)
endif
ifeq ("@BUILD_LVMPOLLD@", "yes")
MAN8+=$(LVMPOLLDMAN)
endif
ifeq ("@BUILD_LVMLOCKD@", "yes")
MAN8+=$(LVMLOCKDMAN)
endif
ifeq ("@BLKDEACTIVATE@", "yes")
MAN8DM+=$(BLKDEACTIVATEMAN)
endif
ifeq ("@DMEVENTD@", "yes")
MAN8DM+=$(DMEVENTDMAN)
endif
ifeq ("@DMFILEMAPD@", "yes")
MAN8DM+=$(DMFILEMAPDMAN)
endif
ifneq ("@CLVMD@", "none")
MAN8CLUSTER+=$(CLVMDMAN)
endif
ifeq ("@BUILD_CMIRRORD@", "yes")
MAN8CLUSTER+=$(CMIRRORDMAN)
endif
ifneq ("@CACHE@", "none")
MAN7+=$(LVMCACHEMAN)
endif
ifneq ("@THIN@", "none")
MAN7+=$(LVMTHINMAN)
endif
ifneq ("@RAID@", "none")
MAN7+=$(LVMRAIDMAN)
endif
endif
MAN5DIR=$(mandir)/man5
MAN7DIR=$(mandir)/man7
MAN8DIR=$(mandir)/man8
MANGENERATOR=$(top_builddir)/tools/man-generator
TESTMAN=test.gen
include $(top_builddir)/make.tmpl
CLEAN_TARGETS+=$(MAN5) $(MAN7) $(MAN8) $(MAN8:%.8=%.8_gen) $(MAN8CLUSTER) \
$(MAN8SYSTEMD_GENERATORS) $(MAN8DM) $(TESTMAN)
DISTCLEAN_TARGETS+=$(FSADMMAN) $(BLKDEACTIVATEMAN) $(DMEVENTDMAN) \
$(LVMETADMAN) $(LVMPOLLDMAN) $(LVMLOCKDMAN) $(CLVMDMAN) $(CMIRRORDMAN) \
$(LVMCACHEMAN) $(LVMTHINMAN) $(LVMDBUSDMAN) $(LVMRAIDMAN) \
$(DMFILEMAPDMAN)
all: man device-mapper
.PHONY: man install_man5 install_man7 install_man8 pregenerated_man
device-mapper: $(MAN8DM)
man: $(MAN5) $(MAN7) $(MAN8) $(MAN8CLUSTER) $(MAN8SYSTEMD_GENERATORS)
all_man: man
$(MAN5) $(MAN7) $(MAN8) $(MAN8DM) $(MAN8CLUSTER) $(MAN8SYSTEMD_GENERATORS): Makefile
# Test whether or not the man page generator works
$(TESTMAN): $(MANGENERATOR) Makefile
- $(MANGENERATOR) --primary lvmconfig > $@
SEE_ALSO=$(srcdir)/see_also.end
.PRECIOUS: %.8_gen
%.8_gen: $(srcdir)/%.8_des $(srcdir)/%.8_end $(MANGENERATOR) $(TESTMAN)
( \
if [ ! -s $(TESTMAN) ] ; then \
echo "Copying pre-generated template $@" ; \
else \
echo "Generating template $@" ; \
fi \
)
( \
if [ ! -s $(TESTMAN) ] ; then \
cat $(srcdir)/$(@:%.8_gen=%.8_pregen) ; \
else \
MANCMD=$(basename $@) && \
$(MANGENERATOR) --primary $$MANCMD $< && \
$(MANGENERATOR) --secondary $$MANCMD && \
cat $(srcdir)/$(basename $@).8_end && \
cat $(SEE_ALSO) ; \
fi \
) > $@
define SUBSTVARS
echo "Generating $@" ; $(SED) -e "s+#VERSION#+$(LVM_VERSION)+;s+#DEFAULT_SYS_DIR#+$(DEFAULT_SYS_DIR)+;s+#DEFAULT_ARCHIVE_DIR#+$(DEFAULT_ARCHIVE_DIR)+;s+#DEFAULT_BACKUP_DIR#+$(DEFAULT_BACKUP_DIR)+;s+#DEFAULT_PROFILE_DIR#+$(DEFAULT_PROFILE_DIR)+;s+#DEFAULT_CACHE_DIR#+$(DEFAULT_CACHE_DIR)+;s+#DEFAULT_LOCK_DIR#+$(DEFAULT_LOCK_DIR)+;s+#CLVMD_PATH#+/data/lvmtest/usr/sbin/clvmd+;s+#LVM_PATH#+/data/lvmtest/sbin/lvm+;s+#DEFAULT_RUN_DIR#+/var/run/lvm+;s+#DEFAULT_PID_DIR#+/var/run+;s+#SYSTEMD_GENERATOR_DIR#+$(SYSTEMD_GENERATOR_DIR)+;s+#DEFAULT_MANGLING#+$(DEFAULT_MANGLING)+;" $< > $@
endef
define ESCAPEHYPHENS
sed -i "s+\([^\\]\)--+\1\\\-\\\-+g;s+\([^\\]\)-+\1\\\-+g" $@
endef
%.5: $(srcdir)/%.5_main
$(SUBSTVARS)
$(ESCAPEHYPHENS)
%.7: $(srcdir)/%.7_main
$(SUBSTVARS)
$(ESCAPEHYPHENS)
%.8: $(srcdir)/%.8_main
$(SUBSTVARS)
$(ESCAPEHYPHENS)
%.8: %.8_gen
$(SUBSTVARS)
$(ESCAPEHYPHENS)
install_man5: $(MAN5)
$(INSTALL) -d $(MAN5DIR)
$(INSTALL_DATA) $(MAN5) $(MAN5DIR)/
install_man7: $(MAN7)
$(INSTALL) -d $(MAN7DIR)
$(INSTALL_DATA) $(MAN7) $(MAN7DIR)/
install_man8: $(MAN8) $(MAN8GENERATED)
$(INSTALL) -d $(MAN8DIR)
$(INSTALL_DATA) $(MAN8) $(MAN8GENERATED) $(MAN8DIR)/
install_lvm2: install_man5 install_man7 install_man8
install_cluster: $(MAN8CLUSTER)
ifdef MAN8CLUSTER
$(INSTALL) -d $(MAN8DIR)
$(INSTALL_DATA) $(MAN8CLUSTER) $(MAN8DIR)/
endif
install_device-mapper: $(MAN8DM)
$(INSTALL) -d $(MAN8DIR)
$(INSTALL_DATA) $(MAN8DM) $(MAN8DIR)/
install_systemd_generators: $(MAN8SYSTEMD_GENERATORS)
$(INSTALL) -d $(MAN8DIR)
$(INSTALL_DATA) $(MAN8SYSTEMD_GENERATORS) $(MAN8DIR)/
install: install_lvm2 install_device-mapper install_cluster
install_all_man: install install_systemd_generators
# Copy generated man pages back to source tree as fallback for machines where generator doesn't work
pregenerated_man: all
for i in $(srcdir)/*.8_des; do \
CMD=`basename $$i .8_des`; \
cat $${CMD}.8_gen > $(srcdir)/$$CMD.8_pregen ; \
done
generate: pregenerated_man