xref: /netbsd-src/external/gpl2/gmake/dist/tests/scripts/options/dash-I (revision 69606e3f5c9388e52aed8c120ad63c049ca45d8f)
1*69606e3fSchristos#                                                                    -*-perl-*-
2*69606e3fSchristos
3*69606e3fSchristos$description ="The following test creates a makefile to test the -I option.";
4*69606e3fSchristos
5*69606e3fSchristos$details = "\
6*69606e3fSchristosThis test tests the -I option by including a filename in
7*69606e3fSchristosanother directory and giving make that directory name
8*69606e3fSchristosunder -I in the command line.  Without this option, the make
9*69606e3fSchristoswould fail to find the included file.  It also checks to make
10*69606e3fSchristossure that the -I option gets passed to recursive makes.";
11*69606e3fSchristos
12*69606e3fSchristos$makefile2 = &get_tmpfile;
13*69606e3fSchristos
14*69606e3fSchristosopen(MAKEFILE,"> $makefile");
15*69606e3fSchristos
16*69606e3fSchristos# The Contents of the MAKEFILE ...
17*69606e3fSchristos
18*69606e3fSchristos$mf2 = substr ($makefile2, index ($makefile2, $pathsep) + 1);
19*69606e3fSchristosprint MAKEFILE <<EOF;
20*69606e3fSchristosinclude $mf2
21*69606e3fSchristosall:
22*69606e3fSchristos\t\@echo There should be no errors for this makefile.
23*69606e3fSchristosEOF
24*69606e3fSchristos
25*69606e3fSchristos# END of Contents of MAKEFILE
26*69606e3fSchristos
27*69606e3fSchristosclose(MAKEFILE);
28*69606e3fSchristos
29*69606e3fSchristos
30*69606e3fSchristosopen(MAKEFILE,"> $makefile2");
31*69606e3fSchristos
32*69606e3fSchristosprint MAKEFILE <<EOF;
33*69606e3fSchristosANOTHER:
34*69606e3fSchristos\t\@echo This is another included makefile
35*69606e3fSchristosrecurse:
36*69606e3fSchristos\t\$(MAKE) ANOTHER -f $makefile
37*69606e3fSchristosEOF
38*69606e3fSchristos
39*69606e3fSchristosclose(MAKEFILE);
40*69606e3fSchristos
41*69606e3fSchristos&run_make_with_options($makefile,"-I $workdir all",&get_logfile);
42*69606e3fSchristos
43*69606e3fSchristos# Create the answer to what should be produced by this Makefile
44*69606e3fSchristos$answer = "There should be no errors for this makefile.\n";
45*69606e3fSchristos&compare_output($answer,&get_logfile(1));
46*69606e3fSchristos
47*69606e3fSchristos
48*69606e3fSchristos$answer = "This is another included makefile\n";
49*69606e3fSchristos&run_make_with_options($makefile,"-I $workdir ANOTHER",&get_logfile);
50*69606e3fSchristos&compare_output($answer,&get_logfile(1));
51*69606e3fSchristos
52*69606e3fSchristos
53*69606e3fSchristos$answer = "$mkpath ANOTHER -f $makefile
54*69606e3fSchristos${make_name}[1]: Entering directory `$pwd'
55*69606e3fSchristosThis is another included makefile
56*69606e3fSchristos${make_name}[1]: Leaving directory `$pwd'\n";
57*69606e3fSchristos
58*69606e3fSchristos&run_make_with_options($makefile,"-I $workdir recurse",&get_logfile);
59*69606e3fSchristos&compare_output($answer,&get_logfile(1));
60