help-make
[Top][All Lists]
Advanced

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

Re: Make feature question


From: Paul D. Smith
Subject: Re: Make feature question
Date: Fri, 16 Feb 2001 13:08:50 -0500

%% Regarding Make feature question; you wrote:

  mam> Is there a better way?

Maybe.

  mam> #(from command line)
  mam> FOO == three

  mam> #(much later)
  mam> ifneq ($(FOO),)
  mam>  ifeq ($(FOO),one)
  mam>   FOO = 1
  mam>  else # FOO == one
  mam>   ifeq ($(FOO),two)
  mam>    FOO = 2
  mam>   else  # FOO == two
  mam>    if ($(FOO),three)
  mam>     FOO = 3
  mam>    else
  mam>     FOO = 4
  mam>   endif # FOO == two
  mam>  endif # FOO == one
  mam> endif # FOO != NULL

You could try using recursive variable names (I changed them so we
didn't overload "FOO" so much and it's easier to see what's going on):

  BAR       = three

  FOO_one   = 1
  FOO_two   = 2
  FOO_three = 3
  FOO_four  = 4

  BAZ       = $(FOO_$(BAR))

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          Find some GNU make tips at:
 http://www.gnu.org                      http://www.paulandlesley.org/gmake/
 "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]