help-make
[Top][All Lists]
Advanced

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

Re: Make 3.80 Vs Make 3.81 [3.81 gives error]


From: Paul Smith
Subject: Re: Make 3.80 Vs Make 3.81 [3.81 gives error]
Date: Fri, 03 Dec 2010 08:27:16 -0500

On Fri, 2010-12-03 at 16:13 +0530, Rohit Arul Raj wrote:
> I had a simple makefile (code given below) which used to execute a
> perl command. It used to work fine with GNU Make 3.80.
> 
> target:
>         echo "building"
>         perl -e {'$$irobj_str=undef; @a = `ls *`; \
>          {foreach (@a) { chomp; $$irobj_str .= "$_ "; }} substr($$irobj_str, 
> -1) = ""; \
>         `echo "hi"`;'}
> 
> Can any one point out the reason for that error message?

See the NEWS file for changes from release to release; in particular
this:

* WARNING: Backward-incompatibility!
  In order to comply with POSIX, the way in which GNU make processes
  backslash-newline sequences in recipes has changed.  If your makefiles
  use backslash-newline sequences inside of single-quoted strings in
  recipes you will be impacted by this change.  See the GNU make manual
  subsection "Splitting Recipe Lines" (node "Splitting Lines"), in
  section "Recipe Syntax", chapter "Writing Recipe in Rules", for
  details.

One option is to make the change you did.

Another option is to move the content into a make variable, then use the
variable in the recipe (the rules for backslash/newlines in variables
are still the same as they always were):

        PERLCMD = {'$$irobj_str=undef; @a = `ls *`; \
                   {foreach (@a) { chomp; $$irobj_str .= "$_ "; }} 
substr($$irobj_str, -1) = ""; \
                   `echo "hi"`;'}
        target:
                echo "building"
                perl -e $(PERLCMD)

-- 
-------------------------------------------------------------------------------
 Paul D. Smith <address@hidden>          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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]