automake
[Top][All Lists]
Advanced

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

Re: automake generates delete targets twice


From: Ralf Wildenhues
Subject: Re: automake generates delete targets twice
Date: Sun, 7 Sep 2008 10:49:25 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hello Toralf,

* Ralf Wildenhues wrote on Wed, Jul 30, 2008 at 09:02:01PM CEST:
> * Toralf Förster wrote on Wed, Jul 30, 2008 at 09:26:10AM CEST:
> > 
> > regarding to https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=2749 I'm
> > wondering whether at UNIX systems automake could be improved to delete a 
> > target
> > only once.

> AFAICS this is an optimization issue only, not a bug per se.
> I haven't measured, but I bet such an optimization would
> not improve "make clean" time even measureably.
> Prove me wrong and we may have a case.  ;-)
> 
> Hmm, maybe the code will get faster if we avoid the sed
> script when $(EXEEXT) is empty ... will look into that.

Here we go with faster 'make clean' for PROGRAMS with libtool.
Applied to master, and put you in THANKS.

This isn't pressing to go into branch-1-10.

Cheers,
Ralf

2008-09-07  Ralf Wildenhues  <address@hidden>

        Enhance cleaning of programs in libtool mode.
        * lib/am/progs.am (clean-%DIR%PROGRAMS) [?LIBTOOL?]: Fork less
        often, avoid removing programs twice if $(EXEEXT) is empty.
        * tests/nobase-libtool.test: Also test PROGRAMS, in order to
        exercise the code path.
        * THANKS: Update.
        Report by Toralf Förster.

diff --git a/lib/am/progs.am b/lib/am/progs.am
index cc4cf4a..24fd10f 100644
--- a/lib/am/progs.am
+++ b/lib/am/progs.am
@@ -92,11 +92,13 @@ clean-%DIR%PROGRAMS:
 ## Cleaning the `_libs/' or `.libs/' directory is done from clean-libtool.
 ## FIXME: In the future (i.e., when it works) it would be nice to delegate
 ## this task to `libtool --mode=clean'.
-?LIBTOOL?      @list='$(%DIR%_PROGRAMS)'; for p in $$list; do \
-?LIBTOOL?        f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-?LIBTOOL?        echo " rm -f $$p $$f"; \
-?LIBTOOL?        rm -f $$p $$f ; \
-?LIBTOOL?      done
+?LIBTOOL?      @list='$(%DIR%_PROGRAMS)'; test -n "$$list" || exit 0; \
+?LIBTOOL?      echo " rm -f" $$list; \
+?LIBTOOL?      rm -f $$list || exit $$?; \
+?LIBTOOL?      test -n "$(EXEEXT)" || exit 0; \
+?LIBTOOL?      list=`for p in $$list; do echo "$$p"; done | sed 
's/$(EXEEXT)$$//'`; \
+?LIBTOOL?      echo " rm -f" $$list; \
+?LIBTOOL?      rm -f $$list
 
 
 ## ---------- ##
diff --git a/tests/nobase-libtool.test b/tests/nobase-libtool.test
index bb027c6..4da415b 100755
--- a/tests/nobase-libtool.test
+++ b/tests/nobase-libtool.test
@@ -15,7 +15,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure nobase_* works for libtool libraries as well.
+# Make sure nobase_* works for libtool libraries and programs as well.
 # This is just the libtool equivalent of nobase.test, split
 # up for greater exposure of nobase.test.
 
@@ -34,8 +34,12 @@ cat > Makefile.am << 'EOF'
 fooexecdir = $(prefix)/foo
 fooexec_LTLIBRARIES = sub/libbase.la
 nobase_fooexec_LTLIBRARIES = sub/libnobase.la
+fooexec_PROGRAMS = sub/base
+nobase_fooexec_PROGRAMS = sub/nobase
 sub_libbase_la_SOURCES = source2.c
 sub_libnobase_la_SOURCES = source2.c
+sub_base_SOURCES = source.c
+sub_nobase_SOURCES = source.c
 
 test-install-data: install-data
        test ! -f inst/foo/sub/libnobase.la
@@ -49,13 +53,14 @@ EOF
 
 mkdir sub
 
-cat >source2.c <<'EOF'
+cat >source.c <<'EOF'
 int
 main (int argc, char *argv[])
 {
   return 0;
 }
 EOF
+cp source.c source2.c
 
 rm -f install-sh
 




reply via email to

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