help-make
[Top][All Lists]
Advanced

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

Re: setting variables within ifeq section doesn't work?


From: Paul D. Smith
Subject: Re: setting variables within ifeq section doesn't work?
Date: Wed, 3 May 2006 12:40:26 -0400

%% Jason Lunz <address@hidden> writes:

  jl> Is this expected behavior?

  jl>   $ cat Makefile 
  jl>   ifeq ($(A),x)
  jl>   A:=y
  jl>   $(info A set to $(A))
  jl>   endif
  jl>   .PHONY: default
  jl>   default:
  jl>           @echo A is $(A)
  jl>   $ make 
  jl>   A is
  jl>   $ make A=a
  jl>   A is a
  jl>   $ make A=x
  jl>   A set to x
  jl>   A is x

Yes.

  jl> I would expect A to be set to "y" whenever its previous value is "x",
  jl> but that doesn't happen.

Variable settings on the command line override any value set "normally"
in the makefile.

See the GNU make manual, section "Overriding Variables".

-- 
-------------------------------------------------------------------------------
 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]