| 1 | #                                                                    -*-perl-*- | 
|---|
| 2 |  | 
|---|
| 3 | $description ="The following test creates a makefile to test the -I option."; | 
|---|
| 4 |  | 
|---|
| 5 | $details = "\ | 
|---|
| 6 | This test tests the -I option by including a filename in | 
|---|
| 7 | another directory and giving make that directory name | 
|---|
| 8 | under -I in the command line.  Without this option, the make | 
|---|
| 9 | would fail to find the included file.  It also checks to make | 
|---|
| 10 | sure that the -I option gets passed to recursive makes."; | 
|---|
| 11 |  | 
|---|
| 12 | $makefile2 = &get_tmpfile; | 
|---|
| 13 |  | 
|---|
| 14 | open(MAKEFILE,"> $makefile"); | 
|---|
| 15 |  | 
|---|
| 16 | # The Contents of the MAKEFILE ... | 
|---|
| 17 |  | 
|---|
| 18 | $mf2 = substr ($makefile2, index ($makefile2, $pathsep) + 1); | 
|---|
| 19 | print MAKEFILE <<EOF; | 
|---|
| 20 | include $mf2 | 
|---|
| 21 | all: | 
|---|
| 22 | \t\@echo There should be no errors for this makefile. | 
|---|
| 23 | EOF | 
|---|
| 24 |  | 
|---|
| 25 | # END of Contents of MAKEFILE | 
|---|
| 26 |  | 
|---|
| 27 | close(MAKEFILE); | 
|---|
| 28 |  | 
|---|
| 29 |  | 
|---|
| 30 | open(MAKEFILE,"> $makefile2"); | 
|---|
| 31 |  | 
|---|
| 32 | print MAKEFILE <<EOF; | 
|---|
| 33 | ANOTHER: | 
|---|
| 34 | \t\@echo This is another included makefile | 
|---|
| 35 | recurse: | 
|---|
| 36 | \t\$(MAKE) ANOTHER -f $makefile | 
|---|
| 37 | EOF | 
|---|
| 38 |  | 
|---|
| 39 | close(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' | 
|---|
| 55 | This 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)); | 
|---|