Date: Sun, 16 Jan 2000 10:13:12 +0200 (IST) From: Eli Zaretskii X-Sender: eliz AT is To: djgpp-workers AT delorie DOT com Subject: Re: Problem with make In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Reply-To: djgpp-workers AT delorie DOT com Errors-To: dj-admin AT delorie DOT com X-Mailing-List: djgpp-workers AT delorie DOT com X-Unsubscribes-To: listserv AT delorie DOT com Precedence: bulk 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'.