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