|
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:
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 |
|
|---|
| 11 | if ($vos)
|
|---|
| 12 | {
|
|---|
| 13 | $delete_command = "delete_file";
|
|---|
| 14 | }
|
|---|
| 15 | else
|
|---|
| 16 | {
|
|---|
| 17 | $delete_command = "rm";
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | $example = "EXAMPLE_FILE";
|
|---|
| 21 |
|
|---|
| 22 | open(MAKEFILE,"> $makefile");
|
|---|
| 23 |
|
|---|
| 24 | # The Contents of the MAKEFILE ...
|
|---|
| 25 |
|
|---|
| 26 | print MAKEFILE ".PHONY : clean \n";
|
|---|
| 27 | print MAKEFILE "all: \n";
|
|---|
| 28 | print MAKEFILE "\t\@echo This makefile did not clean the dir ... good\n";
|
|---|
| 29 | print MAKEFILE "clean: \n";
|
|---|
| 30 | print MAKEFILE "\t$delete_command $example clean\n";
|
|---|
| 31 |
|
|---|
| 32 | # END of Contents of MAKEFILE
|
|---|
| 33 |
|
|---|
| 34 | close(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 |
|
|---|
| 46 | &compare_output($answer,&get_logfile(1));
|
|---|
| 47 |
|
|---|
| 48 | if (-f $example)
|
|---|
| 49 | {
|
|---|
| 50 | $test_passed = 0;
|
|---|
| 51 | }
|
|---|
| 52 |
|
|---|
| 53 | 1;
|
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
|
|---|
| 57 |
|
|---|
| 58 |
|
|---|
| 59 |
|
|---|
| 60 |
|
|---|
| 61 |
|
|---|
| 62 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.