help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: conflict of make autovaribable and shell register


From: Dave Hylands
Subject: Re: conflict of make autovaribable and shell register
Date: Fri, 23 Dec 2005 23:43:03 -0800

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/




reply via email to

[Prev in Thread] Current Thread [Next in Thread]