[Top][All Lists]

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

RE: Splitting lines problem in make-3.80 versus 3.81

From: Martin Dorey
Subject: RE: Splitting lines problem in make-3.80 versus 3.81
Date: Tue, 8 Sep 2009 13:36:32 -0700

> All you have to do is use recursive assignment ("=") and NOT simple assignment (":=").


The attachment did use =, making the coworker's assertion odder.  The lack of need for target-specific variables can be illustrated with a simple example:


address@hidden:~/playpen/make-splitting$ cat Makefile


print STDOUT `cat $(word 2,$^)`; \



badger: a b

      perl -e $(PERL_CODE)


a b:

      echo this file is $@ > $@

address@hidden:~/playpen/make-splitting$ rm -f a b

address@hidden:~/playpen/make-splitting$ make

echo this file is a > a

echo this file is b > b

perl -e ' print STDOUT `cat b`; '

this file is b



That was make-3.81.  I don't have 3.80 lying around.


-----Original Message-----
From: address@hidden [mailto:address@hidden On Behalf Of Paul Smith
Sent: Tuesday, September 08, 2009 13:30
To: address@hidden
Cc: address@hidden
Subject: Re: Splitting lines problem in make-3.80 versus 3.81


On Tue, 2009-09-08 at 13:02 -0700, Warren Dodge wrote:

> I tried it on my specific problem and indeed it solved the issue. A

> co-worker was working on another Makefile an having a similar issue. We

> tried the solution above and ran into a number if strange issues.


I haven't looked at this yet but I will.


> In 3.81 we had to go to greater lengths to get the operation of the

> Makefile to work. Hee is what the co-worker said about the problem.


>  >>> The variable method can get tricky too, if the perl code you are running

>  >>> makes reference to automatic variables, as they are not defined except

>  >>> in the target.  The perl code in question in this example uses the

>  >>> $(word 2,$^) to get name of the second file in the dependency list, so

>  >>> the variable has to be defined as a Target-Specific or Pattern-Specific

>  >>> variable, but making these in a way that is compatible to both 3.80 and

>  >>> 3.81 is not easy.


This is definitely not true.  All you have to do is use recursive

assignment ("=") and NOT simple assignment (":=").


There is absolutely no difference, other than the line ending

concatenation we are trying to take advantage of, between this:



            echo bar


and this:


      COMMAND = echo bar





_regardless_ of how complex and what content, variable references, etc.

you use to replace "echo bar".


If you use "COMMAND := ...." then definitely you are in for a world of



> Assuming there is a bug we hope it can be addressed. If it is just not

> understanding what is going on maybe the "ifo" page on this subject can

> be enhanced to help others address this.


I believe that the info is correct and factual.  If you try the examples

there and follow the instructions you should be successful.  I'll take a

look at the examples you provided to see if there are holes that need to

be clarified, or if you have specific suggestions about things that are

hard to understand they're very welcome.  As you might guess, when you

already know exactly how it all works it can be difficult to write

documentation that answers all newcomers' questions in an understandable








Bug-make mailing list



reply via email to

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