Reputation: 4525
all: hello
hello: main.o
g++ -o hello main.o
main.o: main.cpp
g++ -c main.cpp
Above is a simple makefile, my question is that why we do not use the following for small project? It is no need to generate .o files. Is there any disadvantage of using the following format for small projects?
all: hello
hello:main.cpp
g++ -o hello main.cpp
Upvotes: 1
Views: 107
Reputation: 272617
No, there is no disadvantage.
[Of course, simple projects have a tendency to grow into bigger projects, so there's always an argument that you should start as you mean to go on...]
Upvotes: 3