help-make
[Top][All Lists]
Advanced

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

RE: if-conditionals


From: Alexander.Farber
Subject: RE: if-conditionals
Date: Mon, 13 Dec 2004 17:51:10 +0100

Thanks, actually my biggest problem is matching 
a text string in a case-insensitive way: 

        ifeq (KSRT, $(findstring KSRT, $(TARGET)))

Do I have to come up here with something ugly like:

        $(shell echo $(TARGET) | tr 'A-z' 'a-z')

Also, I'm not sure what are the user-defined 
functions everyone keeps talking about on this list. 
We use gmake 3.81 (+some patch) on Linux/HP-UX here.

And for the spaces after commas - the whitespace after
the commas seems to be stripped or am I wrong here:

bolinux72:make-test {86} cat Makefile2
CC=gcc
ifeq ($(CC), gcc)
$(warning OK)
endif

all:

bolinux72:make-test {87} gmake -f Makefile2
Makefile2:3: OK
gmake: Nothing to be done for `all'.


Regards
Alex

> -----Original Message-----
> From: ext Noel Yap [mailto:address@hidden
> Sent: Monday, December 13, 2004 5:30 PM
> To: Farber Alexander (Nokia-TP/Bochum)
> Cc: address@hidden
> Subject: Re: if-conditionals
> 
> 
> address@hidden wrote:
> 
> > Hi,
> > 
> > I have 3 questions related to if-conditionals:
> > 
> > 1) I wonder, why are there never spaces after commas in 
> >    the manual, like for example here: ifeq ($(CC),gcc).
> >    Is it OK to put spaces after commas (I guess yes)?
> 
> Spaces are allowed but depending on what you want, it may not 
> be the correct thing to do; they are used as part of the match.
> 
> > 2) How do you test for OR-conditions?
> 
> ifneq ($(if $(a-condition),1)$(if $(another-condition),1),)
> endif
> 
> > 3) How do you search for a string, ignoring the case?
> 
> Create a user function like to-lower and compare the output of that.
> 
> > 4) http://www.gnu.org/software/make/manual/html_node/make_77.html
> >    says "Extra spaces are allowed and ignored at the beginning 
> >    of the conditional directive line, but a tab is not allowed." 
> >    Does it mean the tab in front of "if" word or also in the 
> >    statements (i.e. may I indent the CXXFLAGS below)?
> 
> Tabs should only exist within actions.
> 
> Sorry, I don't have time to go through your makefile but 
> hopefully the above is enough to go on.
> 
> BTW, to use user functions, you'll need 3.80 or above.
> 
> HTH,
> Noel
> 

Attachment: Makefile
Description: Makefile

Attachment: Makefile2
Description: Makefile2


reply via email to

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