Re: [PATCH] vim: simplify build

Subject: Re: [PATCH] vim: simplify build

Date: Wed, 18 Apr 2012 18:57:59 +0300

To: Tomi Ollila

Cc: notmuch@notmuchmail.org

From: Felipe Contreras


On Wed, Apr 18, 2012 at 6:40 PM, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Wed, Apr 18 2012, David Bremner <david@tethera.net> wrote:
>
>> Felipe Contreras <felipe.contreras@gmail.com> writes:
>>>> If this is not an issue, then LGTM.
>>>
>>> I don't know, I have always used $(PWD), unless anybody else prefers
>>> $(CURDIR), I'll push that.
>>
>> I think CURDIR is better; if only because it is the standard (GNU) make
>> way of doing things [1].  I'm not sure if there is a functional
>> difference or not. At least CURDIR definitely works with make -C [2]
>
> I read some web pages and then did an experiment; GNU make (v 3.77+)
> has builtin variable $(CURDIR). $(PWD) gets value from environment:
>
> doing the following:
>
> $ cat > foo.mk <<EOF
> all:
>        pwd=`pwd`; echo $pwd
>        echo $(CURDIR)
>        echo $(PWD)
> EOF
> $ PWD= make -f foo.mk
> pwd=`pwd`; echo $pwd

Agh! Complete confusion. Add an '@' before echo =/

> So, most portable option would be using pwd=`pwd`; echo $pwd
> construct in the makefile. Next option would be using $(CURDIR)
> and it works with -C (and with original bourne shell which does
> not manage $PWD). That is GNU make (v 3.77+) spesific but the makefiles
> use GNU make constructs elsewhere too.

I think `pwd` is overkill. I vote for $(CURDIR), although $$PWD
wouldn't be bad either.

Cheers.

-- 
Felipe Contreras

Thread: