Quantcast

[PATCH] vim: simplify build

classic Classic list List threaded Threaded
8 messages Options
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

[PATCH] vim: simplify build

There should be no functional changes, except that you don't need to
make the directories before installing.

Signed-off-by: Felipe Contreras <[hidden email]>
---
 vim/Makefile |   19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/vim/Makefile b/vim/Makefile
index 89e18be..e7b7faa 100644
--- a/vim/Makefile
+++ b/vim/Makefile
@@ -1,11 +1,11 @@
 .PHONY: all help install link symlink
 
-FILES     = plugin/notmuch.vim \
-    $(wildcard syntax/notmuch-*.vim)
+files = plugin/notmuch.vim \
+ $(wildcard syntax/notmuch-*.vim)
+prefix = $(HOME)/.vim
+destdir = $(prefix)/plugin
 
-PREFIX    = $(shell ls -d ~/.vim/)
-
-OUT_FILES = $(FILES:%=${PREFIX}/%)
+INSTALL = install -D -m644
 
 all: help
 
@@ -16,9 +16,8 @@ help:
  @echo "    make install     - copy plugin scripts and syntax files to ~/.vim"
  @echo "    make symlink     - create symlinks in ~/.vim (useful for development)"
 
-install: ${OUT_FILES}
-link symlink:
- ${MAKE} SYMLINK=1 install
+install:
+ @for x in $(files); do $(INSTALL) $(PWD)/$$x $(prefix)/$$x; done
 
-${OUT_FILES}: ${PREFIX}/%: %
- $(if ${SYMLINK},ln -fs,cp) `pwd`/$< $@
+link symlink: INSTALL = ln -fs
+link symlink: install
--
1.7.10

_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] vim: simplify build

On Wed, Apr 18 2012, Felipe Contreras <[hidden email]> wrote:

> There should be no functional changes, except that you don't need to
> make the directories before installing.
>
> Signed-off-by: Felipe Contreras <[hidden email]>
> ---

Hmm, Where is $(PWD) make variable documented; I found only $(CURDIR)
anyway, te following test makefile works OK.

all:
        echo $(PWD)
        echo $(CURDIR)

(i.e. both echo the current directory)

If this is not an issue, then LGTM.

Tomi

>  vim/Makefile |   19 +++++++++----------
>  1 file changed, 9 insertions(+), 10 deletions(-)
>
> diff --git a/vim/Makefile b/vim/Makefile
> index 89e18be..e7b7faa 100644
> --- a/vim/Makefile
> +++ b/vim/Makefile
> @@ -1,11 +1,11 @@
>  .PHONY: all help install link symlink
>  
> -FILES     = plugin/notmuch.vim \
> -    $(wildcard syntax/notmuch-*.vim)
> +files = plugin/notmuch.vim \
> + $(wildcard syntax/notmuch-*.vim)
> +prefix = $(HOME)/.vim
> +destdir = $(prefix)/plugin
>  
> -PREFIX    = $(shell ls -d ~/.vim/)
> -
> -OUT_FILES = $(FILES:%=${PREFIX}/%)
> +INSTALL = install -D -m644
>  
>  all: help
>  
> @@ -16,9 +16,8 @@ help:
>   @echo "    make install     - copy plugin scripts and syntax files to ~/.vim"
>   @echo "    make symlink     - create symlinks in ~/.vim (useful for development)"
>  
> -install: ${OUT_FILES}
> -link symlink:
> - ${MAKE} SYMLINK=1 install
> +install:
> + @for x in $(files); do $(INSTALL) $(PWD)/$$x $(prefix)/$$x; done
>  
> -${OUT_FILES}: ${PREFIX}/%: %
> - $(if ${SYMLINK},ln -fs,cp) `pwd`/$< $@
> +link symlink: INSTALL = ln -fs
> +link symlink: install
> --
> 1.7.10
>
> _______________________________________________
> notmuch mailing list
> [hidden email]
> http://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] vim: simplify build

On Wed, Apr 18, 2012 at 4:11 PM, Tomi Ollila <[hidden email]> wrote:

> On Wed, Apr 18 2012, Felipe Contreras <[hidden email]> wrote:
>
>> There should be no functional changes, except that you don't need to
>> make the directories before installing.
>>
>> Signed-off-by: Felipe Contreras <[hidden email]>
>> ---
>
> Hmm, Where is $(PWD) make variable documented; I found only $(CURDIR)
> anyway, te following test makefile works OK.
>
> all:
>        echo $(PWD)
>        echo $(CURDIR)
>
> (i.e. both echo the current directory)
>
> 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.

--
Felipe Contreras
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
David Bremner-2 David Bremner-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] vim: simplify build

Felipe Contreras <[hidden email]> 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]

d


[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
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] vim: simplify build

On Wed, Apr 18 2012, David Bremner <[hidden email]> wrote:

> Felipe Contreras <[hidden email]> 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
> [hidden email]
> http://notmuchmail.org/mailman/listinfo/notmuch
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] vim: simplify build

On Wed, Apr 18, 2012 at 6:40 PM, Tomi Ollila <[hidden email]> wrote:

> On Wed, Apr 18 2012, David Bremner <[hidden email]> wrote:
>
>> Felipe Contreras <[hidden email]> 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
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Tomi Ollila-2 Tomi Ollila-2
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] vim: simplify build

On Wed, Apr 18 2012, Felipe Contreras <[hidden email]> wrote:

> On Wed, Apr 18, 2012 at 6:40 PM, Tomi Ollila <[hidden email]> wrote:
>> On Wed, Apr 18 2012, David Bremner <[hidden email]> wrote:
>>
>>> Felipe Contreras <[hidden email]> 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 =/

Actually I wonder where one '$' was lose in line pwd=`pwd`; echo $$pwd

>> 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.

So, $(CURDIR) has 3 votes :D

>
> Cheers.
>
> --
> Felipe Contreras

Tomi
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Felipe Contreras Felipe Contreras
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: [PATCH] vim: simplify build

On Wed, Apr 18, 2012 at 7:03 PM, Tomi Ollila <[hidden email]> wrote:

> So, $(CURDIR) has 3 votes :D

All right. Pushed :)

--
Felipe Contreras
_______________________________________________
notmuch mailing list
[hidden email]
http://notmuchmail.org/mailman/listinfo/notmuch
Loading...