VirtualBox

source: kBuild/branches/GNU/src/gmake/tests/scripts/features/reinvoke@ 54

Last change on this file since 54 was 53, checked in by bird, 21 years ago

Initial revision

  • Property svn:eol-style set to native
File size: 2.0 KB
Line 
1# -*-mode: perl-*-
2
3$description = "Test GNU make's auto-reinvocation feature.";
4
5$details = "\
6If the makefile or one it includes can be rebuilt then it is, and make
7is reinvoked. We create a rule to rebuild the makefile from a temp
8file, then touch the temp file to make it newer than the makefile.";
9
10$makefile2 = &get_tmpfile;
11$makefile_orig = &get_tmpfile;
12
13open(MAKEFILE,"> $makefile");
14
15print MAKEFILE <<EOM;
16
17all: ; \@echo 'running rules.'
18
19$makefile $makefile2: $makefile_orig
20 \@echo 'rebuilding \$\@.'
21 \@echo >> \$\@
22
23include $makefile2
24
25EOM
26
27close(MAKEFILE);
28
29&utouch(-10, $makefile, $makefile2);
30&touch($makefile_orig);
31
32&run_make_with_options($makefile, "", &get_logfile, 0);
33
34# Create the answer to what should be produced by this Makefile
35
36$answer = "rebuilding $makefile2.\nrebuilding $makefile.\nrunning rules.\n";
37
38&compare_output($answer,&get_logfile(1))
39 && unlink "$makefile_orig";
40
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.
43
44$makefile3 = &get_tmpfile;
45
46open(MAKEFILE, "> $makefile3");
47print MAKEFILE <<'EOM';
48SHELL = /bin/sh
49
50all: ; @echo hello
51
52a : b ; echo >> $@
53
54b : c ; [ -f $@ ] || echo >> $@
55
56c: ; echo >> $@
57
58include $(F)
59EOM
60
61close(MAKEFILE);
62
63&utouch(-20, 'b','a');
64#&utouch(-10, 'a');
65&touch('c');
66
67# First try with the file that's not updated "once removed" from the
68# file we're including.
69
70&run_make_with_options($makefile3, "F=a", &get_logfile, 0);
71
72$answer = "[ -f b ] || echo >> b\nhello\n";
73&compare_output($answer,&get_logfile(1));
74
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.
77
78&run_make_with_options($makefile3, "F=b", &get_logfile, 0);
79
80$answer = "[ -f b ] || echo >> b\nhello\n";
81&compare_output($answer,&get_logfile(1));
82
83unlink('a','b','c');
84
85# This tells the test driver that the perl test script executed properly.
861;
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette