From 34e2473f412bfa66d55c969ae1757510e371ea9a Mon Sep 17 00:00:00 2001 From: Stefano Lattarini Date: Wed, 29 Aug 2012 21:31:57 +0200 Subject: build: rework some recipes in man/Makefile.am, for future changes This change is merely required to make future changes easier. In particular, since we are going to merge the contents of 'man/Makefile.am' into the top-level Makefile, we need to avoid conflicts with the rules and variables in 'dist-check.mk', and to prepare for changes in the value of the '$*' variable as used in the recipe of the '.x -> .1' suffix rule. * man/Makefile.am (t, mapped_name): Delete, inlining their use ... (.1.x): ... in the recipe of this suffix rule. Other adjustments to prepare to changes in the value of the '$*' automatic variable. While at it, made more resilient about unlikely but possible failure. Adjust and reorder few comments. --- man/Makefile.am | 54 +++++++++++++++++++++++++++--------------------------- 1 file changed, 27 insertions(+), 27 deletions(-) (limited to 'man') diff --git a/man/Makefile.am b/man/Makefile.am index ff1c1ab93..f7db99628 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -148,38 +148,38 @@ yes.1: $(mandep) ../src/yes.c # provoke regeneration of all $(MAN) files. $(MAN): $(top_srcdir)/src/system.h -# Ensure that help2man runs the ../src/ginstall binary as -# 'install' when creating install.1. -# Similarly, ensure that it uses the ../src/[ binary to create test.1. -t = $*.td -mapped_name = `echo $*|sed 's/^install$$/ginstall/; s/^test$$/[/'` - -# Note the use of $t/$*, rather than just '$*' as in other packages. -# That is necessary to avoid failures for programs that are also shell built-in -# functions like echo, false, printf, pwd. .x.1: $(AM_V_GEN)case '$(PERL)' in \ *"/missing "*) \ echo 'WARNING: cannot update man page $@ since perl is missing' \ 'or inadequate' 1>&2 \ - ;; \ - *) \ - rm -f $@ $@-t \ - && { \ - rm -rf $t; \ - mkdir $t; \ - (cd $t && $(LN_S) $(abs_top_builddir)/src/$(mapped_name) $*); \ - $(PERL) -- $(srcdir)/help2man \ - --source='$(PACKAGE_STRING)' \ - --include=$(srcdir)/$*.x \ - --output=$t/$@ $t/$*; \ - } \ - && sed 's|$*\.td/||g' $t/$@ > $@-t \ - && rm -rf $t \ - && chmod -w $@-t \ - && mv $@-t $@ \ - ;; \ - esac + exit 0;; \ + esac; \ + name=`echo $@ | sed -e 's|.*/||' -e 's|\.1$$||'` || exit 1; \ +## Ensure that help2man runs the 'src/ginstall' binary as 'install' when +## creating 'install.1'. Similarly, ensure that it uses the 'src/[' binary +## to create 'test.1'. + case $$name in \ + install) prog='ginstall';; \ + test) prog='[';; \ + *) prog=$$name;; \ + esac; \ +## Note the use of $$t/$*, rather than just '$*' as in other packages. +## That is necessary to avoid failures for programs that are also shell +## built-in functions like echo, false, printf, pwd. + rm -f $@ $@-t \ + && t=$*.td \ + && rm -rf $$t \ + && mkdir $$t \ + && (cd $$t && $(LN_S) $(abs_top_builddir)/src/$$prog $$name) \ + && $(PERL) -- $(srcdir)/help2man \ + --source='$(PACKAGE_STRING)' \ + --include=$(srcdir)/$$name.x \ + --output=$$t/$$name.1 $$t/$$name \ + && sed 's|$*\.td/||g' $$t/$$name.1 > $@-t \ + && rm -rf $$t \ + && chmod -w $@-t \ + && mv $@-t $@ # Option descriptions should not start with a capital letter .PHONY: sc_option_desc_uppercase -- cgit v1.2.3-54-g00ecf