[Rake-devel] make like variables?

Jim Weirich jim.weirich at gmail.com
Sat Sep 6 11:39:14 EDT 2008


On Sep 6, 2008, at 2:21 AM, Ittay Dror wrote:

> in make, if in my Makefile I have
> FOO = 1
> FOO += 2
> test:
>  echo $(FOO)
>
> then running:
> > make
> 1 2
> > make FOO=3
> 3
>
> That is, if passed in the command line, any assignments to FOO are  
> ignored. In Makefile, this can be changed by using the 'override'  
> method. It is not that important, just an idiom that people coming  
> from Make expect. Obviously, Rakefile being Ruby this sort of  
> behavior can be done.


I think if I had to do this, I would use an idiom like:

  ENV['FOO'] ||= 1

I really don't have control over how ruby variables are assigned.  I'm  
not sure how to do it in rake for any arbitrary variable.

-- 
-- Jim Weirich
-- jim.weirich at gmail.com



More information about the Rake-devel mailing list