1999-09-14 02:03:19 +00:00
|
|
|
# -*-mode: perl-*-
|
|
|
|
|
|
|
|
$description = "Test GNU make's auto-reinvocation feature.";
|
|
|
|
|
|
|
|
$details = "\
|
|
|
|
If the makefile or one it includes can be rebuilt then it is, and make
|
|
|
|
is reinvoked. We create a rule to rebuild the makefile from a temp
|
|
|
|
file, then touch the temp file to make it newer than the makefile.";
|
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
$omkfile = $makefile;
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
&utouch(-600, 'incl.mk');
|
|
|
|
# For some reason if we don't do this then the test fails for systems
|
|
|
|
# with sub-second timestamps, maybe + NFS? Not sure.
|
|
|
|
&utouch(-1, 'incl-1.mk');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
run_make_test('
|
|
|
|
all: ; @echo running rules.
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
#MAKEFILE# incl.mk: incl-1.mk
|
|
|
|
@echo rebuilding $@
|
|
|
|
@echo >> $@
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
include incl.mk',
|
|
|
|
'', "rebuilding incl.mk\nrunning rules.\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
# Make sure updating the makefile itself also works
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
&utouch(-600, $omkfile);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
run_make_test(undef, '', "rebuilding #MAKEFILE#\nrunning rules.\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
&rmfiles('incl.mk', 'incl-1.mk');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
|
|
|
|
# In this test we create an included file that's out-of-date, but then
|
|
|
|
# the rule doesn't update it. Make shouldn't re-exec.
|
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
&utouch(-600, 'b','a');
|
|
|
|
#&utouch(-10, 'a');
|
|
|
|
&touch('c');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
run_make_test('
|
1999-09-14 02:03:19 +00:00
|
|
|
all: ; @echo hello
|
|
|
|
|
1999-09-17 03:15:37 +00:00
|
|
|
a : b ; echo >> $@
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2020-05-03 17:39:55 +00:00
|
|
|
b : c ; test -f $@ || echo >> $@
|
1999-09-14 02:03:19 +00:00
|
|
|
|
1999-09-17 03:15:37 +00:00
|
|
|
c: ; echo >> $@
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
include $(F)',
|
2020-05-03 17:39:55 +00:00
|
|
|
'F=a', "test -f b || echo >> b\nhello\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
# Now try with the file we're not updating being the actual file we're
|
|
|
|
# including: this and the previous one test different parts of the code.
|
|
|
|
|
2020-05-03 17:39:55 +00:00
|
|
|
run_make_test(undef, 'F=b', "test -f b || echo >> b\nhello\n");
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2005-06-27 22:18:47 +00:00
|
|
|
&rmfiles('a','b','c');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2010-08-10 07:35:34 +00:00
|
|
|
# Ensure command line variables are preserved properly across re-exec
|
|
|
|
# Tests for Savannah bug #30723
|
|
|
|
|
|
|
|
run_make_test('
|
|
|
|
ifdef RECURSE
|
|
|
|
-include foo30723
|
|
|
|
endif
|
|
|
|
recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test
|
|
|
|
test: ; @echo F.O=$(F.O)
|
|
|
|
foo30723: ; @touch $@
|
|
|
|
',
|
|
|
|
'--no-print-directory F.O=bar', "F.O=bar\n");
|
|
|
|
|
|
|
|
unlink('foo30723');
|
|
|
|
|
1999-09-14 02:03:19 +00:00
|
|
|
# This tells the test driver that the perl test script executed properly.
|
|
|
|
1;
|
2017-04-17 19:37:57 +00:00
|
|
|
|
|
|
|
### Local Variables:
|
|
|
|
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
|
|
|
|
### End:
|