help-make
[Top][All Lists]
Advanced

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

Re: Conditionals, step one


From: Derek Clegg
Subject: Re: Conditionals, step one
Date: Thu, 16 Sep 2010 11:15:07 -0700

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




reply via email to

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