Reputation: 27200
I have the following Makefile
:
compile:
echo a
run: compile
echo b
all: run
make all
has the expected effect:
$ make all
echo a
a
echo b
b
But simply invoking make
only executes compile
target:
$ make
echo a
a
Why is this happening?
Upvotes: 0
Views: 78
Reputation: 2426
When you just execute make
the first target will be executed by default. Its a convention to keep all
as a first dependency even though it can be anywhere as you did unless you pass all
to make
. And even check out .PHONY
.
Upvotes: 2
Reputation: 36
By default, make runs the first target, which in your case is compile
: http://www.gnu.org/software/make/manual/html_node/How-Make-Works.html#How-Make-Works
If you want all
to be the default target, list it first.
Upvotes: 2