automake-patches
[Top][All Lists]
Advanced

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

Faster install for libtool outputs.


From: Ralf Wildenhues
Subject: Faster install for libtool outputs.
Date: Sat, 13 Sep 2008 09:46:47 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

Hmm, apparently I failed to notice that `libtool --mode=install' doesn't
mind being invoked for multiple files at once, even with libtool 1.5.x.
This makes the rules more consistent with the rest (never mind the
apparent increased duplication in ltlib.am).  Pushed.

Cheers,
Ralf

    Faster install for libtool outputs.

    * lib/am/ltlib.am (install-%DIR%LTLIBRARIES): Invoke `libtool
    --mode=install' with multiple libraries at once.
    (%DIR%LTLIBRARIES_INSTALL): No need to use install_sh any more.
    * lib/am/progs.am (install-%DIR%PROGRAMS): Likewise, remove much
    of the libtool special-casing by invoking it for multiple
    programs at once.

diff --git a/lib/am/ltlib.am b/lib/am/ltlib.am
index 3637ea0..7afc657 100644
--- a/lib/am/ltlib.am
+++ b/lib/am/ltlib.am
@@ -25,29 +25,50 @@ endif %?INSTALL%
 
 if %?INSTALL%
 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
-%DIR%LTLIBRARIES_INSTALL = %BASE?$(INSTALL):$(install_sh) -c%
+%DIR%LTLIBRARIES_INSTALL = $(INSTALL)
 .PHONY install-%EXEC?exec:data%-am: install-%DIR%LTLIBRARIES
 install-%DIR%LTLIBRARIES: $(%DIR%_LTLIBRARIES)
        @$(NORMAL_INSTALL)
        test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
+if %?BASE%
 ## Funny invocation because Makefile variable can be empty, leading to
 ## a syntax error in sh.
-       @list='$(%DIR%_LTLIBRARIES)'; for p in $$list; do \
+       @list='$(%DIR%_LTLIBRARIES)'; list2=; for p in $$list; do \
          if test -f $$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.yo',
-## not '$(DESTDIR)$(%NDIR%dir)/python/foo.yo'.
-           %BASE?$(am__strip_dir):f=$$p;% \
+           list2="$$list2 $$p"; \
+         else :; fi; \
+       done; \
+       test -z "$$list2" || { \
 ## Note that we explicitly set the libtool mode.  This avoids any lossage
 ## if the program doesn't have a name that libtool expects.
 ## Use INSTALL and not INSTALL_DATA because libtool knows the right
 ## permissions to use.
-?LIBTOOL?          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) 
--mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' 
'$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-?LIBTOOL?          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) 
--mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" 
"$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
-?!LIBTOOL?         echo " $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) 
'$$p' '$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-?!LIBTOOL?         $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" 
"$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
-         else :; fi; \
+?LIBTOOL?        echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) 
--mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$list2 
'$(DESTDIR)$(%NDIR%dir)'"; \
+?LIBTOOL?        $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install 
$(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$list2 
"$(DESTDIR)$(%NDIR%dir)"; \
+?!LIBTOOL?       echo " $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) 
$$list '$(DESTDIR)$(%NDIR%dir)'"; \
+?!LIBTOOL?       $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$list 
"$(DESTDIR)$(%NDIR%dir)"; \
+       }
+else !%?BASE%
+       @list='$(%DIR%_LTLIBRARIES)'; $(am__nobase_list) | \
+       while read dir files; do \
+         xfiles=; for p in $$files; do \
+           if test -f "$$p"; then xfiles="$$xfiles $$p"; else :; fi; done; \
+         test -z "$$xfiles" || { \
+           test "x$$dir" = x. || { \
+             echo "$(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+             $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir"; }; \
+
+## Note that we explicitly set the libtool mode.  This avoids any lossage
+## if the program doesn't have a name that libtool expects.
+## Use INSTALL and not INSTALL_DATA because libtool knows the right
+## permissions to use.
+?LIBTOOL?          echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) 
--mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$xfiles 
'$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+?LIBTOOL?          $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) 
--mode=install $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$xfiles 
"$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
+?!LIBTOOL?         echo " $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) 
$$xfiles '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+?!LIBTOOL?         $(%DIR%LTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$xfiles 
"$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
+         }; \
        done
+endif !%?BASE%
 endif %?INSTALL%
 
 
diff --git a/lib/am/progs.am b/lib/am/progs.am
index 2a7778c..28505cf 100644
--- a/lib/am/progs.am
+++ b/lib/am/progs.am
@@ -46,36 +46,30 @@ install-%DIR%PROGRAMS: $(%DIR%_PROGRAMS)
 ?!BASE?            -e 's|[^/]*$$||; s|^$$|.|' \
            -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \
        sed 'N;N;N;s,\n, ,g' | \
-## Note that we explicitly set the libtool mode.  This avoids any
-## lossage if the install program doesn't have a name that libtool
-## expects.
-?LIBTOOL?      while read p pbase dir f; do \
-?LIBTOOL??!BASE?         if test "$$dir" != .; then f=$$dir/$$f; \
-?LIBTOOL??!BASE?           echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-?LIBTOOL??!BASE?           $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit 
$$?; \
-?LIBTOOL??!BASE?         else :; fi; \
-?LIBTOOL?        echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) '$$p' 
'$(DESTDIR)$(%NDIR%dir)/$$f'"; \
-?LIBTOOL?        $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) "$$p" 
"$(DESTDIR)$(%NDIR%dir)/$$f" || exit $$?; \
-?LIBTOOL?      done
 ## The following awk script turns that into one line containing directories
 ## and then lines of `target_name_or_directory sources...'.
-?!LIBTOOL?     $(AWK) 'BEGIN { files["."] = ""; dirs["."] = "" } { \
-?!LIBTOOL?       if ($$2 == $$4) tgt = $$3; else tgt = $$3 "/" $$4; \
-?!LIBTOOL?       files[tgt] = files[tgt] " " $$1; dirs[$$3] = 1 } \
-?!LIBTOOL?       END { d=""; for (dir in dirs) d = d " " dir; print d; \
-?!LIBTOOL?             for (dir in files) print dir, files[dir] }' | { \
-?!LIBTOOL?     read dirs; \
-?!LIBTOOL??!BASE?      for dir in $$dirs; do test . = $$dir || { \
-?!LIBTOOL??!BASE?        echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
-?!LIBTOOL??!BASE?        $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit 
$$?; \
-?!LIBTOOL??!BASE?      }; done; \
-?!LIBTOOL?     while read dir files; do \
-?!LIBTOOL?       if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
-?!LIBTOOL?       test -z "$$files" || { \
+       $(AWK) 'BEGIN { files["."] = ""; dirs["."] = "" } { \
+         if ($$2 == $$4) tgt = $$3; else tgt = $$3 "/" $$4; \
+         files[tgt] = files[tgt] " " $$1; dirs[$$3] = 1 } \
+         END { d=""; for (dir in dirs) d = d " " dir; print d; \
+               for (dir in files) print dir, files[dir] }' | { \
+       read dirs; \
+?!BASE?        for dir in $$dirs; do test . = $$dir || { \
+?!BASE?          echo " $(MKDIR_P) '$(DESTDIR)$(%NDIR%dir)/$$dir'"; \
+?!BASE?          $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)/$$dir" || exit $$?; \
+?!BASE?        }; done; \
+       while read dir files; do \
+         if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \
+         test -z "$$files" || { \
 ?!LIBTOOL?         echo " $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) 
$$files '$(DESTDIR)$(%NDIR%dir)$$dir'"; \
 ?!LIBTOOL?         $(INSTALL_PROGRAM_ENV) $(%DIR%PROGRAMS_INSTALL) $$files 
"$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
-?!LIBTOOL?       }; \
-?!LIBTOOL?     done; }
+## Note that we explicitly set the libtool mode.  This avoids any
+## lossage if the install program doesn't have a name that libtool
+## expects.
+?LIBTOOL?        echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) $$files 
'$(DESTDIR)$(%NDIR%dir)$$dir'"; \
+?LIBTOOL?        $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) 
$(LIBTOOLFLAGS) --mode=install $(%DIR%PROGRAMS_INSTALL) $$files 
"$(DESTDIR)$(%NDIR%dir)$$dir" || exit $$?; \
+         }; \
+       done; }
 endif %?INSTALL%
 
 




reply via email to

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