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