3 $description = "Test GNU make's auto-reinvocation feature.";
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.";
10 $makefile2 = &get_tmpfile;
11 $makefile_orig = &get_tmpfile;
13 open(MAKEFILE,"> $makefile");
17 all: ; \@echo 'running rules.'
19 $makefile $makefile2: $makefile_orig
20 \@echo 'rebuilding \$\@.'
29 &utouch(-10, $makefile, $makefile2);
30 &touch($makefile_orig);
32 &run_make_with_options($makefile, "", &get_logfile, 0);
34 # Create the answer to what should be produced by this Makefile
36 $answer = "rebuilding $makefile2.\nrebuilding $makefile.\nrunning rules.\n";
38 &compare_output($answer,&get_logfile(1))
39 && unlink "$makefile_orig";
41 # In this test we create an included file that's out-of-date, but then
42 # the rule doesn't update it. Make shouldn't re-exec.
44 $makefile3 = &get_tmpfile;
46 open(MAKEFILE, "> $makefile3");
47 print MAKEFILE <<'EOM';
54 b : c ; [ -f $@ ] || echo >> $@
63 &utouch(-20, 'b','a');
67 # First try with the file that's not updated "once removed" from the
68 # file we're including.
70 &run_make_with_options($makefile3, "F=a", &get_logfile, 0);
72 $answer = "[ -f b ] || echo >> b\nhello\n";
73 &compare_output($answer,&get_logfile(1));
75 # Now try with the file we're not updating being the actual file we're
76 # including: this and the previous one test different parts of the code.
78 &run_make_with_options($makefile3, "F=b", &get_logfile, 0);
80 $answer = "[ -f b ] || echo >> b\nhello\n";
81 &compare_output($answer,&get_logfile(1));
85 # This tells the test driver that the perl test script executed properly.