I have a Makefile with the following structure (working example).
.PHONY: image flashcard put-files
put-files:
@echo "=== put-files"
image:
@echo "=== image"
flashcard:
@echo "=== flashcard"
all: put-files image flashcard
@echo "Done"
I expect that a simple make would build all three targets, but this is not so:
% make
=== put-files
But if I explicitly specify the target, the dependencies are built as well:
% make all
=== put-files
=== image
=== flashcard
Done
What am I doing wrong?
A simple
makewill build the first target in the list, which isput-files.make allwill build the targetall. If you wantallto be the default, then move it to the top of the list.To understand what the
.PHONYdoes, see http://www.gnu.org/s/hello/manual/make/Phony-Targets.html