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.
87 lines
1.7 KiB
Perl
87 lines
1.7 KiB
Perl
# -*-perl-*-
|
|
|
|
$description = "Test make -B (always remake) option.\n";
|
|
|
|
$details = "\
|
|
Construct a simple makefile that builds a target.
|
|
Invoke make once, so it builds everything. Invoke it again and verify
|
|
that nothing is built. Then invoke it with -B and verify that everything
|
|
is built again.";
|
|
|
|
&touch('bar.x');
|
|
|
|
run_make_test('
|
|
.SUFFIXES:
|
|
|
|
.PHONY: all
|
|
all: foo
|
|
|
|
foo: bar.x
|
|
@echo cp $< $@
|
|
@echo "" > $@
|
|
',
|
|
'', 'cp bar.x foo');
|
|
|
|
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
|
|
run_make_test(undef, '-B', 'cp bar.x foo');
|
|
|
|
# Put the timestamp for foo into the future; it should still be remade.
|
|
|
|
utouch(1000, 'foo');
|
|
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
|
|
run_make_test(undef, '-B', 'cp bar.x foo');
|
|
|
|
# Clean up
|
|
|
|
rmfiles('bar.x', 'foo');
|
|
|
|
# Test -B with the re-exec feature: we don't want to re-exec forever
|
|
# Savannah bug # 7566
|
|
|
|
run_make_test('
|
|
all: ; @:
|
|
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
|
|
include foo.x
|
|
foo.x: ; @touch $@
|
|
',
|
|
'-B', 'MAKE_RESTARTS=
|
|
MAKE_RESTARTS=1');
|
|
|
|
rmfiles('foo.x');
|
|
|
|
# Test -B with the re-exec feature: we DO want -B in the "normal" part of the
|
|
# makefile.
|
|
|
|
&touch('blah.x');
|
|
|
|
run_make_test('
|
|
all: blah.x ; @echo $@
|
|
$(info MAKE_RESTARTS=$(MAKE_RESTARTS))
|
|
include foo.x
|
|
foo.x: ; @touch $@
|
|
blah.x: ; @echo $@
|
|
',
|
|
'-B', 'MAKE_RESTARTS=
|
|
MAKE_RESTARTS=1
|
|
blah.x
|
|
all');
|
|
|
|
rmfiles('foo.x', 'blah.x');
|
|
|
|
# Test that $? is set properly with -B; all prerequisites will be newer!
|
|
|
|
utouch(-10, 'x.b');
|
|
touch('x.a');
|
|
|
|
run_make_test(q!
|
|
x.a: x.b ; @echo $?
|
|
!,
|
|
'-B', "x.b\n");
|
|
|
|
unlink(qw(x.a x.b));
|
|
|
|
1;
|
|
|
|
### Local Variables:
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
### End:
|