VirtualBox

source: kBuild/trunk/src/gmake/tests/scripts/targets/PHONY@ 285

Last change on this file since 285 was 285, checked in by bird, 20 years ago

This commit was generated by cvs2svn to compensate for changes in r284,
which included commits to RCS files with non-trunk default branches.

  • Property svn:eol-style set to native
File size: 1.4 KB
Line 
1$description = "The following tests the use of a PHONY target. It makes\n"
2 ."sure that the rules under a target get executed even if\n"
3 ."a filename of the same name of the target exists in the\n"
4 ."directory.\n";
5
6$details = "This makefile in this test declares the target clean to be a \n"
7 ."PHONY target. We then create a file named \"clean\" in the \n"
8 ."directory. Although this file exists, the rule under the target\n"
9 ."clean should still execute because of it's phony status.";
10
11if ($vos)
12{
13 $delete_command = "delete_file";
14}
15else
16{
17 $delete_command = "rm";
18}
19
20$example = "EXAMPLE_FILE";
21
22open(MAKEFILE,"> $makefile");
23
24# The Contents of the MAKEFILE ...
25
26print MAKEFILE ".PHONY : clean \n";
27print MAKEFILE "all: \n";
28print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n";
29print MAKEFILE "clean: \n";
30print MAKEFILE "\t$delete_command $example clean\n";
31
32# END of Contents of MAKEFILE
33
34close(MAKEFILE);
35
36&touch($example);
37
38# Create a file named "clean". This is the same name as the target clean
39# and tricks the target into thinking that it is up to date. (Unless you
40# use the .PHONY target.
41&touch("clean");
42
43$answer = "$delete_command $example clean\n";
44&run_make_with_options($makefile,"clean",&get_logfile);
45
46if (-f $example) {
47 $test_passed = 0;
48}
49
50&compare_output($answer,&get_logfile(1));
51
521;
53
54
55
56
57
58
59
60
61
Note: See TracBrowser for help on using the repository browser.

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