From 9d595099372e2eabbecce2f303058743e93f0748 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Wed, 21 May 2008 23:08:11 +0200 Subject: install many binaries at once, when possible * src/Makefile.am (install-exec-am): Override the standard automake-generated target, so we can decide whether to use the usual install-one-by-one rule, or whether we can use the new install-many-at-once rule: (cu-install-binPROGRAMS): New rule. --- src/Makefile.am | 35 ++++++++++++++++++++++++++++++++++- 1 file changed, 34 insertions(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index c8cfe5eee..8e0091fbd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -218,7 +218,7 @@ copy_sources = copy.c cp-hash.c # confusion with the `install' target. The install rule transforms `ginstall' # to install before applying any user-specified name transformations. -transform = s/ginstall/install/; @program_transform_name@ +transform = s/ginstall/install/; $(program_transform_name) ginstall_SOURCES = install.c prog-fprintf.c $(copy_sources) # This is for the '[' program. Automake transliterates '[' to '_'. @@ -427,3 +427,36 @@ sc_tight_scope: $(all_programs) | grep -Ev -f $$t && \ { echo 'the above variables should have static scope' 1>&2; \ exit 1; } || : + +.PHONY: cu-install-binPROGRAMS +install-exec-am: + @case '$(program_transform_name):$(EXEEXT)' in \ + 's,x,x,:') cu=cu-;; *) cu= ;; esac; \ + $(MAKE) $(AM_MAKEFLAGS) binPROGRAMS_INSTALL=./ginstall \ + $${cu}install-binPROGRAMS + @$(NORMAL_INSTALL) + $(MAKE) $(AM_MAKEFLAGS) install-exec-hook + +# The following rule is used only when --program-transform-name +# has not been used and there is no .exe "extension". +# Override the automake-generated rule so that we can install +# all binaries with a single install command. However, ... +# install ginstall and [ separately. "ginstall" because we rename +# it to "install", and "[" because using it unquoted will cause a +# syntax error with some shells. Be careful to install each of these +# exceptions only if it is to be installed (i.e., not excluded via +# --enable-no-install-program=PROG_LIST. +filtered_PROGS = \ + `echo "$(bin_PROGRAMS)" | sed 's/ *\ */ /;s/ *\[ */ /'` +d_bindir = $(DESTDIR)$(bindir) +cu-install-binPROGRAMS: $(bin_PROGRAMS) + $(NORMAL_INSTALL) + test -z "$(bindir)" || $(MKDIR_P) "$(d_bindir)" + test x = 'x$(bin_PROGRAMS)' && exit || : + case '$(bin_PROGRAMS)' in *\[*) \ + echo "$(binPROGRAMS_INSTALL) '[' '$(d_bindir)/['"; \ + $(binPROGRAMS_INSTALL) '[' '$(d_bindir)/[';; esac + case '$(bin_PROGRAMS)' in *ginstall*) \ + echo "$(binPROGRAMS_INSTALL) ginstall '$(d_bindir)/install'";\ + $(binPROGRAMS_INSTALL) ginstall '$(d_bindir)/install';; esac + $(binPROGRAMS_INSTALL) $(filtered_PROGS) '$(d_bindir)' -- cgit v1.2.3-70-g09d2