1 # -*-mode: perl; rm-trailing-spaces: nil-*-
3 $description = "Test various forms of the GNU make `include' command.";
6 Test include, -include, sinclude and various regressions involving them.
7 Test extra whitespace at the end of the include, multiple -includes and
8 sincludes (should not give an error) and make sure that errors are reported
9 for targets that were also -included.";
11 $makefile2 = &get_tmpfile;
13 open(MAKEFILE,"> $makefile");
15 # The contents of the Makefile ...
18 \#Extra space at the end of the following file name
20 all: ; \@echo There should be no errors for this makefile.
22 -include nonexistent.mk
23 -include nonexistent.mk
24 sinclude nonexistent.mk
25 sinclude nonexistent-2.mk
35 open(MAKEFILE,"> $makefile2");
37 print MAKEFILE "ANOTHER: ; \@echo This is another included makefile\n";
41 # Create the answer to what should be produced by this Makefile
42 &run_make_with_options($makefile, "all", &get_logfile);
43 $answer = "There should be no errors for this makefile.\n";
44 &compare_output($answer, &get_logfile(1));
46 &run_make_with_options($makefile, "ANOTHER", &get_logfile);
47 $answer = "This is another included makefile\n";
48 &compare_output($answer, &get_logfile(1));
52 # Try to build the "error" target; this will fail since we don't know
53 # how to create makeit.mk, but we should also get a message (even though
54 # the -include suppressed it during the makefile read phase, we should
55 # see one during the makefile run phase).
60 error: foo.mk ; @echo $@
63 "#MAKE#: *** No rule to make target `foo.mk', needed by `error'. Stop.\n",
67 # Make sure that target-specific variables don't impact things. This could
68 # happen because a file record is created when a target-specific variable is
82 # Test inheritance of dontcare flag when rebuilding makefiles.
94 # Make sure that we don't die when the command fails but we dontcare.
95 # (Savannah bug #13216).
108 # Check include, sinclude, -include with no filenames.
109 # (Savannah bug #1761).
119 # Test that the diagnostics is issued even if the target has been
120 # tried before with the dontcare flag (direct dependency case).
131 "#MAKE#: *** No rule to make target `baz', needed by `bar'. Stop.\n",
134 # Test that the diagnostics is issued even if the target has been
135 # tried before with the dontcare flag (indirect dependency case).
147 "#MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n",
150 # Test that the diagnostics is issued even if the target has been
151 # tried before with the dontcare flag (include/-include case).
164 "#MAKEFILE#:2: bar: No such file or directory
165 #MAKE#: *** No rule to make target `end', needed by `baz'. Stop.\n",
169 # Test that include of a rebuild-able file doesn't show a warning
173 foo: ; @echo foo = bar > $@
175 '', "#MAKE#: `foo' is up to date.\n");