summaryrefslogtreecommitdiff
path: root/man
diff options
context:
space:
mode:
authorStefano Lattarini <stefano.lattarini@gmail.com>2012-08-29 21:31:57 +0200
committerJim Meyering <meyering@redhat.com>2012-08-30 15:22:00 +0200
commit34e2473f412bfa66d55c969ae1757510e371ea9a (patch)
tree1f1fa39e13396dc0c317a521ece3fa28863540d3 /man
parentb10412567f0781102efe710ad51984ae26d905d3 (diff)
downloadcoreutils-34e2473f412bfa66d55c969ae1757510e371ea9a.tar.xz
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.
Diffstat (limited to 'man')
-rw-r--r--man/Makefile.am54
1 files changed, 27 insertions, 27 deletions
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