help-make
[Top][All Lists]
Advanced

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

Re: Executing Perl pattern substitution inside a Makefile


From: Paul Smith
Subject: Re: Executing Perl pattern substitution inside a Makefile
Date: Tue, 18 Dec 2007 00:25:55 -0500

On Mon, 2007-12-17 at 18:00 -0500, Frazer Worley wrote:
> perl -ple 's/\$\{(\w+)\}/$ENV{$1}/g'

Check the GNU make manual.  Any dollar sign ($) in a recipe is
interpreted as a make variable reference and expanded before the recipe
is passed to the shell.

In order to escape dollar signs, you need to double them ($$).  So, use
this instead:

        perl -ple 's/\$$\{(\w+)\}/$$ENV{$$1}/g'

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