[PATCH] vim: simplify build

Tomi Ollila tomi.ollila at iki.fi
Wed Apr 18 08:40:42 PDT 2012


On Wed, Apr 18 2012, David Bremner <david at tethera.net> wrote:

> Felipe Contreras <felipe.contreras at 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 at notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch


More information about the notmuch mailing list