]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
[ng] refactor: remove all uses of '$(am__strip_dir)'
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 7 Aug 2012 22:21:39 +0000 (00:21 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 8 Aug 2012 10:40:47 +0000 (12:40 +0200)
Prefer using GNU make built-in '$(notdir)' instead.  This change doesn't
offer any serious simplification, but is just a step in the general
direction of moving more non-trivial processing to GNU make.

* lib/am/lib.am: Rewritten some install/uninstall rules to avoid
using '$(am__strip_dir)'.
* lib/am/lisp.am: Likewise.
* lib/am/ltlib.am: Likewise.
* lib/am/python.am: Likewise.
* lib/am/texinfos.am: Likewise.
* lib/am/header-vars.mk (am__strip_dir): Remove.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
lib/am/header-vars.mk
lib/am/libs.am
lib/am/lisp.am
lib/am/ltlib.am
lib/am/python.am
lib/am/texinfos.am

index b4306cd5fb6b0d1785119bc35c2d12cdabc838fb..b21b927e7314217f83857fcc95c8700c91ae56df 100644 (file)
@@ -356,9 +356,6 @@ NORMAL_UNINSTALL = :
 PRE_UNINSTALL = :
 POST_UNINSTALL = :
 
-# Strip all directories.
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-
 # Number of files to install concurrently.
 am__install_max = 40
 # Take a $list of "nobase" files, strip $(srcdir) from them.
index ece521224d00f32d7e402fb04147a15363ecdfd7..164af5852babe91efc403378ca8f081a4b4c8093 100644 (file)
@@ -63,11 +63,11 @@ endif !%?BASE%
 ## useless; sh never actually executes this command.  Read the GNU
 ## Standards for a little enlightenment on this.
        @$(POST_INSTALL)
-       @list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
-       for p in $$list; do \
-         if test -f $$p; then \
-?BASE?     $(am__strip_dir) \
-?!BASE?            f=$$p; \
+?BASE? @list='$(notdir $(%DIR%_LIBRARIES))'; \
+?!BASE?        @list='$(%DIR%_LIBRARIES)'; \
+       test -n "$(%NDIR%dir)" || list=; \
+       for f in $$list; do \
+         if test -f $$f; then \
 ## Must ranlib after installing because mod time changes.
 ## cd to target directory because AIX ranlib messes up with whitespace
 ## in the argument.
index c6fb923335baa1d5dba58bb25d9fa578fa290838..7135e3aeb5b59c206bb4ea288d904d90af6b0e09 100644 (file)
@@ -61,25 +61,21 @@ install-%DIR%LISP: $(%DIR%_LISP) $(ELCFILES)
        @if test "$(EMACS)" != no && test -n "$(%NDIR%dir)"; then \
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
-         list='$(%DIR%_LISP)'; \
-         if test -n "$$list"; then \
+         $(if $(%DIR%_LISP), \
            echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
            $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
-         fi; \
-         for p in $$list; do \
-## A lisp file can be in the source directory or the build directory.
-           if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-?BASE?     $(am__strip_dir) \
-?!BASE?            f=$$p; \
-           echo " $(%DIR%LISP_INSTALL) '$$d$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-           $(%DIR%LISP_INSTALL) "$$d$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
+           $(foreach i, $(%DIR%_LISP), \
+             p=$(call am.vpath.rewrite,$i); \
+?BASE?       f=$(notdir $i); \
+?!BASE?              f=$i; \
+             echo " $(%DIR%LISP_INSTALL) '$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
+             $(%DIR%LISP_INSTALL) "$$p" "$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
 ## Only install .elc file if it exists.
-           if test -f $${p}c; then \
-             echo " $(%DIR%LISP_INSTALL) '$${p}c' '$(DESTDIR)$(%NDIR%dir)/$${f}c'"; \
-             $(%DIR%LISP_INSTALL) "$${p}c" "$(DESTDIR)$(%NDIR%dir)/$${f}c" || exit $$?; \
-           else : ; fi; \
-         done; \
-       else : ; fi
+             if test -f $${p}c; then \
+               echo " $(%DIR%LISP_INSTALL) '$${p}c' '$(DESTDIR)$(%NDIR%dir)/$${f}c'"; \
+               $(%DIR%LISP_INSTALL) "$${p}c" "$(DESTDIR)$(%NDIR%dir)/$${f}c" || exit $$?; \
+             else : ; fi;)) \
+         :; else :; fi;
 endif %?INSTALL%
 
 
index d80b66f7862e78da61abed13380183591c30ede6..543f7dc72ee28f2f565d747697a3815c4966ad44 100644 (file)
@@ -87,10 +87,10 @@ if %?INSTALL%
 .PHONY uninstall-am: uninstall-%DIR%LTLIBRARIES
 uninstall-%DIR%LTLIBRARIES:
        @$(NORMAL_UNINSTALL)
-       @list='$(%DIR%_LTLIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
-       for p in $$list; do \
-?BASE?   $(am__strip_dir) \
-?!BASE?          f=$$p; \
+?BASE? @list='$(notdir $(%DIR%_LTLIBRARIES))'; \
+?!BASE?        @list='$(%DIR%_LTLIBRARIES)'; \
+       test -n "$(%NDIR%dir)" || list=; \
+       for f in $$list; do \
 ?LIBTOOL?        echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
 ?LIBTOOL?        $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(%NDIR%dir)/$$f"; \
 ?!LIBTOOL?       echo " rm -f '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
index 2ac22ccc2721ddc80ef793a4046119fca6db0dcb..c99d42c379fdb1dcb176371e51ab1f402c9ff04e 100644 (file)
@@ -26,24 +26,12 @@ am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
 ?!EXEC?.PHONY install-data-am: install-%DIR%PYTHON
 install-%DIR%PYTHON: $(%DIR%_PYTHON)
        @$(NORMAL_INSTALL)
+       @$(if $(and $(%NDIR%dir),$(%DIR%_PYTHON)),$(strip \
+          )$(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)")
 if %?BASE%
-       @list='$(%DIR%_PYTHON)'; dlist=; list2=; test -n "$(%NDIR%dir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
-       fi; \
-       for p in $$list; do \
-## A file can be in the source directory or the build directory.
-         if test -f "$$p"; then b=; else b="$(srcdir)/"; fi; \
-         if test -f $$b$$p; then \
-## Compute basename of source file.  Unless this is a nobase_ target, we
-## want to install 'python/foo.py' as '$(DESTDIR)$(%NDIR%dir)/foo.py',
-## not '$(DESTDIR)$(%NDIR%dir)/python/foo.py'.
-           $(am__strip_dir) \
-           dlist="$$dlist $$f"; \
-           list2="$$list2 $$b$$p"; \
-         else :; fi; \
-       done; \
+       @test -n "$(%NDIR%dir)" && test -n "$(%DIR%_PYTHON)" || exit 0; \
+       dlist='$(notdir $(%DIR%_PYTHON))'; \
+       list2='$(foreach i,$(%DIR%_PYTHON),$(call am.vpath.rewrite,$i))'; \
        for file in $$list2; do echo $$file; done | $(am__base_list) | \
        while read files; do \
 ## Don't perform translation, since script name is important.
@@ -58,10 +46,6 @@ if %?BASE%
        else :; fi
 else !%?BASE%
        @list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \
-       if test -n "$$list"; then \
-         echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)'"; \
-         $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)" || exit 1; \
-       fi; \
        $(am__nobase_list) | while read dir files; do \
          xfiles=; for p in $$files; do \
 ## A file can be in the source directory or the build directory.
index 71c497ad891f69c373b3abf9fbe4bf29dd4ec51a..116053ccf00c027611ce625fe6dda508a9e34a3f 100644 (file)
@@ -135,26 +135,19 @@ install-html-am: am--install-html
 am--install-html: $(HTMLS)
        @$(NORMAL_INSTALL)
        $(call am__create_installdir,$(htmldir))
-       @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
-       for p in $$list; do \
-         if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         $(am__strip_dir) \
-## This indirection is required to work around a bug of the Solaris 10
-## shell /usr/xpg4/bin/sh.  The description of the bug can be found at
-## <http://lists.gnu.org/archive/html/bug-autoconf/2011-11/msg00005.html>
-## and the report of the original failure can be found at automake
-## bug#10026 <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=10026#23>
-         d2=$$d$$p; \
-         if test -d "$$d2"; then \
+       @list=''; \
+       $(if $(and $(HTMLS),$(htmldir)),$(foreach i,$(HTMLS), \
+         p=$(call am.vpath.rewrite,$i); \
+         f=$(notdir $i); \
+         if test -d "$$p"; then \
            echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
            $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
-           echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
-           $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
+           echo " $(INSTALL_DATA) '$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \
+           $(INSTALL_DATA) "$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
          else \
-           list2="$$list2 $$d2"; \
-         fi; \
-       done; \
-       test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
+           list="$$list $$p"; \
+         fi;)) \
+       test -z "$$list" || { echo "$$list" | $(am__base_list) | \
        while read files; do \
          echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
          $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \