for one of the makefiles to be remade as a target on the command
line. Since we're not actually updating anything with -q we can
treat this as "did nothing". */
+ break;
case us_none:
- /* Did nothing. */
- break;
+ /* No makefiles needed to be updated. If we couldn't read some
+ included file that we care about, fail. */
+ {
+ int any_failed = 0;
+ struct goaldep *d;
+
+ for (d = read_files; d != 0; d = d->next)
+ if (d->error && ! (d->flags & RM_DONTCARE))
+ {
+ /* This makefile couldn't be loaded, and we care. */
+ OSS (error, &d->floc,
+ _("%s: %s"), dep_name (d), strerror (d->error));
+ any_failed = 1;
+ }
+
+ if (any_failed)
+ die (MAKE_FAILURE);
+ break;
+ }
case us_failed:
/* Failed to update. Figure out if we care. */
FILE_TIMESTAMP mtime;
/* The update failed and this makefile was not
from the MAKEFILES variable, so we care. */
- OS (error, NILF, _("Failed to remake makefile '%s'."),
+ OS (error, &d->floc,
+ _("Failed to remake makefile '%s'."),
d->file->name);
mtime = file_mtime_no_search (d->file);
any_remade |= (mtime != NONEXISTENT_MTIME
if (d->flags & RM_INCLUDED)
/* An included makefile. We don't need to die, but we
do want to complain. */
- error (NILF, l,
+ error (&d->floc, l,
_("Included makefile '%s' was not found."), dnm);
else
{
static const char *library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr);
\f
-/* Remake all the goals in the 'struct dep' chain GOALS. Return -1 if nothing
- was done, 0 if all goals were updated successfully, or 1 if a goal failed.
+/* Remake all the goals in the 'struct dep' chain GOALS. Return update_status
+ representing the totality of the status of the goals.
If rebuilding_makefiles is nonzero, these goals are makefiles, so -t, -q,
and -n should be disabled for them unless they were also command-line
FILE_TIMESTAMP mtime = MTIME (file);
check_renamed (file);
- if (file->updated && g->changed &&
- mtime != file->mtime_before_update)
+ if (file->updated && mtime != file->mtime_before_update)
{
/* Updating was done. If this is a makefile and
just_print_flag or question_flag is set (meaning
if (goal->error)
{
OSS (error, &goal->floc, "%s: %s",
- goal->file->name, strerror ((int)goal->error));
+ goal->file->name, strerror (goal->error));
goal->error = 0;
}
return;
/ 1e9));
char from_now_string[100];
- if (from_now >= 99 && from_now <= ULONG_MAX)
+ if (from_now >= 100.0 && from_now < (double) ULONG_MAX)
sprintf (from_now_string, "%lu", (unsigned long) from_now);
else
sprintf (from_now_string, "%.2g", from_now);
run_make_test('
all: ; @echo running rules.
-#MAKEFILE# incl.mk: incl-1.mk
- @echo rebuilding $@
- @echo >> $@
+#MAKEFILE# incl.mk: incl-1.mk ; @echo rebuilding $@; echo >> $@
include incl.mk',
'', "rebuilding incl.mk\nrunning rules.\n");
unlink('foo30723');
+# If ANY makefile is rebuilt then we should re-exec
+
+run_make_test('
+all: ; @echo RESTARTS=$(MAKE_RESTARTS)
+
+m1.d: ; @echo $@; touch $@
+
+m2.d: m1.d ; @test -f $< || { echo $@; touch $@; }
+
+include m1.d
+-include m2.d
+',
+ '', "m1.d\nRESTARTS=1\n");
+
+unlink('m1.d', 'm2.d');
+
+# Same as before but be sure we get error messages for un-created makefiles
+
+run_make_test('
+all: ; @echo RESTARTS=$(MAKE_RESTARTS)
+
+m1.d: ; @echo $@; touch $@
+
+m2.d: m1.d ; @test -f $< || { echo $@; touch $@; }
+
+include m1.d m2.d
+',
+ '', "m1.d\n#MAKEFILE#:8: m2.d: $ERR_no_such_file\n", 512);
+
+unlink('m1.d', 'm2.d');
+
# This tells the test driver that the perl test script executed properly.
1;
-
-### Local Variables:
-### eval: (setq whitespace-action (delq 'auto-cleanup whitespace-action))
-### End:
'-k',
"#MAKEFILE#:2: ifile: $ERR_no_such_file
#MAKE#: *** No rule to make target 'no-such-file', needed by 'ifile'.
-#MAKE#: Failed to remake makefile 'ifile'.
+#MAKEFILE#:2: Failed to remake makefile 'ifile'.
hi\n",
512);
}