Variable list modification

2011-04-20 Thread Too, Justin A.
Hi all,

FOO=1 2
$(FOO:=bar) = 1bar 2bar.

Is there a way to prepend bar?

Thanks,
Justin


Re: Variable list modification

2011-04-20 Thread Ralf Wildenhues
Hello Justin,

* Too, Justin A. wrote on Wed, Apr 20, 2011 at 11:33:26PM CEST:
 FOO=1 2
 $(FOO:=bar) = 1bar 2bar.
 
 Is there a way to prepend bar?

This is a GNU make question, or maybe a Posix make question, depending
on what you target.  In Posix make, the answer is no.  With GNU make,
you can use the patsubst function, see 'info make --index patsubst'.

Please note that automake won't really grok GNU make functions, so using
them in variables that are special to automake can lead to surprises.

Hope that helps.

Cheers,
Ralf



Re: Variable list modification

2011-04-20 Thread Paul Smith
On Thu, 2011-04-21 at 01:16 +0200, Ralf Wildenhues wrote:
 Hello Justin,
 
 * Too, Justin A. wrote on Wed, Apr 20, 2011 at 11:33:26PM CEST:
  FOO=1 2
  $(FOO:=bar) = 1bar 2bar.
  
  Is there a way to prepend bar?
 
 This is a GNU make question, or maybe a Posix make question, depending
 on what you target.  In Posix make, the answer is no.  With GNU make,
 you can use the patsubst function, see 'info make --index patsubst'.

If you have GNU make you can just write:

$(FOO:%=bar%)

which is shorter/simpler than using patsubst.


Cheers!

-- 
---
 Paul D. Smith psm...@gnu.org  Find some GNU make tips at:
 http://www.gnu.org  http://make.mad-scientist.net
 Please remain calm...I may be mad, but I am a professional. --Mad Scientist