help-make
[Top][All Lists]
Advanced

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

Re: Conditionals, step one


From: Radly
Subject: Re: Conditionals, step one
Date: Thu, 16 Sep 2010 12:52:35 -0700 (PDT)



Paul Smith-20 wrote:
> 
> On Thu, 2010-09-16 at 05:56 -0700, Radly wrote:
>> OS = $OSTYPE
>> 
>> ifeq ($(value OS), darwin10.0)
>>   TXT = GOT_IT
>> else
>>   TXT = MISSED_IT
>> endif
>> 
>> all:
>>         @echo OS = $(value OS)
>>         @echo $(TXT)
> 
> Wow, what an interesting combination of incorrectnesses :-)
> 
> <...>
> However, assuming you're doing a lot of variable assignment I recommend
> a very different method.  Instead of big if-else-endif statements, just
> use include files with suffixes for each supported OSTYPE.  Something
> like:
> 
>       include $(firstword $(wildcard osinfo.$(OSTYPE)) osinfo.notype)
> 
>       all:
>               @echo OS = $(OSTYPE)
>               @echo $(TXT)
> 
> Now create a file for darwin10.0:
> 
>       $ cat osinfo.darwin10.0
>       TXT = GOT_IT
> 
> and another file for "unknown OSTYPE":
> 
>       $ cat osinfo.notype
>       TXT = MISSED_IT
> 
> 
Thanks also.  Usually when I'm wrong I'm wrong in a big way. :)  I like the
scalability of your suggestion, so I tried it.  Alas, like my reply to
Derek, this also requires "make OSTYPE=$OSTYPE".  I'm running bash v.
4.1.5(1).  Can that conceivably matter?


-- 
View this message in context: 
http://old.nabble.com/Conditionals%2C-step-one-tp29728166p29732357.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.




reply via email to

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