help-make
[Top][All Lists]
Advanced

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

Re: findstring & ifeq


From: John Graham-Cumming
Subject: Re: findstring & ifeq
Date: Thu, 11 May 2006 16:29:06 +0200
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.6) Gecko/20040208 Thunderbird/0.5 Mnenhy/0.6.0.104

Ken Mankoff wrote:
# So... why doesn't this work?
%.o: %.f
ifeq ($(findstring $@,$(OBJ)),)
        @echo not found
else
        @echo found
endif

Because the ifeq is processed when the Makefile is being parsed and not when rules are run. In that case $@ is empty and hence this won't work. You can't use ifeq to change the body of a rule at run time.

But you could use $(if) instead:

    %.o: %.f
        @echo $(if $(findstring $@,$(OBJ)),found,not found)

John.
--
John Graham-Cumming
address@hidden

Home: http://www.jgc.org/
Blog: http://www.jgc.org/blog/

POPFile: http://getpopfile.org/
GNU Make Standard Library: http://gmsl.sf.net/
GNU Make Debugger: http://gmd.sf.net/
Fast, Parallel Builds: http://www.electric-cloud.com/

Sign up for my Spam and Anti-spam Newsletter
at http://www.jgc.org/

Help out in the fight against spam
http://www.spamorham.org/




reply via email to

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