2002-08-08 00:11:19 +00:00
|
|
|
# -*-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.";
|
|
|
|
|
2005-02-28 09:41:25 +00:00
|
|
|
&touch('bar.x');
|
2002-08-08 00:11:19 +00:00
|
|
|
|
2005-02-28 09:41:25 +00:00
|
|
|
run_make_test('
|
2002-08-08 00:11:19 +00:00
|
|
|
.SUFFIXES:
|
|
|
|
|
|
|
|
.PHONY: all
|
|
|
|
all: foo
|
|
|
|
|
|
|
|
foo: bar.x
|
|
|
|
@echo cp $< $@
|
2002-09-10 22:23:20 +00:00
|
|
|
@echo "" > $@
|
2005-02-28 09:41:25 +00:00
|
|
|
',
|
|
|
|
'', 'cp bar.x foo');
|
2002-08-08 00:11:19 +00:00
|
|
|
|
2012-03-04 00:24:20 +00:00
|
|
|
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
|
2005-02-28 09:41:25 +00:00
|
|
|
run_make_test(undef, '-B', 'cp bar.x foo');
|
2002-08-08 00:11:19 +00:00
|
|
|
|
2005-02-28 09:41:25 +00:00
|
|
|
# Put the timestamp for foo into the future; it should still be remade.
|
2002-08-08 00:11:19 +00:00
|
|
|
|
2005-02-28 09:41:25 +00:00
|
|
|
utouch(1000, 'foo');
|
2012-03-04 00:24:20 +00:00
|
|
|
run_make_test(undef, '', "#MAKE#: Nothing to be done for 'all'.");
|
2005-02-28 09:41:25 +00:00
|
|
|
run_make_test(undef, '-B', 'cp bar.x foo');
|
2002-08-08 00:11:19 +00:00
|
|
|
|
2005-02-28 09:41:25 +00:00
|
|
|
# Clean up
|
2002-08-08 00:11:19 +00:00
|
|
|
|
2005-02-28 09:41:25 +00:00
|
|
|
rmfiles('bar.x', 'foo');
|
2002-08-08 00:11:19 +00:00
|
|
|
|
2005-06-25 18:57:28 +00:00
|
|
|
# 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');
|
|
|
|
|
2009-06-13 21:21:48 +00:00
|
|
|
# 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));
|
|
|
|
|
2002-08-08 00:11:19 +00:00
|
|
|
1;
|
2016-04-09 23:49:27 +00:00
|
|
|
|
|
|
|
### Local Variables:
|
|
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
|
|
### End:
|