mirror of
https://github.com/mirror/make.git
synced 2025-03-14 03:40:32 +08:00
[SV 57676] Support included files being built after failing
If a -include file does not exist, then some subsequent operation creates it, then allow it to be successfully included. * src/read.c (eval_makefile): If our last mtime was NONEXISTENT then reset it to 0 so we'll check it again. * tests/scripts/features/include: Add a test for this behavior.
This commit is contained in:
parent
5e234e4048
commit
c4cc2e9595
@ -410,6 +410,11 @@ eval_makefile (const char *filename, unsigned short flags)
|
|||||||
/* Success; clear errno. */
|
/* Success; clear errno. */
|
||||||
deps->error = 0;
|
deps->error = 0;
|
||||||
|
|
||||||
|
/* If we tried and failed to read the included file before but this
|
||||||
|
time we succeeded, reset the last mtime. */
|
||||||
|
if (deps->file->last_mtime == NONEXISTENT_MTIME)
|
||||||
|
deps->file->last_mtime = 0;
|
||||||
|
|
||||||
/* Avoid leaking the makefile to children. */
|
/* Avoid leaking the makefile to children. */
|
||||||
fd_noinherit (fileno (ebuf.fp));
|
fd_noinherit (fileno (ebuf.fp));
|
||||||
|
|
||||||
|
@ -237,8 +237,8 @@ inc1: foo; echo > $@
|
|||||||
rmfiles('inc1');
|
rmfiles('inc1');
|
||||||
}
|
}
|
||||||
|
|
||||||
# Including files that can't be read should show an error
|
|
||||||
if (defined $ERR_unreadable_file) {
|
if (defined $ERR_unreadable_file) {
|
||||||
|
# Including files that can't be read should show an error
|
||||||
create_file('inc1', 'FOO := foo');
|
create_file('inc1', 'FOO := foo');
|
||||||
chmod 0000, 'inc1';
|
chmod 0000, 'inc1';
|
||||||
|
|
||||||
@ -271,7 +271,19 @@ run_make_test(q!
|
|||||||
all:;
|
all:;
|
||||||
!,
|
!,
|
||||||
'', "i1\ni2\ni3\ni4\n#MAKE#: 'all' is up to date.\n");
|
'', "i1\ni2\ni3\ni4\n#MAKE#: 'all' is up to date.\n");
|
||||||
rmfiles('foo');
|
|
||||||
|
# Check that included files work if created after the first include failed
|
||||||
|
# https://savannah.gnu.org/bugs/?57676
|
||||||
|
|
||||||
|
run_make_test(q!
|
||||||
|
-include hello.mk
|
||||||
|
$(shell echo hello=world >hello.mk)
|
||||||
|
include hello.mk
|
||||||
|
default:; @echo $(hello)
|
||||||
|
!,
|
||||||
|
'', "world\n");
|
||||||
|
|
||||||
|
unlink('hello.mk');
|
||||||
|
|
||||||
# Check the default makefiles... this requires us to invoke make with no
|
# Check the default makefiles... this requires us to invoke make with no
|
||||||
# arguments. Also check MAKEFILES
|
# arguments. Also check MAKEFILES
|
||||||
|
Loading…
Reference in New Issue
Block a user