Imported Upstream version 3.82
[platform/upstream/make.git] / tests / scripts / targets / clean
1 #                                                                    -*-perl-*-
2
3 $description = "The following test creates a makefile to delete a \n"
4               ."file in the directory.  It tests to see if make will \n"
5               ."NOT execute the command unless the rule is given in \n"
6               ."the make command line.";
7
8 $example = "EXAMPLE_FILE";
9
10 open(MAKEFILE,"> $makefile");
11
12 # The Contents of the MAKEFILE ...
13
14 print MAKEFILE "all: \n";
15 print MAKEFILE "\t\@echo This makefile did not clean the dir... good\n";
16 print MAKEFILE "clean: \n";
17 print MAKEFILE "\t$delete_command EXAMPLE_FILE\n";
18
19 # END of Contents of MAKEFILE
20
21 close(MAKEFILE);
22
23 &touch($example);
24
25
26 &run_make_with_options($makefile,"",&get_logfile,0);
27
28 # Create the answer to what should be produced by this Makefile
29 $answer = "This makefile did not clean the dir... good\n";
30
31 &compare_output($answer,&get_logfile(1)) || &error ("abort");
32
33
34 $answer = "$delete_command $example\n";
35 &run_make_with_options($makefile,"clean",&get_logfile,0);
36 if (-f $example) {
37   $test_passed = 0;
38 }
39 &compare_output($answer,&get_logfile(1)) || &error ("abort");
40
41 1;
42
43
44
45
46
47
48
49
50