A simple make statement is like this:
Originally Posted by cisokay
if any of the dependancies is newer than target, command is run. Note that the command must have a tab char before.
Your make will always compile prog. You're stating that compile depends on prog.cpp. When that command is run no file named compile exists, so the command is always run, whenever make is run.
Also you're not stating that prog depends on prog.cpp. re-read my previous post.
and finally since I seriously doubt that there'll ever be any file called compile declare compile like this
In other words, compile will always be a word passed through the command line like clean
To sum up we have
g++ prog.cpp -o prog
.PHONY clean compile
rm -f *.o prog a.out core*