coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 16/22] build: rework some recipes in main/Makefile.am, for future


From: Stefano Lattarini
Subject: [PATCH 16/22] build: rework some recipes in main/Makefile.am, for future changes
Date: Wed, 29 Aug 2012 23:54:53 +0200

This change is merely required to make future changes easier.

In particular, since we are going to merge the contents of
'man/Makefile.am' in 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 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.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 man/Makefile.am | 54 +++++++++++++++++++++++++++---------------------------
 1 file changed, 27 insertions(+), 27 deletions(-)

diff --git a/man/Makefile.am b/man/Makefile.am
index ff1c1ab..f7db996 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
-- 
1.7.12




reply via email to

[Prev in Thread] Current Thread [Next in Thread]