help-make
[Top][All Lists]
Advanced

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

RE: Enhancement of conditionals?


From: Paul D. Smith
Subject: RE: Enhancement of conditionals?
Date: Tue, 9 Mar 2004 12:38:42 -0500

%% "Shah, Bijal" <address@hidden> writes:

  sb> Usually, this means you can be left with: 

  sb> ifeq (0,$(FRED)) 
  sb>     FRED_PROCESS=$(call xxx,xxx) 
  sb> then 
  sb> ifeq (1,$(FRED)) 
  sb>     FRED_PROCESS=$(call yyy,yyy) 
  sb> then 
  sb> ifeq (2,$(FRED)) 
  sb>     FRED_PROCESS=$(call zzz,zzz) 
  sb> then 
  sb>     $(error FRED is not a value value.) 
  sb> endif 
  sb> endif 
  sb> endif 

  sb> I don't know if there is a better way of dealing with this using the
  sb> syntax available today - any ideas anyone? 

The best I can think of for today is something like this:

  FRED_0 = $(call xxx,xxx)
  FRED_1 = $(call yyy,yyy)
  FRED_2 = $(call zzz,zzz)
    ...


  FRED_PROCESS = $(FRED_$(FRED))

  ifndef FRED_PROCESS
    $(error FRED = $(FRED) is not a valid value.)
  endif

  sb> Maybe something like: 

  sb>    caseeq (variable) 

Mm.  I don't think this would be good.

I'd be willing to add in an elseif keyword so you don't have to have
nested endifs.

I don't want to add huge numbers of functions or preprocessor statements
to make itself, because in a future release of GNU make you will have
the option of linking it with Guile which will provide a fully capable
scripting language for GNU make.

I think it's better to reuse something that already exists rather than
writing a brand new language that's not like anything else already out
there.

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://make.paulandlesley.org
 "Please remain calm...I may be mad, but I am a professional." --Mad Scientist




reply via email to

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