summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Smith <psmith@gnu.org>2009-06-13 23:10:52 +0000
committerPaul Smith <psmith@gnu.org>2009-06-13 23:10:52 +0000
commitdceb954f9c0a948b8d53796fd78b7cfae9148b1b (patch)
tree99906d4dae8d094097f37927affa603e498510b1
parent38b23bc3f02ec199370865be9bd970e6318fa1d2 (diff)
downloadgunmake-dceb954f9c0a948b8d53796fd78b7cfae9148b1b.tar.gz
- Fix Savannah bug #13401
-rw-r--r--ChangeLog5
-rw-r--r--doc/make.texi11
-rw-r--r--read.c6
-rw-r--r--tests/ChangeLog4
-rw-r--r--tests/scripts/variables/MAKEFILES19
5 files changed, 38 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 92637f7..0083137 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
2009-06-13 Paul Smith <psmith@gnu.org>
+ * doc/make.texi (MAKEFILES Variable): Be explicit that files
+ included by MAKEFILES cannot give default goals.
+ * read.c (eval): If set_default is not set, pass the no-default-goal
+ value when we read included makefiles. Fixes Savannah bug #13401.
+
* ar.c (ar_name): Ensure that targets with empty parens aren't
considered archive member references: archive members must have a
non-empty "member" string. Fixes Savannah bug #18435.
diff --git a/doc/make.texi b/doc/make.texi
index 3dea3d6..9ca410b 100644
--- a/doc/make.texi
+++ b/doc/make.texi
@@ -1191,11 +1191,12 @@ For compatibility with some other @code{make} implementations,
@vindex MAKEFILES
If the environment variable @code{MAKEFILES} is defined, @code{make}
considers its value as a list of names (separated by whitespace) of
-additional makefiles to be read before the others. This works much like
-the @code{include} directive: various directories are searched for those
-files (@pxref{Include, ,Including Other Makefiles}). In addition, the
-default goal is never taken from one of these makefiles and it is not an
-error if the files listed in @code{MAKEFILES} are not found.@refill
+additional makefiles to be read before the others. This works much
+like the @code{include} directive: various directories are searched
+for those files (@pxref{Include, ,Including Other Makefiles}). In
+addition, the default goal is never taken from one of these makefiles
+(or any makefile included by them) and it is not an error if the files
+listed in @code{MAKEFILES} are not found.@refill
@cindex recursion, and @code{MAKEFILES} variable
The main use of @code{MAKEFILES} is in communication between recursive
diff --git a/read.c b/read.c
index 3071ae5..19d5559 100644
--- a/read.c
+++ b/read.c
@@ -857,8 +857,10 @@ eval (struct ebuffer *ebuf, int set_default)
free (files);
files = next;
- r = eval_makefile (name, (RM_INCLUDED | RM_NO_TILDE
- | (noerror ? RM_DONTCARE : 0)));
+ r = eval_makefile (name,
+ (RM_INCLUDED | RM_NO_TILDE
+ | (noerror ? RM_DONTCARE : 0)
+ | (set_default ? 0 : RM_NO_DEFAULT_GOAL)));
if (!r && !noerror)
error (fstart, "%s: %s", name, strerror (errno));
}
diff --git a/tests/ChangeLog b/tests/ChangeLog
index ddae67e..7b414c5 100644
--- a/tests/ChangeLog
+++ b/tests/ChangeLog
@@ -1,5 +1,9 @@
2009-06-13 Paul Smith <psmith@gnu.org>
+ * scripts/variables/MAKEFILES: Verify that MAKEFILES included
+ files (and files included by them) don't set the default goal.
+ Savannah bug #13401.
+
* scripts/functions/wildcard: Test that wildcards with
non-existent glob matchers return empty.
diff --git a/tests/scripts/variables/MAKEFILES b/tests/scripts/variables/MAKEFILES
index 3be284b..b23da8e 100644
--- a/tests/scripts/variables/MAKEFILES
+++ b/tests/scripts/variables/MAKEFILES
@@ -31,4 +31,23 @@ close(MAKEFILE);
$answer = "DEFAULT RULE: M2=m2 M3=m3\n";
&compare_output($answer,&get_logfile(1));
+# TEST 2: Verify that included makefiles don't set the default goal.
+# See Savannah bug #13401.
+
+create_file('xx-inc.mk', '
+include_goal: ; @echo $@
+include xx-ind.mk
+');
+
+create_file('xx-ind.mk', '
+indirect_goal: ; @echo $@
+');
+
+run_make_test(q!
+top: ; @echo $@
+!,
+ 'MAKEFILES=xx-inc.mk', "top\n");
+
+unlink(qw(xx-inc.mk xx-ind.mk));
+
1;