mirror of
https://github.com/mirror/make.git
synced 2026-08-30 11:18:08 +08:00
[SV 60595] Restart whenever any makefile is rebuilt
Previously if an included makefile was rebuilt as a prerequisite of another included makefile which didn't need to be rebuilt, make would not realize that it needed to re-exec itself. Ensure that if any included makefile target is rebuilt we re-exec. Also ensure that if an included makefile is not readable, and our rule for rebuilding it doesn't actually change it, we will still fail. * src/remake.c (update_goal_chain): If a goal's update was successful then check its status, even if no actual commands were run because it was already up to date. (show_goal_error): Remove superfluous cast. * src/main.c (main): If the makefile remake did nothing, check that we were able to successfully include all the makefiles we care about; if not fail. When generating error messages about included makefiles be sure to show the filename/linenumber information. * test/scripts/features/reinvoke: Add tests for this behavior. * test/scripts/options/dash-k: Update error messages.
This commit is contained in:
@@ -17,9 +17,7 @@ $omkfile = $makefile;
|
||||
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");
|
||||
@@ -74,9 +72,36 @@ foo30723: ; @touch $@
|
||||
|
||||
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:
|
||||
|
||||
@@ -108,7 +108,7 @@ ifile: no-such-file; @false
|
||||
'-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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user