Here's a simplified version of my Makefile:
all: myprogram
myprogram: main.o
c++ main.o -o myprogram
main.o: main.cpp mylib.hpp
c++ -c main.cpp
mylib.hpp: mylib.inl
All these files mentioned above are real files. When I change mylib.hpp
, main.cpp
recompiles. However, my problem is that when I change mylib.inl
, main.cpp does not recompile. How can I invalidate the main.o
target and therefore the myprogram
target when I edit mylib.inl
? I would prefer not to use a .PHONY
target, because I don't want to recompile everything every time, just only when I edit mylib.inl
.