Reputation: 101
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?
Upvotes: 6
Views: 606
Reputation: 31300
Heh, nice one. :)
Run `make install` to
This contains backticks, which invokes the command make install
. Use simple apostrophes.
Upvotes: 8