From: Stefano Lattarini Date: Thu, 21 Feb 2013 17:12:27 +0000 (+0100) Subject: Merge branch 'master' into ng/master X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=10a1f8b1d17cf1602819fb93a758f3102e737d6e;p=thirdparty%2Fautomake.git Merge branch 'master' into ng/master * master: maint: more adjustments to the new versioning scheme aclocal: fix for more-than-once specified directories aclocal: just warn if the primary local m4 dir doesn't exist (don't error) coverage: expose automake bug#13760 tests: refactor/enhance tests about make dry-run mode maint: describe new versioning and branching scheme, and adjust to it cosmetics: fix some "docstring-like" comments in automake + t/make-dryrun.tap: Several adjustments, since this test had diverged quite significantly from the version in mainline Automake. Particularly relevant is the fact that Automake-NG seems immune to bug#13760, so that some tests that are returning XFAIL in mainline automake succeeds for Automake-NG. Signed-off-by: Stefano Lattarini --- 10a1f8b1d17cf1602819fb93a758f3102e737d6e diff --cc automake.in index e52f58f0b,2843904ab..7b69dde91 --- a/automake.in +++ b/automake.in @@@ -995,20 -1043,27 +995,18 @@@ sub define_verbose_var ($$;$ my ($name, $silent_val, $verbose_val) = @_; $verbose_val = '' unless defined $verbose_val; my $var = verbose_var ($name); - my $pvar = verbose_private_var ($name); - my $silent_var = $pvar . '_0'; - my $verbose_var = $pvar . '_1'; - # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V) - # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY). - # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead. - # See AM_SILENT_RULES in m4/silent.m4. - define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL); - define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)', - INTERNAL); - Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, - $silent_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($silent_var, TRUE)); - Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE, - $verbose_val, '', INTERNAL, VAR_ASIS) - if (! vardef ($verbose_var, TRUE)); + define_variable ($var, INTERNAL, "\$($var/\$V)"); + Automake::Variable::define ("$var/0", VAR_AUTOMAKE, '', TRUE, + $silent_val, '', INTERNAL) + if (! vardef ("$var/0", TRUE)); + Automake::Variable::define ("$var/1", VAR_AUTOMAKE, '', TRUE, + $verbose_val, '', INTERNAL) + if (! vardef ("$var/1", TRUE)); } - # Above should not be needed in the general automake code. - # verbose_flag (NAME) # ------------------- - # Contents of %VERBOSE%: variable to expand before rule command. + # Contents of '%VERBOSE%' variable to expand before rule command. sub verbose_flag ($) { my ($name) = @_; @@@ -1048,12 -1101,10 +1044,10 @@@ sub define_verbose_texinfo ( { define_verbose_tagvar($tag); } - define_verbose_var('texinfo', '-q'); - define_verbose_var('texidevnull', '> /dev/null'); + define_verbose_var('TEXI_QUIETOPTS', '-q'); + define_verbose_var('TEXI_DEVNULL_REDIRECT', '> /dev/null'); } - # define_verbose_libtool - # ---------------------- # Engage the needed silent rules machinery for 'libtool --silent'. sub define_verbose_libtool () { @@@ -2080,17 -2317,57 +2074,12 @@@ sub check_canonical_spelling ($@ # Set up the compile suite. sub handle_compile () { - return if ! $must_handle_compiled_objects; - - # Boilerplate. - my $default_includes = ''; - if (! option 'nostdinc') - { - my @incs = ('-I.', subst ('am__isrc')); - - my $var = var 'CONFIG_HEADER'; - if ($var) - { - foreach my $hdr (split (' ', $var->variable_value)) - { - push @incs, '-I' . dirname ($hdr); - } - } - # We want '-I. -I$(srcdir)', but the latter -I is redundant - # and unaesthetic in non-VPATH builds. We use `-I.@am__isrc@` - # instead. It will be replaced by '-I.' or '-I. -I$(srcdir)'. - # Items in CONFIG_HEADER are never in $(srcdir) so it is safe - # to just put @am__isrc@ right after '-I.', without a space. - ($default_includes = ' ' . uniq (@incs)) =~ s/ @/@/; - } - - my (@mostly_rms, @dist_rms); - foreach my $item (sort keys %compile_clean_files) - { - if ($compile_clean_files{$item} == MOSTLY_CLEAN) - { - push (@mostly_rms, "\t-rm -f $item"); - } - elsif ($compile_clean_files{$item} == DIST_CLEAN) - { - push (@dist_rms, "\t-rm -f $item"); - } - else - { - prog_error 'invalid entry in %compile_clean_files'; - } - } - - my ($coms, $vars, $rules) = - file_contents_internal (1, "$libdir/am/compile.am", - new Automake::Location, - 'DEFAULT_INCLUDES' => $default_includes, - 'MOSTLYRMS' => join ("\n", @mostly_rms), - 'DISTRMS' => join ("\n", @dist_rms)); - $output_vars .= $vars; - $output_rules .= "$coms$rules"; + return if ! $must_handle_compiled_objects; + $output_rules .= file_contents ('compile', + new Automake::Location, + 'STDINC' => ! option 'nostdinc'); } - # handle_libtool () - # ----------------- # Handle libtool rules. sub handle_libtool () { @@@ -2102,18 -2379,23 +2091,16 @@@ require_conf_file_with_macro (TRUE, 'LIBTOOL', FOREIGN, @libtool_files) if $relative_dir eq '.' && ! $libtool_new_api; - my @libtool_rms; - foreach my $item (sort keys %libtool_clean_directories) - { - my $dir = ($item eq '.') ? '' : "$item/"; - # .libs is for Unix, _libs for DOS. - push (@libtool_rms, "\t-rm -rf ${dir}.libs"); - } - check_user_variables 'LIBTOOLFLAGS'; - # Output the libtool compilation rules. - $output_rules .= file_contents ('libtool', - new Automake::Location, - LTRMS => join ("\n", @libtool_rms)); + if ($relative_dir eq '.') + { + $clean_files{"libtool"} = DIST_CLEAN; + $clean_files{"config.lt"} = DIST_CLEAN; + } } - # handle_programs () - # ------------------ - # Handle C programs. + sub handle_programs () { my @proglist = am_install_var ('progs', 'PROGRAMS', @@@ -2535,8 -2837,33 +2516,7 @@@ sub handle_ltlibraries ( } } -# See if any _SOURCES variable were misspelled. -sub check_typos () -{ - # It is ok if the user sets this particular variable. - set_seen 'AM_LDFLAGS'; - - foreach my $primary ('SOURCES', 'LIBADD', 'LDADD', 'LDFLAGS', 'DEPENDENCIES') - { - foreach my $var (variables $primary) - { - my $varname = $var->name; - # A configure variable is always legitimate. - next if exists $configure_vars{$varname}; - - for my $cond ($var->conditions->conds) - { - $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/; - msg_var ('syntax', $var, "variable '$varname' is defined but no" - . " program or\nlibrary has '$1' as canonical name" - . " (possible typo)") - unless $var->rdef ($cond)->seen; - } - } - } -} - - # Handle scripts. sub handle_scripts () { # NOTE we no longer automatically clean SCRIPTS, because it is @@@ -2601,9 -2931,109 +2579,9 @@@ sub scan_texinfo_file ($ return ($outfile, $vfile); } - -# ($DIRSTAMP, @CLEAN_FILES) -# output_texinfo_build_rules ($SOURCE, $DEST, $INSRC, @DEPENDENCIES) -# ------------------------------------------------------------------ -# SOURCE - the source Texinfo file -# DEST - the destination Info file -# INSRC - whether DEST should be built in the source tree -# DEPENDENCIES - known dependencies -sub output_texinfo_build_rules ($$$@) -{ - my ($source, $dest, $insrc, @deps) = @_; - - # Split 'a.texi' into 'a' and '.texi'. - my ($spfx, $ssfx) = ($source =~ /^(.*?)(\.[^.]*)?$/); - my ($dpfx, $dsfx) = ($dest =~ /^(.*?)(\.[^.]*)?$/); - - $ssfx ||= ""; - $dsfx ||= ""; - - # We can output two kinds of rules: the "generic" rules use Make - # suffix rules and are appropriate when $source and $dest do not lie - # in a sub-directory; the "specific" rules are needed in the other - # case. - # - # The former are output only once (this is not really apparent here, - # but just remember that some logic deeper in Automake will not - # output the same rule twice); while the later need to be output for - # each Texinfo source. - my $generic; - my $makeinfoflags; - my $sdir = dirname $source; - if ($sdir eq '.' && dirname ($dest) eq '.') - { - $generic = 1; - $makeinfoflags = '-I $(srcdir)'; - } - else - { - $generic = 0; - $makeinfoflags = "-I $sdir -I \$(srcdir)/$sdir"; - } - - # A directory can contain two kinds of info files: some built in the - # source tree, and some built in the build tree. The rules are - # different in each case. However we cannot output two different - # set of generic rules. Because in-source builds are more usual, we - # use generic rules in this case and fall back to "specific" rules - # for build-dir builds. (It should not be a problem to invert this - # if needed.) - $generic = 0 unless $insrc; - - # We cannot use a suffix rule to build info files with an empty - # extension. Otherwise we would output a single suffix inference - # rule, with separate dependencies, as in - # - # .texi: - # $(MAKEINFO) ... - # foo.info: foo.texi - # - # which confuse Solaris make. (See the Autoconf manual for - # details.) Therefore we use a specific rule in this case. This - # applies to info files only (dvi and pdf files always have an - # extension). - my $generic_info = ($generic && $dsfx) ? 1 : 0; - - # If the resulting file lies in a subdirectory, - # make sure this directory will exist. - my $dirstamp = require_build_directory_maybe ($dest); - - my $dipfx = ($insrc ? '$(srcdir)/' : '') . $dpfx; - - $output_rules .= file_contents ('texibuild', - new Automake::Location, - AM_V_MAKEINFO => verbose_flag('MAKEINFO'), - AM_V_TEXI2DVI => verbose_flag('TEXI2DVI'), - AM_V_TEXI2PDF => verbose_flag('TEXI2PDF'), - DEPS => "@deps", - DEST_PREFIX => $dpfx, - DEST_INFO_PREFIX => $dipfx, - DEST_SUFFIX => $dsfx, - DIRSTAMP => $dirstamp, - GENERIC => $generic, - GENERIC_INFO => $generic_info, - INSRC => $insrc, - MAKEINFOFLAGS => $makeinfoflags, - SILENT => silent_flag(), - SOURCE => ($generic - ? '$<' : $source), - SOURCE_INFO => ($generic_info - ? '$<' : $source), - SOURCE_REAL => $source, - SOURCE_SUFFIX => $ssfx, - TEXIQUIET => verbose_flag('texinfo'), - TEXIDEVNULL => verbose_flag('texidevnull'), - ); - return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html"); -} - - -# ($MOSTLYCLEAN, $TEXICLEAN, $MAINTCLEAN) # handle_texinfo_helper ($info_texinfos) # -------------------------------------- - # Handle all Texinfo source; helper for handle_texinfo. + # Handle all Texinfo source; helper for 'handle_texinfo'. sub handle_texinfo_helper ($) { my ($info_texinfos) = @_; @@@ -3636,13 -4236,12 +3606,12 @@@ sub handle_configure ($@ } # These files get removed by "make distclean". - define_pretty_variable ('CONFIG_CLEAN_FILES', TRUE, INTERNAL, - @actual_other_files); - define_pretty_variable ('CONFIG_CLEAN_VPATH_FILES', TRUE, INTERNAL, - @actual_other_vpath_files); + define_variable ('CONFIG_CLEAN_FILES', INTERNAL, + @actual_other_files); + define_variable ('CONFIG_CLEAN_VPATH_FILES',INTERNAL, + @actual_other_vpath_files); } - # Handle C headers. sub handle_headers () { my @r = am_install_var ('-defaultdist', 'header', 'HEADERS', 'include', @@@ -3711,64 -4310,230 +3680,64 @@@ sub handle_gettext ( require_file ($ac_gettext_location, GNU, 'ABOUT-NLS'); } - # Handle footer elements. + # Emit makefile footer. sub handle_footer () { - reject_rule ('.SUFFIXES', - "use variable 'SUFFIXES', not target '.SUFFIXES'"); - - # Note: AIX 4.1 /bin/make will fail if any suffix rule appears - # before .SUFFIXES. So we make sure that .SUFFIXES appears before - # anything else, by sticking it right after the default: target. - $output_header .= ".SUFFIXES:\n"; - my $suffixes = var 'SUFFIXES'; - my @suffixes = Automake::Rule::suffixes; - if (@suffixes || $suffixes) - { - # Make sure SUFFIXES has unique elements. Sort them to ensure - # the output remains consistent. However, $(SUFFIXES) is - # always at the start of the list, unsorted. This is done - # because make will choose rules depending on the ordering of - # suffixes, and this lets the user have some control. Push - # actual suffixes, and not $(SUFFIXES). Some versions of make - # do not like variable substitutions on the .SUFFIXES line. - my @user_suffixes = ($suffixes - ? $suffixes->value_as_list_recursive : ()); + # FIXME: maybe display a warning if the obsolescent $(SUFFIXES) + # FIXME: variable is used? Currently, we don't do that, to preserve + # FIXME: better compatibility with mainline Automake. + $output_trailer .= file_contents ('footer', new Automake::Location); +} - my %suffixes = map { $_ => 1 } @suffixes; - delete @suffixes{@user_suffixes}; +# Generate helper targets for user recursion, where needed. +sub handle_user_recursion () +{ + return unless @extra_recursive_targets; - $output_header .= (".SUFFIXES: " - . join (' ', @user_suffixes, sort keys %suffixes) - . "\n"); + define_variable ('am.recurs.extra-targets', INTERNAL, + map { "$_-recursive" } @extra_recursive_targets); + my $aux = var ('SUBDIRS') ? 'recursive' : 'am'; + foreach my $target (@extra_recursive_targets) + { + # This allows the default target's rules to be overridden in + # Makefile.am. + user_phony_rule ($target); + depend ("$target", "$target-$aux"); + depend ("$target-am", "$target-local"); + # Every user-defined recursive target 'foo' *must* have a valid + # associated 'foo-local' rule; we define it as an empty rule by + # default, so that the user can transparently extend it in his + # own Makefile.am. + pretty_print_rule ("$target-local:", '', ''); + # $target-recursive might as well be undefined, so do not add + # it here; it's taken care of in subdirs.am anyway. + depend (".PHONY", "$target-am", "$target-local"); } - - $output_trailer .= file_contents ('footer', new Automake::Location); } - -# Generate 'make install' rules. -sub handle_install () +sub handle_clean () { - $output_rules .= file_contents - ('install', - new Automake::Location, - maybe_BUILT_SOURCES => (set_seen ('BUILT_SOURCES') - ? (" \$(BUILT_SOURCES)\n" - . "\t\$(MAKE) \$(AM_MAKEFLAGS)") - : ''), - 'installdirs-local' => (user_phony_rule 'installdirs-local' - ? ' installdirs-local' : ''), - am__installdirs => variable_value ('am__installdirs') || ''); -} - - -# Deal with 'all' and 'all-am'. -sub handle_all ($) -{ - my ($makefile) = @_; - - # Output 'all-am'. - - # Put this at the beginning for the sake of non-GNU makes. This - # is still wrong if these makes can run parallel jobs. But it is - # right enough. - unshift (@all, basename ($makefile)); - - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push (@all, basename ($out)) - if dirname ($out) eq $relative_dir; - } - - # Install 'all' hooks. - push (@all, "all-local") - if user_phony_rule "all-local"; - - pretty_print_rule ("all-am:", "\t\t", @all); - depend ('.PHONY', 'all-am', 'all'); - - - # Output 'all'. - - my @local_headers = (); - push @local_headers, '$(BUILT_SOURCES)' - if var ('BUILT_SOURCES'); - foreach my $spec (@config_headers) - { - my ($out, @ins) = split_config_file_spec ($spec); - push @local_headers, basename ($out) - if dirname ($out) eq $relative_dir; - } - - if (@local_headers) - { - # We need to make sure config.h is built before we recurse. - # We also want to make sure that built sources are built - # before any ordinary 'all' targets are run. We can't do this - # by changing the order of dependencies to the "all" because - # that breaks when using parallel makes. Instead we handle - # things explicitly. - $output_all .= ("all: @local_headers" - . "\n\t" - . '$(MAKE) $(AM_MAKEFLAGS) ' - . (var ('SUBDIRS') ? 'all-recursive' : 'all-am') - . "\n\n"); - depend ('.MAKE', 'all'); - } - else - { - $output_all .= "all: " . (var ('SUBDIRS') - ? 'all-recursive' : 'all-am') . "\n\n"; - } -} - -# Generate helper targets for user-defined recursive targets, where needed. -sub handle_user_recursion () -{ - return unless @extra_recursive_targets; - - define_pretty_variable ('am__extra_recursive_targets', TRUE, INTERNAL, - map { "$_-recursive" } @extra_recursive_targets); - my $aux = var ('SUBDIRS') ? 'recursive' : 'am'; - foreach my $target (@extra_recursive_targets) - { - # This allows the default target's rules to be overridden in - # Makefile.am. - user_phony_rule ($target); - depend ("$target", "$target-$aux"); - depend ("$target-am", "$target-local"); - # Every user-defined recursive target 'foo' *must* have a valid - # associated 'foo-local' rule; we define it as an empty rule by - # default, so that the user can transparently extend it in his - # own Makefile.am. - pretty_print_rule ("$target-local:", '', ''); - # $target-recursive might as well be undefined, so do not add - # it here; it's taken care of in subdirs.am anyway. - depend (".PHONY", "$target-am", "$target-local"); - } -} + my (%f, %d); + my @fkeys = keys %clean_files; + $f{mostly} = [ grep { $clean_files{$_} == MOSTLY_CLEAN } @fkeys ]; + $f{normal} = [ grep { $clean_files{$_} == CLEAN } @fkeys ]; + $f{dist} = [ grep { $clean_files{$_} == DIST_CLEAN } @fkeys ]; + $f{maint} = [ grep { $clean_files{$_} == MAINTAINER_CLEAN } @fkeys ]; -# Handle check merge target specially. -sub do_check_merge_target () -{ - # Include user-defined local form of target. - push @check_tests, 'check-local' - if user_phony_rule 'check-local'; + my @dkeys = keys %clean_dirs; + $d{mostly} = [ grep { $clean_dirs{$_} == MOSTLY_CLEAN } @dkeys ]; + $d{normal} = [ grep { $clean_dirs{$_} == CLEAN } @dkeys ]; + $d{dist} = [ grep { $clean_dirs{$_} == DIST_CLEAN } @dkeys ]; + $d{maint} = [ grep { $clean_dirs{$_} == MAINTAINER_CLEAN } @dkeys ]; - # The check target must depend on the local equivalent of - # 'all', to ensure all the primary targets are built. Then it - # must build the local check rules. - $output_rules .= "check-am: all-am\n"; - if (@check) + foreach my $kind (qw/mostly normal dist maint/) { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", @check); - depend ('.MAKE', 'check-am'); - } - - if (@check_tests) - { - pretty_print_rule ("\t\$(MAKE) \$(AM_MAKEFLAGS)", "\t ", - @check_tests); - depend ('.MAKE', 'check-am'); - } - - depend '.PHONY', 'check', 'check-am'; - # Handle recursion. We have to honor BUILT_SOURCES like for 'all:'. - $output_rules .= ("check: " - . (var ('BUILT_SOURCES') - ? "\$(BUILT_SOURCES)\n\t\$(MAKE) \$(AM_MAKEFLAGS) " - : '') - . (var ('SUBDIRS') ? 'check-recursive' : 'check-am') - . "\n"); - depend ('.MAKE', 'check') - if var ('BUILT_SOURCES'); -} - -# Handle all 'clean' targets. -sub handle_clean ($) -{ - my ($makefile) = @_; - - # Clean the files listed in user variables if they exist. - $clean_files{'$(MOSTLYCLEANFILES)'} = MOSTLY_CLEAN - if var ('MOSTLYCLEANFILES'); - $clean_files{'$(CLEANFILES)'} = CLEAN - if var ('CLEANFILES'); - $clean_files{'$(DISTCLEANFILES)'} = DIST_CLEAN - if var ('DISTCLEANFILES'); - $clean_files{'$(MAINTAINERCLEANFILES)'} = MAINTAINER_CLEAN - if var ('MAINTAINERCLEANFILES'); - - # Built sources are automatically removed by maintainer-clean. - $clean_files{'$(BUILT_SOURCES)'} = MAINTAINER_CLEAN - if var ('BUILT_SOURCES'); - - # Compute a list of "rm"s to run for each target. - my %rms = (MOSTLY_CLEAN, [], - CLEAN, [], - DIST_CLEAN, [], - MAINTAINER_CLEAN, []); - - foreach my $file (keys %clean_files) - { - my $when = $clean_files{$file}; - prog_error 'invalid entry in %clean_files' - unless exists $rms{$when}; - - my $rm = "rm -f $file"; - # If file is a variable, make sure when don't call 'rm -f' without args. - $rm ="test -z \"$file\" || $rm" - if ($file =~ /^\s*\$(\(.*\)|\{.*\})\s*$/); - - push @{$rms{$when}}, "\t-$rm\n"; + define_variable ("am.clean.$kind.f.auto", INTERNAL, @{$f{$kind}}); + define_variable ("am.clean.$kind.d.auto", INTERNAL, @{$d{$kind}}); } - $output_rules .= file_contents - ('clean', - new Automake::Location, - MOSTLYCLEAN_RMS => join ('', sort @{$rms{&MOSTLY_CLEAN}}), - CLEAN_RMS => join ('', sort @{$rms{&CLEAN}}), - DISTCLEAN_RMS => join ('', sort @{$rms{&DIST_CLEAN}}), - MAINTAINER_CLEAN_RMS => join ('', sort @{$rms{&MAINTAINER_CLEAN}}), - MAKEFILE => basename $makefile, - ); + verbatim ('clean'); } @@@ -3933,10 -4872,9 +3898,9 @@@ sub handle_python ( require_variables ($pyfiles[0][0], "Python sources seen", TRUE, 'PYTHON'); require_conf_file ($pyfiles[0][0], FOREIGN, 'py-compile'); - define_variable ('py_compile', "$am_config_aux_dir/py-compile", INTERNAL); + define_variable ('py_compile', INTERNAL, '$(am.conf.aux-dir)/py-compile'); } - # Handle Java. sub handle_java () { my @sourcelist = am_install_var ('-candist', @@@ -5410,10 -6466,10 +5362,9 @@@ sub define_standard_variables ( { define_configure_variable ($var); } - - $output_vars .= $comments . $rules; + $output_vars .= verbatim ('header-vars'); } - # Read main am file. sub read_main_am_file ($$) { my ($amfile, $infile) = @_; @@@ -6490,7 -7568,67 +6440,7 @@@ sub require_conf_file_with_macro ($$$@ # require_build_directory ($DIRECTORY) # ------------------------------------ - # Push a list of files onto @dist_common. -# Emit rules to create $DIRECTORY if needed, and return -# the file that any target requiring this directory should be made -# dependent upon. -# We don't want to emit the rule twice, and want to reuse it -# for directories with equivalent names (e.g., 'foo/bar' and './foo//bar'). -sub require_build_directory ($) -{ - my $directory = shift; - - return $directory_map{$directory} if exists $directory_map{$directory}; - - my $cdir = File::Spec->canonpath ($directory); - - if (exists $directory_map{$cdir}) - { - my $stamp = $directory_map{$cdir}; - $directory_map{$directory} = $stamp; - return $stamp; - } - - my $dirstamp = "$cdir/\$(am__dirstamp)"; - - $directory_map{$directory} = $dirstamp; - $directory_map{$cdir} = $dirstamp; - - # Set a variable for the dirstamp basename. - define_pretty_variable ('am__dirstamp', TRUE, INTERNAL, '.dirstamp'); - - # Directory must be removed by 'make distclean'. - $clean_files{$dirstamp} = DIST_CLEAN; - - $output_rules .= ("$dirstamp:\n" - . "\t\@\$(MKDIR_P) $directory\n" - . "\t\@: > $dirstamp\n"); - - return $dirstamp; -} - -# require_build_directory_maybe ($FILE) -# ------------------------------------- -# If $FILE lies in a subdirectory, emit a rule to create this -# directory and return the file that $FILE should be made -# dependent upon. Otherwise, just return the empty string. -sub require_build_directory_maybe ($) -{ - my $file = shift; - my $directory = dirname ($file); - - if ($directory ne '.') - { - return require_build_directory ($directory); - } - else - { - return ''; - } -} - -################################################################ - + # Push a list of files onto '@dist_common'. sub push_dist_common (@) { prog_error "push_dist_common run after handle_dist" diff --cc t/make-dryrun.tap index 536530c56,1459a9f37..7e7f1aade --- a/t/make-dryrun.tap +++ b/t/make-dryrun.tap @@@ -18,23 -18,70 +18,62 @@@ . test-init.sh - plan_ 14 -plan_ 18 - -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 -if echo nil: | $MAKE -I none -f -; then - make_supports_option_I () { return 0; } -else - make_supports_option_I () { return 1; } -fi ++plan_ 40 echo AC_OUTPUT >> configure.ac cat > Makefile.am <<'END' ++# For debugging. ++$(warning MAKEFLAGS[make] => '$(MAKEFLAGS)') ++$(warning MFLAGS[make] => '$(MFLAGS)') ++$(warning MAKEFLAGS[env] => '$(shell printf "%s\\n" "$$MAKEFLAGS")') ++$(warning MFLAGS[env] => '$(shell printf "%s\\n" "$$MFLAGS")') ++ all: - : Dummy, nothing to do. -foo: - $(MAKE) all -run: - @echo ":: $$MAKEFLAGS ::"; : For debugging. - $(am__make_dryrun) && exit 1; echo ok > from-run -dry: - +@echo ":: $$MAKEFLAGS ::"; : For debugging. - +$(am__make_dryrun) || exit 1; echo ok > from-dry + @echo "Target '$@' should never run" >&2; exit 1; - notdry-plain: - $(am.make.dry-run) && exit 1; exit 0 - notdry-recursive: - $(MAKE) notdry-plain ++ ++run-plain: ++ $(am.make.dry-run) && exit 1; echo ok > from-run ++run-recursive: ++ $(MAKE) run-plain +dry-plain: - +$(am.make.dry-run) || exit 1; echo ok > from-dry-mode ++ +$(am.make.dry-run) || exit 1; echo ok > from-dry +dry-recursive: + $(MAKE) dry-plain END + check_make () + { - r=ok msg= mode= condition=: directive= reason= skip_reason= ++ msg= mode= + case $1 in + --dry) mode=dry;; + --run) mode=run;; + *) fatal_ "check_run: invalid usage";; + esac + shift + while test $# -gt 0; do + case $1 in - -C) condition=$2 skip_reason=$3; shift; shift;; + -M) msg=$2; shift;; - -X) directive=TODO;; + --) shift; break;; + *) break;; + esac + shift + done - msg=${mode}${msg:+" [$msg]"} - if $condition; then - $MAKE "$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" "$msg" - unset r msg mode condition directive reason skip_reason ++ 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 ++ done ++ unset msg kind mode condition + } + + # ---------------------------------------------------------------------- + $ACLOCAL || fatal_ "aclocal failed" $AUTOCONF || fatal_ "autoconf failed" $AUTOMAKE || fatal_ "automake failed" @@@ -42,26 -89,40 +81,37 @@@ # ---------------------------------------------------------------------- - check_no_dryrun () - { - for kind in plain recursive; do - command_ok_ "wet-run, $kind ($cnt)" $MAKE notdry-$kind ${1+"$@"} - done - cnt=$(($cnt + 1)) - } - cnt=1 - - check_no_dryrun - check_no_dryrun -k + check_make --run ++check_make --run -k # Test against a known regression. This was especially heinous, since # make running in normal mode was sometimes mistaken for make running # in dry mode. - mkdir n ./--dry-run - check_no_dryrun -I n - check_no_dryrun -I --dry-run - check_no_dryrun -I n -I --dry-run - rmdir n ./--dry-run + check_make --run TESTS="n1.test n2.test" -check_make --run TESTS="n1 n2" AM_MAKEFLAGS="TESTS='n1 n2'" -check_make --run TESTS="n1 n2" AM_MAKEFLAGS='TESTS="n1 n2"' ++check_make --run TESTS="n1 n2" MAKEFLAGS="TESTS='n1 n2'" ++check_make --run TESTS="n1 n2" MAKEFLAGS='TESTS="n1 n2"' + check_make --run FOOFLAGS="-n -n -knf2 n --none -n" + check_make --run MYFLAGS="-n --dryrun -n --dry-run -n" + + # ---------------------------------------------------------------------- + -check_make --dry -C make_plus_silence 'recipe prefix "+" unsupported' -n -check_make --dry -C using_gmake "\$MAKE is not GNU make" --dry-run -k ++check_make --dry -- -n ++check_make --dry -- --dry-run --keep-going ++check_make --dry -- --no-print-directory --dry-run -k + + # ---------------------------------------------------------------------- + + # Automake bug#13760: the "n" in "none" used to confound am__make_dryrun + # into thinking the '-n' option had been passed. + + pr='bug#13760' + -check_make --run -X -C make_supports_option_I "-I make option unsupported" \ - -M "$pr" -I none - -check_make --run -X -C using_gmake "\$MAKE is not GNU make" \ - -M "$pr" -I none --include dry-run - -check_make --dry -C make_supports_option_I "-I make option unsupported" \ - -M "$pr" -I none -n - -check_make --dry -C using_gmake "\$MAKE is not GNU make" \ - -M "$pr" --dry-run -I none --include dry-run ++mkdir none dry-run ++check_make --run -M "$pr" -- -I none ++check_make --run -M "$pr" -- -I none --include dry-run ++check_make --dry -M "$pr" -- -I none -n ++check_make --dry -M "$pr" -- --dry-run -I none --include dry-run ++rmdir none dry-run # ----------------------------------------------------------------------