From: Ralf Wildenhues Date: Sat, 13 Sep 2008 07:32:13 +0000 (+0200) Subject: Faster install for libtool outputs. X-Git-Tag: v1.10b~106 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=7726a26a5337ae0215f77295503ecd7b21369f2a;p=thirdparty%2Fautomake.git 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. Signed-off-by: Ralf Wildenhues --- diff --git a/ChangeLog b/ChangeLog index 6cdaa973c..8dfc89318 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2008-09-13 Ralf Wildenhues + + 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. + 2008-09-07 Ralf Wildenhues Fast install and uninstall for SCRIPTS. diff --git a/lib/am/ltlib.am b/lib/am/ltlib.am index 3637ea05d..7afc657af 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 2a7778caa..28505cf84 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%