From: Stefano Lattarini Date: Tue, 7 May 2013 13:27:21 +0000 (+0200) Subject: Merge branch 'master' into ng/master X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=9b183694a14f5eb93c1aee0d1fb5dcc7c7acbd30;p=thirdparty%2Fautomake.git Merge branch 'master' into ng/master * master: docs: fix warnings given by Texinfo 5.x fixlet: remove leftover comment fragment master branch: we are going to become Automake 2.0 maint branch: we are going to become Automake 1.14 maint: version bump after beta release 1.13.1d release: beta release 1.13.1d (will become 1.13.2) NEWS: document more robust handling/recognition of make options tests: typofixes in comments in t/preproc-c-compile.sh tests: remove bashism from a test maint: targets and recipes to simplify testing on real-world packages build: preparatory refactoring build: tiny reduction in code duplication make flags analysis: handle more options with args make flags analysis: use simpler variable names make flags analysis: whitespace changes make flags analysis: embed in a subshell make flags analysis: be more robust make flags analysis: cater to GNU make 3.83 (still unreleased as of now) tests: expose weaknesses in make flags analysis tests: improve debugging output in checks on make flags analysis make flags analysis: refactor, to reduce code duplication tests: avoid one tricky use of "make -e" cosmetics: remove few trailing whitespace occurrences typofix: in NEWS (extra whitespace) compat: substitute '@mkdir_p@' as '$(MKDIR_P)' unconditionally tests: avoid a spurious error with Solaris make subdirs: don't return false positives for the '-k' option's presence header-vars: recognize more make flags ('-k' in particular) header-vars: simplify how make flags are determined tests: remove dead code from t/make-dryrun.tap header-vars: new variable $(am__running_with_option) tests: expose bug#12554 (false positives for presence of '-k' make option) Signed-off-by: Stefano Lattarini --- 9b183694a14f5eb93c1aee0d1fb5dcc7c7acbd30 diff --cc Makefile.am index 227fe646d,3933497cc..60bfca221 --- a/Makefile.am +++ b/Makefile.am @@@ -61,10 -70,13 +61,15 @@@ EXTRA_DIST += bootstrap.sh \ GNUmakefile \ HACKING \ - PLANS + NG-NEWS \ + PLANS \ + $(gitlog_to_changelog_fixes) + # For some tests or targets, we need to have the just-build automake and + # aclocal scripts avaiable on PATH. + extend_PATH = \ + { PATH='$(abs_builddir)/t/wrap'$(PATH_SEPARATOR)$$PATH && export PATH; } + # Make versioned links. We only run the transform on the root name; # then we make a versioned link with the transformed base name. This # seemed like the most reasonable approach. @@@ -595,21 -600,22 +600,20 @@@ doc_automake_ng_TEXINFOS = doc/fdl.tex CLEANFILES += $(man1_MANS) EXTRA_DIST += doc/help2man -update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ - && $(extend_PATH) \ - && $(PERL) $(srcdir)/doc/help2man --output=$@ +man1_MANS = $(versioned_mans) $(unversioned_mans) + +unversioned_mans = doc/aclocal.1 doc/automake.1 +versioned_mans = doc/aclocal-$(APIVERSION).1 doc/automake-$(APIVERSION).1 -doc/aclocal.1 doc/automake.1: - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ - && f=`echo $@ | sed 's|.*/||; s|\.1$$||; $(transform)'` \ +$(unversioned_mans): Makefile + $(AM_V_GEN)$(MKDIR_P) doc \ + && f=`echo $(@D) | sed 's|.*/||; s|\.1$$||; $(transform)'` \ && echo ".so man1/$$f-$(APIVERSION).1" > $@ -doc/aclocal-$(APIVERSION).1: aclocal.in aclocal lib/Automake/Config.pm - $(update_mans) aclocal-$(APIVERSION) -doc/automake-$(APIVERSION).1: automake.in automake lib/Automake/Config.pm - $(update_mans) automake-$(APIVERSION) +$(versioned_mans): doc/%-$(APIVERSION).1: % lib/Automake/Config.pm + $(AM_V_GEN)$(MKDIR_P) doc \ - && PATH="$(abs_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \ - && export PATH \ ++ && $(extend_PATH) \ + && $(PERL) $(srcdir)/doc/help2man --output=$@ $*-$(APIVERSION) ## ---------------------------- ## @@@ -638,22 -643,25 +642,25 @@@ amhello_configury = dist_noinst_DATA += $(amhello_sources) dist_doc_DATA = $(srcdir)/doc/amhello-1.0.tar.gz + setup_autotools_paths = { \ + $(extend_PATH) \ + && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \ + && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \ + && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \ + && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \ + && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \ + && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \ + && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \ + && true; \ + } + # We depend on configure.ac so that we regenerate the tarball # whenever the Automake version changes. - # aclocal-$(APIVERSION) and automake-$(APIVERSION) are generated by - # configure in 't/wrap'. $(srcdir)/doc/amhello-1.0.tar.gz: $(amhello_sources) $(srcdir)/configure.ac $(AM_V_GEN)tmp=amhello-output.tmp \ - && PATH="$(abs_top_builddir)/t/wrap$(PATH_SEPARATOR)$$PATH" \ - && export PATH \ - && $(am__cd) $(srcdir)/doc/amhello \ + && cd $(srcdir)/doc/amhello \ - && ACLOCAL=aclocal-$(APIVERSION) && export ACLOCAL \ - && AUTOMAKE=automake-$(APIVERSION) && export AUTOMAKE \ - && AUTOCONF='$(am_AUTOCONF)' && export AUTOCONF \ - && AUTOM4TE='$(am_AUTOM4TE)' && export AUTOM4TE \ - && AUTORECONF='$(am_AUTORECONF)' && export AUTORECONF \ - && AUTOHEADER='$(am_AUTOHEADER)' && export AUTOHEADER \ - && AUTOUPDATE='$(am_AUTOUPDATE)' && export AUTOUPDATE \ + && : Make our aclocal and automake avaiable before system ones. \ + && $(setup_autotools_paths) \ && ( \ { $(AM_V_P) || exec 5>&2 >$$tmp 2>&1; } \ && $(am_AUTORECONF) -vfi \ diff --cc configure.ac index 0d07f03e8,497c2b7a1..49a83bd28 --- a/configure.ac +++ b/configure.ac @@@ -16,7 -16,7 +16,7 @@@ # along with this program. If not, see . AC_PREREQ([2.69]) - AC_INIT([GNU Automake-NG], [1.13a], [automake-ng@gnu.org]) -AC_INIT([GNU Automake], [1.99a], [bug-automake@gnu.org]) ++AC_INIT([GNU Automake], [1.99a], [automake-ng@gnu.org]) AC_CONFIG_SRCDIR([automake.in]) AC_CONFIG_AUX_DIR([lib]) diff --cc lib/am/header-vars.mk index 3fa7ddf0d,000000000..d31bb605f mode 100644,000000..100644 --- a/lib/am/header-vars.mk +++ b/lib/am/header-vars.mk @@@ -1,427 -1,0 +1,512 @@@ +## automake - create Makefile.in from Makefile.am +## Copyright (C) 1994-2013 Free Software Foundation, Inc. + +## This program is free software; you can redistribute it and/or modify +## it under the terms of the GNU General Public License as published by +## the Free Software Foundation; either version 2, or (at your option) +## any later version. + +## This program is distributed in the hope that it will be useful, +## but WITHOUT ANY WARRANTY; without even the implied warranty of +## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +## GNU General Public License for more details. + +## You should have received a copy of the GNU General Public License +## along with this program. If not, see . + +# Makefiles generated by Automake-NG require GNU make >= 3.81. +# The .FEATURES special variable has been introduced in that make +# version, so use it as a witness to determine whether the current +# make is good enough. +ifndef .FEATURES + $(error Automake-NG based builds require GNU make 3.81 or later) +endif + +VPATH = $(srcdir) + +# Enhance performance by removing GNU make builtin rules that would be +# rather irrelevant (e.g., rules to automatically check out files from +# from RCS or SCCS repositories), or overridden by Automake (e.g., rules +# to compile C or C++ files). For larger packages (like GNU coreutils), +# this can greatly speed up null or almost-null builds, up to even 50%! +MAKEFLAGS += --no-builtin-rules + +# For when we need a do-nothing target. Add an actual rule to it to avoid +# the annoying message "make[1]: Nothing to be done for .am/nil" from make. +.PHONY: .am/nil +.am/nil: + @: + +# Declare an error, without immediately terminating the execution (proper +# code will take care later of that). This will allow us to diagnose more +# issues at once, rather than stopping at the first one. +am.error.seen := +define am.error +$(warning $1)$(eval am.error.seen := yes) +endef + +# Declare an error, and immediately terminate execution. +define am.fatal +$(if $1,$(call am.error,$1))$(error Some Automake-NG error occurred) +endef + +# +# Sometimes, in our makefiles, we want to assign a default value to a +# variable that might not have been assigned yet. One might think that +# using the GNU make assignment '?=' is enough: +# +# VAR ?= DEFAULT-VALUE +# +# But alas, such a usage allows interferences from the environment; i.e., +# if an environment variable named 'VAR' is defined to, say, BAD-VALUE, +# the construct above will result in the $(VAR) make variable being +# defined to BAD-VALUE, not to DEFAULT-VALUE. +# +# Use the 'am.vars.is-undef' function to avoid this situation. It tells +# whether the given make variable is not "safely" defined, i.e., either +# undefined, or defined to a value that is inherited from the environment. +# +# With such a tool, we can safely declare default values for variables +# that avoids environmental interferences, as follow: +# +# ifeq ($(call am.vars.is-undef,VAR),yes) +# VAR = DEFAULT-VALUE +# endif +# +define am.vars.is-undef +$(if $(filter undefined environment,$(origin $(strip $1))),yes) +endef + +# Some problematic characters (especially when used in arguments +# to make functions, or for syntax highlighting). +am.chars.bslash := \\ +am.chars.comma := , +am.chars.dollar := $$ +am.chars.hash := \# +am.chars.lparen := ( +am.chars.rparen := ) +am.chars.bquote := ` +am.chars.dquote := " +am.chars.squote := ' +# "` # Fix font-lock. + +# An empty string. It can be very useful to "fool" the make parser w.r.t. +# whitespace handling, and allow us to obtain tricky semantics. See the +# definition of $(am.chars.newline) just below for a significant example. +am.chars.empty := + +# A single whitespace. +am.chars.space := $(am.chars.empty) $(am.chars.empty) + +# A single tabulation character. +am.chars.tab := $(am.chars.empty) $(am.chars.empty) + +# A literal newline character, that does not get stripped if used +# at the end of the expansion of another macro. +define am.chars.newline + +$(am.chars.empty) +endef + +# Neutralize unwarranted environment settings that might interfere with +# our Makefiles. +ifeq ($(call am.vars.is-undef,SUBDIRS),yes) + SUBDIRS := +endif +ifeq ($(call am.vars.is-undef,EXEEXT),yes) + EXEEXT := +endif + +# CDPATH is only useful in interactive usage, and should never be exported +# in the environment; doing so could cause our recipes and scripts to chdir +# to unexpected places, causing all sort of hard to reproduce mayhem. +# Still, but some people nonetheless export CDPATH (or did so in the past), +# so to be extra safe we have to neutralize it. +unexport CDPATH + +# Be verbose by default. Yes, we really want $(V) to be overridable +# from the environment, both for simplicity and for consistency with +# mainline Automake. +# FIXME: maybe normalize/sanitize $(V)? +V ?= 0 + +# In a recipe, ensure the given directory exists, creating it if +# necessary; but tries to do so avoiding useless forks, stats, and +# extra recipe text (the latter is useful when doing "make V=1"). +# If the target has no directory component, or if the parent +# directory of the target already exists, we have nothing to do, so +# try to optimize for those cases -- especially because, for our +# usage patterns, one of them should always be true in non-VPATH +# builds. +am.cmd.ensure-dir-exists = \ + $(if $(filter .,$1),:,$(if $(wildcard $1/),:,$(MKDIR_P) $1)) + +# Ensure the directory containing the target of the current recipe +# exists, by creating it if necessary. +am.cmd.ensure-target-dir-exists = $(call am.cmd.ensure-dir-exists,$(@D)) + +# The 'all' target must be the default one, independently from the +# position it is declared in the output Makefile. +.DEFAULT_GOAL := all + +# Emulate VPATH rewrites. This uses only GNU make primitives, which +# allows us to avoid extra forks. +am.vpath.rewrite = \ + $(firstword $(wildcard $(strip $(1))) $(srcdir)/$(strip $(1))) + - # make this overridable from the environment, for better compatibility ++# Leave this overridable from the environment, for better compatibility +# with mainline Automake. +DESTDIR ?= + +# Tell whether make is running in "dry mode". It is either 'true' or +# 'false', so that it can be easily used in shell code as well as in +# GNU make conditionals. Use $(MFLAGS), not $(MAKEFLAGS), since the +# former doesn't containing the command line variable definitions, and +# it always begins with a hyphen unless it is empty, assumptions that +# allow a simpler implementation. +am.make.dry-run := \ + $(if $(findstring n,$(filter-out --%,$(MFLAGS))),true,false) + ++## Shell code that determines whether we are running under GNU make. ++## This is somewhat of an hack, and might be improved, but is good ++## enough for now. ++## FIXME: copied over from mainline Automake. This should be later ++## discarder! ++am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)' ++ ++## FIXME: copied over from mainline Automake. Rewrite to be GNU make ++## specific, please! ++## Shell code that determines whether the current make instance is ++## running with a given one-letter option (e.g., -k, -n) that takes ++## no argument. Actually, the only supported option at the moment ++## is '-n' (support for '-k' will be added soon). ++am__make_running_with_option = \ ++ case $${target_option-} in \ ++ ?) ;; \ ++ *) echo "am__make_running_with_option: internal error: invalid" \ ++ "target option '$${target_option-}' specified" >&2; \ ++ exit 1;; \ ++ esac; \ ++ has_opt=no; \ ++ sane_makeflags=$$MAKEFLAGS; \ ++ if $(am__is_gnu_make); then \ ++## The format of $(MAKEFLAGS) is quite tricky with GNU make; the ++## variable $(MFLAGS) behaves much better in that regard. So use it. ++ sane_makeflags=$$MFLAGS; \ ++ else \ ++## Non-GNU make: we must rely on $(MAKEFLAGS). This is tricker and more ++## brittle, but is the best we can do. ++ case $$MAKEFLAGS in \ ++## If we run "make TESTS='snooze nap'", FreeBSD make will export MAKEFLAGS ++## to " TESTS=foo\ nap", so that the simpler loop below (on word-splitted ++## $$MAKEFLAGS) would see a "make flag" equal to "nap", and would wrongly ++## misinterpret that as and indication that make is running in dry mode. ++## This has already happened in practice. So we need this hack. ++ *\\[\ \ ]*) \ ++## Extra indirection with ${bs} required by FreeBSD 8.x make. ++## Not sure why (so sorry for the cargo-cult programming here). ++ bs=\\; \ ++ sane_makeflags=`printf '%s\n' "$$MAKEFLAGS" \ ++ | sed "s/$$bs$$bs[$$bs $$bs ]*//g"`;; \ ++ esac; \ ++ fi; \ ++ skip_next=no; \ ++ strip_trailopt () \ ++ { \ ++ flg=`printf '%s\n' "$$flg" | sed "s/$$1.*$$//"`; \ ++ }; \ ++ for flg in $$sane_makeflags; do \ ++ test $$skip_next = yes && { skip_next=no; continue; }; \ ++ case $$flg in \ ++ *=*|--*) continue;; \ ++## ++## GNU make 3.83 has changed the format of $MFLAGS, and removed the space ++## between an option and its argument (e.g., from "-I dir" to "-Idir"). ++## So we need to handle both formats, at least for options valid in GNU ++## make. OTOH, BSD make formats $(MAKEFLAGS) by separating all options, ++## and separating any option from its argument, so things are easier ++## there. ++## ++## For GNU make and BSD make. ++ -*I) strip_trailopt 'I'; skip_next=yes;; \ ++ -*I?*) strip_trailopt 'I';; \ ++## For GNU make >= 3.83. ++ -*O) strip_trailopt 'O'; skip_next=yes;; \ ++ -*O?*) strip_trailopt 'O';; \ ++## For GNU make (possibly overkill, this one). ++ -*l) strip_trailopt 'l'; skip_next=yes;; \ ++ -*l?*) strip_trailopt 'l';; \ ++## For BSD make. ++ -[dEDm]) skip_next=yes;; \ ++## For NetBSD make. ++ -[JT]) skip_next=yes;; \ ++ esac; \ ++ case $$flg in \ ++ *$$target_option*) has_opt=yes; break;; \ ++ esac; \ ++ done; \ ++ test $$has_opt = yes ++ ++## Shell code that determines whether make is running in "keep-going mode" ++## ("make -k") or not. Useful in rules that must recursively descend into ++## subdirectories, and decide whther to stop at the first error or not. ++am__make_keepgoing = (target_option=k; $(am__make_running_with_option)) ++ +am.util.strip-first-word = $(wordlist 2,$(words $(1)),$(1)) +am.util.strip-last-word = $(wordlist 2,$(words $(1)),dummy $(1)) + +# Remove repeated elements from the given list (without reordering), +# and return the reduced list. +am.util.uniq = $(strip \ +## If the list is empty, we have nothing to do. Otherwise, go on. + $(if $(strip $(1)), \ +## Call the function recursively on the list of all the elements +## but the last one. + $(call $0, \ + $(call am.util.strip-last-word, $(1))) \ +## And append the last element, unless it was already present. + $(if $(filter $(lastword $(1)), \ + $(call am.util.strip-last-word, $(1))), \ + $(am.chars.empty), \ + $(lastword $(1))))) + +## These definitions have been generated by the following Bash 4 script: +## +## #!/bin/bash +## toupper='$1' tolower='$1' +## for c in {a..z}; do +## C=${c^^} +## toupper="\$(subst $c,$C,$toupper)" +## tolower="\$(subst $C,$c,$tolower)" +## done +## echo "am.util.tolower = $tolower" +## echo "am.util.toupper = $toupper" + +am.util.tolower = $(subst Z,z,$(subst Y,y,$(subst X,x,$(subst W,w,$(subst V,v,$(subst U,u,$(subst T,t,$(subst S,s,$(subst R,r,$(subst Q,q,$(subst P,p,$(subst O,o,$(subst N,n,$(subst M,m,$(subst L,l,$(subst K,k,$(subst J,j,$(subst I,i,$(subst H,h,$(subst G,g,$(subst F,f,$(subst E,e,$(subst D,d,$(subst C,c,$(subst B,b,$(subst A,a,$1)))))))))))))))))))))))))) + +am.util.toupper = $(subst z,Z,$(subst y,Y,$(subst x,X,$(subst w,W,$(subst v,V,$(subst u,U,$(subst t,T,$(subst s,S,$(subst r,R,$(subst q,Q,$(subst p,P,$(subst o,O,$(subst n,N,$(subst m,M,$(subst l,L,$(subst k,K,$(subst j,J,$(subst i,I,$(subst h,H,$(subst g,G,$(subst f,F,$(subst e,E,$(subst d,D,$(subst c,C,$(subst b,B,$(subst a,A,$1)))))))))))))))))))))))))) + +# Canonicalize the given filename. See also the &canonicalize function +# in the automake script. + +am.util.canon = $(strip \ + $(subst ~,_,\ + $(subst },_,\ + $(subst |,_,\ + $(subst {,_,\ + $(subst $(am.chars.bquote),_,\ + $(subst ^,_,\ + $(subst $(am.chars.bslash),_,\ + $(subst [,_,\ + $(subst ],_,\ + $(subst ?,_,\ + $(subst >,_,\ + $(subst =,_,\ + $(subst <,_,\ + $(subst ;,_,\ + $(subst :,_,\ + $(subst /,_,\ + $(subst .,_,\ + $(subst -,_,\ + $(subst $(am.chars.comma),_,\ + $(subst +,_,\ + $(subst *,_,\ + $(subst $(am.chars.lparen),_,\ + $(subst $(am.chars.rparen),_,\ + $(subst $(am.chars.squote),_,\ + $(subst &,_,\ + $(subst %,_,\ + $(subst $(am.chars.dollar),_,\ + $(subst $(am.chars.hash),_,\ + $(subst $(am.chars.dquote),_,\ + $(subst !,_,$1))))))))))))))))))))))))))))))) + + +# Simple memoization for recursive make variables. It is useful for +# situations where immediate variables can't be used (due, say, to +# ordering issues with the assignments of the referenced variables), +# but where the value of the lazy variable is costly to calculate +# (e.g., a $(shell ...) call with a non-trivial command line), so that +# we can't afford to re-calculate it over and over every time the +# variable gets expanded. Example of usage: +# +# var1 = $(am.memoize,var1,$(shell EXPENSIVE-COMMAND-LINE)) +# var2 = $(am.memoize,var2,$(sort VERY-LONG-LIST)) +# +# This API and implementation seems to work around a bug in GNU make +# (present up to and including version 3.82) which caused our first +# implementation attempts to fail: +# +# +# +# +# So please don't change this without a very good reason. +# +am.memoize = $(or $(am.memoize.value/$1),$(strip \ + $(eval am.memoize.value/$1 := $$2))$(am.memoize.value/$1)) + +# $(call am.util.strip-suffixes, SUFFIXES, LIST) +# ---------------------------------------------- +# Strip any of the SUFFIXES from each of the entries of LIST. Even if an +# entry of LIST terminates with several suffixes, only one is stripped: +# the first one that matches. +am.hack.private-suffix = .,;&!@ +am.util.strip-suffixes = $(strip \ + $(if \ + $(strip $1), \ + $(patsubst %$(am.hack.private-suffix),%, \ + $(call $0, \ + $(call am.util.strip-first-word,$1), \ + $(patsubst %$(firstword $1),%$(am.hack.private-suffix),$2))), \ + $2)) + +# Now, some helper functions and variables to help in recipes that could +# exceed the command line length limit. + +# And in the Information Age, we somehow managed to revert to abacus-like +# counting. Yay for us :-) +am.max-cmdline-args := xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + +# FIXME! The above accounts for max forty arguments; this is basically +# arbitrary. In the long term, defining that after a configure-time test +# on the command-line length limits, or at least on a system-by-system +# basis, might be better. But don't make the new limit too big (even if +# the system would allow it), or our implementation will likely suffer in +# performance and in memory consumption. + +# $(call am.xargs-map,FUNCTION,LIST,[EXTRA-ARGS..]) +# ------------------------------------------------- +# Map the function $1 on the whitespace-separated list $2, ensuring that +# each call of $1 has at most 40 entries from that list at once. If +# further arguments are given (up to $9), they are passed to each $1 +# invocation. +# This implementation is hacky, but the more elegant or "naive" ones +# (based on recursion) proved to be ludicrously memory-hungry with +# huge lists. +# A drawback of this implementation is that am.xargs-map cannot be +# recursively invoked, but that shouldn't matter for our use cases. +# The extra $(strip) calls are only to allow clearer formatting. +define am.xargs-map +$(if $2,$(strip \ + )$(eval $0.partial-args :=)$(strip \ + )$(eval $0.counter :=)$(strip \ + )$(foreach i,$2,$(strip \ + )$(eval $0.counter := $$($0.counter)x)$(strip \ + )$(eval $0.partial-args += $$i)$(strip \ + )$(if $(filter $(am.max-cmdline-args),$($0.counter)),$(strip \ + )$(call $1,$(strip $($0.partial-args)),$3,$4,$5,$6,$7,$8,$9)$(strip \ + )$(eval $0.partial-args :=)$(strip \ + )$(eval $0.counter :=)))$(strip \ + )$(if $($0.counter),$(call $1,$(strip \ + $($0.partial-args)),$3,$4,$5,$6,$7,$8,$9))) +endef + +# Used only by the 'am.clean-cmd.*' functions below. Do not use in +# other places. +am.hack.rm-f = $(if $(strip $1),rm -f $(strip $1)$(am.chars.newline)) +am.hack.rm-rf = $(if $(strip $1),rm -rf $(strip $1)$(am.chars.newline)) + +# Needed to ensure the invocations of "rm -f" and "rm -rf" in our cleaning +# rules are not given too many arguments, which might cause command line +# length limits to be exceeded. These are only meant to be used in a +# "sub-recipe" by their own; e.g., +# +# # This is ok. +# clean-x: +# @echo "Cleaning X Files" +# @$(call am.clean-cmd.f,$(X_FILES)) +# +# # This is *wrong*. +# clean-x: +# @echo "Cleaning X Files" \ +# && $(call am.clean-cmd.f,$(X_FILES)) +# +am.clean-cmd.f = $(call am.xargs-map,am.hack.rm-f,$1) +am.clean-cmd.d = $(call am.xargs-map,am.hack.rm-rf,$1) + +# Some derived variables that have been found to be useful. +# These have since long been documented in the Automake manual and used +# by many real-world packages, so they are now an established feature +# and should not be changed. +pkgdatadir = $(datadir)/$(PACKAGE) +pkgincludedir = $(includedir)/$(PACKAGE) +pkglibdir = $(libdir)/$(PACKAGE) +pkglibexecdir = $(libexecdir)/$(PACKAGE) + +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) + +# These are defined like this to avoid introducing gratuitous +# incompatibilities with mainline Automake. +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : + +# Number of files to install concurrently. +am__install_max = 40 +# Take a "$list" of nobase files, collect them, indexed by their +# srcdir-stripped dirnames. For up to am__install_max files, output +# a line containing the dirname and the files, space-separated. +# The arbitrary limit helps avoid the quadratic scaling exhibited by +# string concatenation in most shells, and should avoid line length +# limitations, while still offering only negligible performance impact +# through spawning more install commands than absolutely needed. +am__nobase_list = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +# Collect up to 40 files per line from stdin. +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' + +# New function, backslash-escape whitespace in the given string. +define am.util.whitespace-escape +$(subst $(am.chars.space),\$(am.chars.space),$(subst $(am.chars.tab),\$(am.chars.tab),$1)) +endef + +# Determine whether the given file exists. Since this function is +# expected to be used on paths referencing $(DESTDIR), it must be +# ready to cope with whitespaces and shell metacharacters. +# FIXME: here we assume that the shell found by Autoconf-generated +# configure supports "test -e"; that is not completely correct ATM, but +# future versions of Autoconf will reject non-POSIX shells, so we should +# be safe in the long term. +define am.util.file-exists +$(strip \ + $(if $(strip $(findstring *,$1) $(findstring ?,$1) \ + $(findstring [,$1) $(findstring ],$1)), \ + $(shell test -e '$(subst $(am.chars.squote),'\'',$1)' && echo yes), \ + $(if $(wildcard $(call am.util.whitespace-escape,$1)),yes))) +endef + +# $(call am.uninst.cmd,DIR,FILES,[RM-OPTS]) +# ----------------------------------------- +# Uninstall the given files from the given directory, avoiding to hit +# command line length limits, and honoring $(DESTDIR). If the given DIR +# is actually an empty name, or it it refers to a non-existing file, it +# is assumed nothing is to be removed. The RM-OPTS (if present) are +# passed to the rm invocation removing the files (this ca be useful in +# case such files are actually directories (as happens with the HTML +# documentation), in which case rm should be passed the '-r' option. +# Similarly to the 'am.clean-cmd.f' above, this function is only meant +# to be used in a "sub-recipe" by its own. + +define am.uninst.cmd.aux +$(if $(and $2,$1),$(if $(call am.util.file-exists,$(DESTDIR)$2),$(strip \ +)cd '$(DESTDIR)$2' && rm -f$(if $3, $3) $1$(am.chars.newline))) +endef + +define am.uninst.cmd +$(call am.xargs-map,$0.aux,$(strip $2),$(strip $1),$(strip $3)) +endef diff --cc lib/am/subdirs.mk index ff7a5c13f,999aa7877..ca33ae8b0 --- a/lib/am/subdirs.mk +++ b/lib/am/subdirs.mk @@@ -40,17 -36,17 +40,16 @@@ AM_RECURSIVE_TARGETS += $(am.recurs.all # (which will cause the Makefiles to be regenerated when you run 'make'); # (2) otherwise, pass the desired values on the 'make' command line. -$(am__recursive_targets): +$(am.recurs.all-targets): %-recursive: ## Using $failcom allows "-k" to keep its natural meaning when running a ## recursive rule. - @fail= failcom='exit 1'; \ - for f in x $$MAKEFLAGS; do \ - case $$f in \ - *=* | --[!k]*);; \ - *k*) failcom='fail=yes';; \ - esac; \ - done; \ + @fail=; \ + if $(am__make_keepgoing); then \ + failcom='fail=yes'; \ + else \ + failcom='exit 1'; \ + fi; \ dot_seen=no; \ - target=`echo $@ | sed s/-recursive//`; \ ## For distclean and maintainer-clean we make sure to use the full ## list of subdirectories. We do this so that 'configure; make ## distclean' really is a no-op, even if SUBDIRS is conditional. diff --cc t/make-dryrun.tap index 7e7f1aade,0dbe3bb89..97c8a476f --- a/t/make-dryrun.tap +++ b/t/make-dryrun.tap @@@ -18,7 -18,20 +18,7 @@@ . test-init.sh - plan_ 40 -plan_ 60 - -if echo "all: ; +@printf %sbb%s aa cc" | $MAKE -n -f - | grep aabbcc; then - make_plus_silence () { return 0; } -else - make_plus_silence () { return 1; } -fi - -mkdir none # Also used later. -if echo nil: | $MAKE -I none -f -; then - make_supports_option_I () { return 0; } -else - make_supports_option_I () { return 1; } -fi ++plan_ 132 echo AC_OUTPUT >> configure.ac @@@ -59,17 -64,20 +59,20 @@@ check_make ( esac shift done - for opts in '' '-s' '-s -r'; do - r=ok - pmsg=${mode}${msg:+" [$msg]"}${opts:+" ($opts)"} - if $condition; then - $MAKE $opts "$mode" ${1+"$@"} || r='not ok' - test -f from-$mode || r='not ok' - test ! -e bad || r='not ok' - rm -f bad from-* || fatal_ "cleaning up" - else - directive=SKIP reason=$skip_reason - fi - result_ "$r" -D "$directive" -r "$reason" "$pmsg" ++ + for kind in plain recursive; do - r=ok - msg2=${msg:+"[$msg] "}"$mode, $kind" - $MAKE "$mode-$kind" ${1+"$@"} || r='not ok' - test -f from-$mode || r='not ok' - test ! -e bad || r='not ok' - rm -f bad from-* || fatal_ "cleaning up" - result_ "$r" "$msg2" - unset r msg2 ++ for opts in '' '-s' '-s -rR'; do ++ r=ok ++ msg2="${mode}, ${kind}"${msg:+" [$msg]"}${opts:+" ($opts)"} ++ $MAKE $opts "$mode-$kind" ${1+"$@"} || r='not ok' ++ test -f from-$mode || r='not ok' ++ test ! -e bad || r='not ok' ++ rm -f bad from-* || fatal_ "cleaning up" ++ result_ "$r" "$msg2" ++ unset r msg2 ++ done done - unset msg kind mode condition - unset r msg pmsg opts mode condition directive reason skip_reason ++ unset msg opts mode } # ----------------------------------------------------------------------