This is by design. You can specify make for which you want to build:
make main.o DriveInfo.o
will build these two goals. In addition, if you want make to build all (or some) goals by default, you can specify a rule at the beginning of the Makefile, indicating that:
all: main.o DriveInfo.o β¦
Now make all (or just make ) will build all the dependent objects. Its also good practice to declare all as a fake target to tell make that it does not match the actual existing file. Do this by placing .PHONY: all in the Makefile.
One final note, the name all arbitrary. You can use any other name, but all is common. The important part is that this is the first rule in your Makefile if you want it to be the one that was executed when you invoke make without any explicit purpose.
Konrad Rudolph
source share