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