By default, make only tries to build the first thing it finds.
hello: hello.c
NOTE: Here:
A fake target can be provided:
all : hello hello2 hello3
NOTE: This shows the target as all, probably not what is really wanted:
This actually works as long as there is never a file named all in the working directory.
This assumes that there are other rules elsewhere in the Makefile for the 3 hello programs so they can be built.
To prevent this usage of all being a problem, you can declare that target as phony by using this statement in the makefile:
.PHONY: all
NOTE: Actions can be attached to phony targets as well. For example:
.PHONY: clean clean: rm *.o
NOTE: You can issue make clean from the command line to remove all the object files.