| 1 |
# -*-mode: perl-*- |
| 2 |
|
| 3 |
$description = "Test GNU make's auto-reinvocation feature."; |
| 4 |
|
| 5 |
$details = "\ |
| 6 |
If the makefile or one it includes can be rebuilt then it is, and make |
| 7 |
is reinvoked. We create a rule to rebuild the makefile from a temp |
| 8 |
file, then touch the temp file to make it newer than the makefile."; |
| 9 |
|
| 10 |
$omkfile = $makefile; |
| 11 |
|
| 12 |
&utouch(-600, 'incl.mk'); |
| 13 |
# For some reason if we don't do this then the test fails for systems |
| 14 |
# with sub-second timestamps, maybe + NFS? Not sure. |
| 15 |
&utouch(-1, 'incl-1.mk'); |
| 16 |
|
| 17 |
run_make_test(' |
| 18 |
all: ; @echo running rules. |
| 19 |
|
| 20 |
#MAKEFILE# incl.mk: incl-1.mk |
| 21 |
@echo rebuilding $@ |
| 22 |
@echo >> $@ |
| 23 |
|
| 24 |
include incl.mk', |
| 25 |
'', "rebuilding incl.mk\nrunning rules.\n"); |
| 26 |
|
| 27 |
# Make sure updating the makefile itself also works |
| 28 |
|
| 29 |
&utouch(-600, $omkfile); |
| 30 |
|
| 31 |
run_make_test(undef, '', "rebuilding #MAKEFILE#\nrunning rules.\n"); |
| 32 |
|
| 33 |
&rmfiles('incl.mk', 'incl-1.mk'); |
| 34 |
|
| 35 |
|
| 36 |
# In this test we create an included file that's out-of-date, but then |
| 37 |
# the rule doesn't update it. Make shouldn't re-exec. |
| 38 |
|
| 39 |
&utouch(-600, 'b','a'); |
| 40 |
#&utouch(-10, 'a'); |
| 41 |
&touch('c'); |
| 42 |
|
| 43 |
run_make_test(' |
| 44 |
all: ; @echo hello |
| 45 |
|
| 46 |
a : b ; echo >> $@ |
| 47 |
|
| 48 |
b : c ; [ -f $@ ] || echo >> $@ |
| 49 |
|
| 50 |
c: ; echo >> $@ |
| 51 |
|
| 52 |
include $(F)', |
| 53 |
'F=a', "[ -f b ] || echo >> b\nhello\n"); |
| 54 |
|
| 55 |
# Now try with the file we're not updating being the actual file we're |
| 56 |
# including: this and the previous one test different parts of the code. |
| 57 |
|
| 58 |
run_make_test(undef, 'F=b', "[ -f b ] || echo >> b\nhello\n"); |
| 59 |
|
| 60 |
&rmfiles('a','b','c'); |
| 61 |
|
| 62 |
# Ensure command line variables are preserved properly across re-exec |
| 63 |
# Tests for Savannah bug #30723 |
| 64 |
|
| 65 |
run_make_test(' |
| 66 |
ifdef RECURSE |
| 67 |
-include foo30723 |
| 68 |
endif |
| 69 |
recurse: ; @$(MAKE) -f $(MAKEFILE_LIST) RECURSE=1 test |
| 70 |
test: ; @echo F.O=$(F.O) |
| 71 |
foo30723: ; @touch $@ |
| 72 |
', |
| 73 |
'--no-print-directory F.O=bar', "F.O=bar\n"); |
| 74 |
|
| 75 |
unlink('foo30723'); |
| 76 |
|
| 77 |
# This tells the test driver that the perl test script executed properly. |
| 78 |
1; |
| 79 |
|
| 80 |
### Local Variables: |
| 81 |
### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action)) |
| 82 |
### End: |