[SV 63484] Force included makefiles to be explicit

Ensure included makefiles are not treated as intermediate, even if
they are created by an implicit rule.
Reported by Patrick Oppenlander <patrick.oppenlander@gmail.com>.

* src/read.c (eval_makefile): Mark makefiles as explicit.
* tests/scripts/features/include: Add a test.
This commit is contained in:
Dmitry Goncharov 2022-12-17 14:12:41 -05:00 committed by Paul Smith
parent 5d1b757517
commit 95c2db7b8d
2 changed files with 16 additions and 0 deletions

View File

@ -404,6 +404,7 @@ eval_makefile (const char *filename, unsigned short flags)
deps->file = enter_file (filename);
filename = deps->file->name;
deps->flags = flags;
deps->file->is_explicit = 1;
free (expanded);

View File

@ -472,4 +472,19 @@ all: ;
'', "C:__foobar\n#MAKE#: 'all' is up to date.");
}
# sv 63484.
# Test that included makefiles are not intermediate.
# Here 'test.foo' is mentioned explicitly and cannot be considered
# intermediate.
&touch('test.foo', 'test.x', 'test');
run_make_test(q!
.PHONY: force
include test.foo
%.foo: force; touch -a $@
%.x: %.foo; touch $@
test: test.x; touch $@
!, '', "touch -a test.foo\n#MAKE#: 'test' is up to date.\n");
unlink('test.foo', 'test.x', 'test');
1;