I can pass a variable to child make using make -C VAR=$(VAR) target
(preferring this to export
because the variable is only meaningful for a single target). However, it appears that if VAR
variable isn't defined in parent, child gets an empty string (it has VAR ?= ...
, and the value of VAR
is empty). How can I avoid this?
It looks like a variation on Define make variable at rule execution time should work for my specific usecase, but it requires the parent Makefile to know child's default value, which I want to avoid.