Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 06 Sep 2012 11:17:12 -0500
From:      Tim Daneliuk <tundra@tundraware.com>
Cc:        freebsd-questions@freebsd.org
Subject:   Re: Somewhat OT: Using Pipes Inside a GNU Make File
Message-ID:  <5048CC88.4030107@tundraware.com>
In-Reply-To: <alpine.BSF.2.00.1209052012510.1779@wonkity.com>
References:  <5047E804.7050406@tundraware.com> <5047ED29.2040001@shatow.net> <50480361.8030601@tundraware.com> <alpine.BSF.2.00.1209052012510.1779@wonkity.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On 09/05/2012 09:15 PM, Warren Block wrote:
> On Wed, 5 Sep 2012, Tim Daneliuk wrote:
>
>> On 09/05/2012 07:24 PM, Bryan Drewery wrote:
>>> On 9/5/2012 7:02 PM, Tim Daneliuk wrote:
>>>> A bit off topic, but I'm kind of stuck.  I am using gmake and want to
>>>> do something like this:
>>>>
>>>>     FOO := $(shell a | b | c)
>>>>
>>>> But this appears not to work.  Only the 'a' command is executed.  The
>>>> remainder
>>>> of the pipeline is ignored.  Is there some clean way to implement this
>>>> kind of thing?
>>>>
>>>>
>>>
>>> I use this in a GNUMakefile and it works fine.
>>>
>>>      BRANCH := $(shell git branch --no-color | grep "^*" | sed -e 's/^\* //')
>>>
>>>
>>> You may need to post a more specific example.
>>>
>>> Bryan> _______________________________________________
>>
>> Here's the line that is failing:
>>
>> 2LATEX   = $(shell which rst2latex.py rst2latex | tr '\012' ' ' | awk '{print $1}')  --stylesheet=parskip
>
> Bryan's example is using := for assignment.


That wasn't it, as it turned out.  The problem was in the awk statement.

Instead of:

     awk '{print $1}'

I had to use:

     awk '{print $$1}'    


This is necessary because $1 is a *make* variable but $$1 is the awk variable I wanted ($1)....

D'uh ....





-----------------------------------------------------------------------
Tim Daneliuk



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?5048CC88.4030107>