[Top][All Lists]
[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:36:07 -0700 (PDT) |
Derek Clegg wrote:
>
> On Sep 16, 2010, at 5:56 AM, Radly wrote:
>
>> Problems like this make me feel like a beginner...
>>
>> I have a project that needs to detect OSTYPE and set LIBS and LIBDIRS
>> accordingly, but I can't get basic conditionals working. This doesn't
>> work
>> on either Mac OSX or Ubuntu Linux; they both use Make 3.81. Here's a
>> stripped-down demo of my problem:
>>
>> OS = $OSTYPE
>>
>> ifeq ($(value OS), darwin10.0)
>> TXT = GOT_IT
>> else
>> TXT = MISSED_IT
>> endif
>>
>> all:
>> @echo OS = $(value OS)
>> @echo $(TXT)
>>
>> And here's the printed output:
>> OS = darwin10.0
>> MISSED_IT
>>
>> I've tried multiple variations on the ifeq test, and they all fail,
>> producing the "MISSED_IT" text.
>>
>> Surely I'm missing something that will be obvious to someone else. What
>> might it be?
>
> Use $(info ...) to print the value of your variables. You'll see that OS
> is equal to STYPE, not what you intended. Do this instead:
> OS = $(OSTYPE).
>
> Derek
>
>
Thanks, that was helpful, except that 'info' seems to be a no-op. After
trying a lot of variations and simplifications, I finally got the following
to almost work:
ifeq (${value OSTYPE},linux-gnu)
TXT = GOT_IT
else
TXT = MISSED_IT
endif
all:
@echo ${TXT}
Now I would like to know how to pick up OSTYPE directly from the shell,
without having to type "make OSTYPE = $OSTYPE". If I enter it that way, the
makefile prints out "GOT_IT", but if I just type "make", it prints
"MISSED_IT".
--
View this message in context:
http://old.nabble.com/Conditionals%2C-step-one-tp29728166p29732213.html
Sent from the Gnu - Make - Help mailing list archive at Nabble.com.
Re: Conditionals, step one, Paul Smith, 2010/09/16
Re: Conditionals, step one, Jean-Rene David, 2010/09/17