Sending to the list...

Hi Robin,

> I want to test a file exist in a makefile,
> and write a below sentence:
>
> EXISTED := $(shell test -e foo.c && echo $?)
>
> but the shell function always return NULL,
> i think make treated the shell register "$?"
> as her autovarible "$?".

You need to escape the $.

EXISTED := $(shell test -e foo.c && echo $$?)

You can also use the wildcard function directly in make.

EXISTED := $(wildcard foo.c)

If foo.c doesn't exist, then $(wildcard ...) returns an empty string.

--
Dave Hylands
Vancouver, BC, Canada
http://www.DaveHylands.com/


_______________________________________________
Help-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/help-make

Reply via email to