help-make
[Top][All Lists]
Advanced

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

Re: How to test if a file is existed or not?


From: Peng Yu
Subject: Re: How to test if a file is existed or not?
Date: Tue, 20 May 2008 17:32:33 -0500

Hi Philip,

What if I want to either include some file or define some other variables depending on whether the file is existed or not?

For example, I want something like this. Therefore, I still need to test whether a file exist or not. Can this be done in gmake?

#if file exist
include file
#else
VAR1 = bla bla
VAR2 = bla bla
#endif

Thanks,
Peng

On Tue, May 20, 2008 at 5:28 PM, Peng Yu <address@hidden> wrote:
Hi Philip,

I missed that part. Now I see that I should use -include.

Thanks,
Peng


On Tue, May 20, 2008 at 5:24 PM, Philip Guenther <address@hidden> wrote:
On Tue, May 20, 2008 at 4:10 PM, Peng Yu <address@hidden> wrote:
> I want to include a file only if it is existed. Is there something in gmake
> that can do this?

If you mean "include" as in "make part of the build" then the
$(wildcard) function may do the trick.

If you mean 'include' in the "treat as additional Makefile contents",
then the answer is yes, and it is described on the same page in the
GNU make info manual as the normal "include" directive.


Philip Guenther



reply via email to

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