Make relinks your project because it tries to build all
. The rule for all
does not create any file named all
. Instead it produces myexe
. Next time you run make, it will see that there's no all
, but there's a rule to build one, so it dutifully executes that rule which happens to link myexe
every time you run make.
In order to fix your problem you need to change your makefile to look roughly like this:
all: myexe
echo Build done
myexe: <myexe dependencies go here>
$(CXX) $(CFLAGS) -o myexe $(wildcard *.o) $(LDFLAGS)