Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

make runs all targets

Tags:

makefile

I want to write a makefile only for installing. I was thinking of having an install target and an all target. The all target would only exist as the default target so running make would say something like "Nothing to build". However, when I do a small test and run make or make all, it seems that the install target is also run. Here is the makefile:

vimprefix=/usr/share/vim/vim73

.PHONY: all
all: 
    @echo "Nothing to build. Run `make install` to install configurations."

.PHONY: install
install:
    test -d $(vimprefix)

And here is the output from make:

$ make
Nothing to build. Run make[1]: Entering directory `/home/user/documents/conf'
test -d /usr/share/vim/vim73
make[1]: Leaving directory `/home/user/documents/conf' to install configurations.

I noticed that this doesn't happen if I put something like touch all in the all target. Can someone explain why this might be happening?

like image 805
ditzy Avatar asked Apr 20 '14 18:04

ditzy


1 Answers

Heh, nice one. :)

Run `make install` to 

This contains backticks, which invokes the command make install. Use simple apostrophes.

like image 95
laune Avatar answered Sep 22 '22 21:09

laune