| 1 | # -*-mode: perl; rm-trailing-spaces: nil-*-
|
|---|
| 2 |
|
|---|
| 3 | $description = "Test various forms of the GNU make `include' command.";
|
|---|
| 4 |
|
|---|
| 5 | $details = "Test include, -include, sinclude and various regressions involving them.
|
|---|
| 6 | Test extra whitespace at the end of the include, multiple -includes and
|
|---|
| 7 | sincludes (should not give an error) and make sure that errors are reported
|
|---|
| 8 | for targets that were also -included.";
|
|---|
| 9 |
|
|---|
| 10 | $makefile2 = &get_tmpfile;
|
|---|
| 11 |
|
|---|
| 12 | open(MAKEFILE,"> $makefile");
|
|---|
| 13 |
|
|---|
| 14 | # The contents of the Makefile ...
|
|---|
| 15 |
|
|---|
| 16 | print MAKEFILE <<EOF;
|
|---|
| 17 | \#Extra space at the end of the following file name
|
|---|
| 18 | include $makefile2
|
|---|
| 19 | all: ; \@echo There should be no errors for this makefile.
|
|---|
| 20 |
|
|---|
| 21 | -include nonexistent.mk
|
|---|
| 22 | -include nonexistent.mk
|
|---|
| 23 | sinclude nonexistent.mk
|
|---|
| 24 | sinclude nonexistent-2.mk
|
|---|
| 25 | -include makeit.mk
|
|---|
| 26 | sinclude makeit.mk
|
|---|
| 27 |
|
|---|
| 28 | error: makeit.mk
|
|---|
| 29 | EOF
|
|---|
| 30 |
|
|---|
| 31 | close(MAKEFILE);
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | open(MAKEFILE,"> $makefile2");
|
|---|
| 35 |
|
|---|
| 36 | print MAKEFILE "ANOTHER: ; \@echo This is another included makefile\n";
|
|---|
| 37 |
|
|---|
| 38 | close(MAKEFILE);
|
|---|
| 39 |
|
|---|
| 40 | # Create the answer to what should be produced by this Makefile
|
|---|
| 41 | &run_make_with_options($makefile, "all", &get_logfile);
|
|---|
| 42 | $answer = "There should be no errors for this makefile.\n";
|
|---|
| 43 | &compare_output($answer, &get_logfile(1));
|
|---|
| 44 |
|
|---|
| 45 | &run_make_with_options($makefile, "ANOTHER", &get_logfile);
|
|---|
| 46 | $answer = "This is another included makefile\n";
|
|---|
| 47 | &compare_output($answer, &get_logfile(1));
|
|---|
| 48 |
|
|---|
| 49 | # Try to build the "error" target; this will fail since we don't know
|
|---|
| 50 | # how to create makeit.mk, but we should also get a message (even though
|
|---|
| 51 | # the -include suppressed it during the makefile read phase, we should
|
|---|
| 52 | # see one during the makefile run phase).
|
|---|
| 53 |
|
|---|
| 54 | # The fix to this caused more problems than the error, so I removed it.
|
|---|
| 55 | # pds -- 22 Jan 2000
|
|---|
| 56 |
|
|---|
| 57 | #&run_make_with_options($makefile, "error", &get_logfile, 512);
|
|---|
| 58 | #$answer = "$make_name: *** No rule to make target `makeit.mk', needed by `error'.\n";
|
|---|
| 59 | #&compare_output($answer, &get_logfile(1));
|
|---|
| 60 |
|
|---|
| 61 | 1;
|
|---|