Mail Archives: djgpp-workers/2000/01/16/04:04:44
On Fri, 14 Jan 2000 pavenis AT lanet DOT lv wrote:
> make -k -C 1 all
> make.exe[1]: Entering directory `c:/djgpp/test/makebug/1'
> c:/djgpp/test/makebug/1/foo
> make.exe[1]: *** [check1_curr] Error -1
> bash c:/djgpp/test/makebug/1/foo
> c:/djgpp/test/makebug/1/foo: c:/djgpp/test/makebug/1/foo: No such
> file or directory (ENOENT)
> make.exe[1]: *** [check2_curr] Error 127
> make.exe[1]: Target `all' not remade because of errors.
> make.exe[1]: Leaving directory `c:/djgpp/test/makebug/1'
> make.exe: *** [check_sub] Error 2
This is expected and documented behavior of GNU Make. See the section
"Variables/Recursion" in the Make's manual for more details.
First, variables defined by the Makefile are not passed to sub-Make's
unless you explicitly ask for that, like this:
export FOO = $(shell pwd)/foo
But even this is not enough: you must also instruct the sub-Make to
use variables it got from the environment in precedence to variables
defined in its own Makefile, like this:
check_sub:
make -e -k -C 1 all
(the -e switch is what does this).
On balance, I think it is much easier (and more portable) to pass the
variable through Make's command line:
check_sub:
make -k -C 1 all FOO=$(FOO)
This will always work, even if you don't use `export'.
- Raw text -