You have wrong rule for texture_holder.o
, it should be this:
texture_holder.o: texture_holder.cpp texture_holder.h
g++ texture_holder.cpp -c -std=c++11
Ie. including the .o
extension.
What happens with your question's version is, when you do make texture_holder
, you execute that particular rule, which does not actually create corresponding file texture_holder
, it creates texture_holder.o
, because well, that's what the commend produces. The texture_holder
rule is effectively a phony rule, similar to main
and clean
(and btw, you should add main
to .PHONY
too).
If you make main
, then to create texture_holder.o
, make uses implicit rule (because there is no explicit one), which uses different compile command.