Re: [PATCH] vim: simplify build

Subject: Re: [PATCH] vim: simplify build

Date: Wed, 18 Apr 2012 18:40:42 +0300

To: David Bremner, Felipe Contreras

Cc: notmuch@notmuchmail.org

From: Tomi Ollila


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
/home/too
echo /home/too
/home/too
echo 

$ cd ..
$ make -C too -f foo.mk
make: Entering directory `/home/too'
pwd=`pwd`; echo $pwd
/home/too
echo /home/too
/home/too
echo /home
/home
make: Leaving directory `/home/too'


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.

> d

Tomi

>
>
> [1]: http://www.gnu.org/software/make/manual/make.html#Recursion
> [2]: http://www.gnu.org/software/make/manual/make.html#Options-Summary
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

Thread: