Reputation: 1022
I have the files bar.c
& foo.c
in the same folder.
And I have the following makefile:
foo: foo.c
gcc -o foo foo.c
all: clean foo bar
bar: bar.c
gcc -o bar bar.c
clean:
rm -rf bar foo
The output is foo
only, and the question is why? What's the difference between foo
& bar
?
Upvotes: 1
Views: 38
Reputation: 3571
I assume you run it as make
. By default make processes first target in the makefile, which is "foo". Place target "all" first, and you'll get both "foo" and "bar". Another way is to explicitly specify target, i.e. run make all
instead of just make
.
Upvotes: 3