You can make it work as follows:
a.mk ( b.mkdoes not exist at the moment )
-include b.mk
all:
@echo foo : $(FOO)
b.mk:
@echo "FOO=2" > b.mk
With make -f a.mk allwe get the following:
foo: 2
The sign -before the include directive allows you to not generate a warning if it b.mkdoes not exist.
MadScientist , b.mk . make , , , .