mirror of
https://git.savannah.gnu.org/git/make.git
synced 2024-12-28 15:57:48 +00:00
87a5f98d24
Delay the generation of error messages for included files until we are sure that we can't rebuild that included file. * dep.h (struct dep): Don't reuse "changed"; make a separate field to keep "flags". Get rid of dontcare and use the flag. (struct goaldep): Create a new structure for goal prereqs that tracks an errno value and the floc where the include happened. Rework the structures to ensure they are supersets as expected. In maintainer mode with GCC, use inline to get type checking. * read.c (eval_makefile): Return a struct goaldep for the new makefile. Ensure errno is set properly to denote a failure. (read_all_makefiles): Switch to goaldep and check errno. (eval): Don't show included file errors; instead remember them. * remake.c (update_goal_chain): Set global variables to the current goaldep we're building, and the entire chain. (show_goal_error): Check if the current failure is a consequence of building an included makefile and if so print an error. (complain): Call show_goal_error() on rule failure. * job.c (child_error): Call show_goal_error() on child error. * main.c (main): Switch from struct dep to goaldep. * misc.c (free_dep_chain): Not used; make into a macro. * tests/scripts/features/include: Update and include new tests. * tests/scripts/options/dash-B, tests/scripts/options/dash-W, tests/scripts/options/print-directory, tests/scripts/variables/MAKE_RESTARTS: Update known-good-output.
91 lines
1.9 KiB
Perl
91 lines
1.9 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test make -W (what if) option.\n";
|
|
|
|
# Basic build
|
|
|
|
run_make_test('
|
|
a.x: b.x
|
|
a.x b.x: ; echo >> $@
|
|
',
|
|
'', "echo >> b.x\necho >> a.x");
|
|
|
|
# Run it again: nothing should happen
|
|
|
|
run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
|
|
|
|
# Now run it with -W b.x: should rebuild a.x
|
|
|
|
run_make_test(undef, '-W b.x', 'echo >> a.x');
|
|
|
|
# Put the timestamp for a.x into the future; it should still be remade.
|
|
|
|
utouch(1000, 'a.x');
|
|
run_make_test(undef, '', "#MAKE#: 'a.x' is up to date.");
|
|
run_make_test(undef, '-W b.x', 'echo >> a.x');
|
|
|
|
# Clean up
|
|
|
|
rmfiles('a.x', 'b.x');
|
|
|
|
# Test -W with the re-exec feature: we don't want to re-exec forever
|
|
# Savannah bug # 7566
|
|
|
|
# First set it up with a normal build
|
|
|
|
run_make_test('
|
|
all: baz.x ; @:
|
|
include foo.x
|
|
foo.x: bar.x
|
|
@echo "\$$(info restarts=\$$(MAKE_RESTARTS))" > $@
|
|
@echo "touch $@"
|
|
bar.x: ; echo >> $@
|
|
baz.x: bar.x ; @echo "touch $@"
|
|
',
|
|
'', 'echo >> bar.x
|
|
touch foo.x
|
|
restarts=1
|
|
touch baz.x');
|
|
|
|
# Now run with -W bar.x
|
|
|
|
# Tweak foo.x's timestamp so the update will change it.
|
|
&utouch(1000, 'foo.x');
|
|
|
|
run_make_test(undef, '-W bar.x', "restarts=\ntouch foo.x\nrestarts=1\ntouch baz.x");
|
|
|
|
rmfiles('foo.x', 'bar.x');
|
|
|
|
# Test -W on vpath-found files: it should take effect.
|
|
# Savannah bug # 15341
|
|
|
|
mkdir('x-dir', 0777);
|
|
utouch(-20, 'x-dir/x');
|
|
touch('y');
|
|
|
|
run_make_test('
|
|
y: x ; @echo cp $< $@
|
|
',
|
|
'-W x-dir/x VPATH=x-dir',
|
|
'cp x-dir/x y');
|
|
|
|
# Make sure ./ stripping doesn't interfere with the match.
|
|
|
|
run_make_test('
|
|
y: x ; @echo cp $< $@
|
|
',
|
|
'-W ./x-dir/x VPATH=x-dir',
|
|
'cp x-dir/x y');
|
|
|
|
run_make_test(undef,
|
|
'-W x-dir/x VPATH=./x-dir',
|
|
'cp ./x-dir/x y');
|
|
|
|
unlink(qw(y x-dir/x));
|
|
rmdir('x-dir');
|
|
|
|
1;
|
|
|
|
### Local Variables:
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
### End:
|