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: Philip Guenther
Subject: Re: How to test if a file is existed or not?
Date: Tue, 20 May 2008 19:23:38 -0600

On Tue, May 20, 2008 at 4:32 PM, Peng Yu <address@hidden> wrote:
> What if I want to either include some file or define some other variables
> depending on whether the file is existed or not?

Use -include and then test for the presence of the filename in ${MAKEFILE_LIST}:

-include foo
ifeq ($(filter foo,${MAKEFILE_LIST}),)
$(info foo doesn't exist)
endif

MAKEFILE_LIST was added in 3.80, so you'll need at least that version
to do this.


Philip Guenther




reply via email to

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