2005-12-13 14:44:17 +00:00
|
|
|
# -*-perl-*-
|
|
|
|
|
1999-09-14 02:03:19 +00:00
|
|
|
$description = "The following tests the use of a PHONY target. It makes\n"
|
|
|
|
."sure that the rules under a target get executed even if\n"
|
|
|
|
."a filename of the same name of the target exists in the\n"
|
|
|
|
."directory.\n";
|
|
|
|
|
|
|
|
$details = "This makefile in this test declares the target clean to be a \n"
|
|
|
|
."PHONY target. We then create a file named \"clean\" in the \n"
|
|
|
|
."directory. Although this file exists, the rule under the target\n"
|
|
|
|
."clean should still execute because of it's phony status.";
|
|
|
|
|
|
|
|
$example = "EXAMPLE_FILE";
|
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
touch($example);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
|
|
|
# Create a file named "clean". This is the same name as the target clean
|
2004-05-16 19:16:52 +00:00
|
|
|
# and tricks the target into thinking that it is up to date. (Unless you
|
1999-09-14 02:03:19 +00:00
|
|
|
# use the .PHONY target.
|
2016-12-23 18:33:58 +00:00
|
|
|
touch('clean');
|
|
|
|
|
|
|
|
open(MAKEFILE, "> $makefile");
|
|
|
|
print MAKEFILE qq!
|
|
|
|
.PHONY : clean
|
|
|
|
all: ; \@echo This makefile did not clean the dir ... good
|
|
|
|
clean: ; $CMD_rmfile $example clean
|
|
|
|
!;
|
|
|
|
close(MAKEFILE);
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
$answer = "$CMD_rmfile $example clean\n";
|
1999-09-14 02:03:19 +00:00
|
|
|
&run_make_with_options($makefile,"clean",&get_logfile);
|
|
|
|
|
2004-05-16 19:16:52 +00:00
|
|
|
if (-f $example) {
|
|
|
|
$test_passed = 0;
|
1999-09-14 02:03:19 +00:00
|
|
|
}
|
2004-05-16 19:16:52 +00:00
|
|
|
|
|
|
|
&compare_output($answer,&get_logfile(1));
|
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
# Just in case
|
|
|
|
unlink($example, 'clean');
|
1999-09-14 02:03:19 +00:00
|
|
|
|
2016-12-23 18:33:58 +00:00
|
|
|
1;
|