I’ve seen lots of methods been used to resolved the dependencies in Makefile, such as using gcc -MM and sed commond, or using the include directive (plus a little Perl magic), or qmake, or automake, or info make, etc.
Facing such many options, I am confused of which should I choose. So, I wanna know what’s the common way to resolve dependencies in Makefile nowadays? What’s the best way to cope with this problem?
PS: C/CPP project.
Generally if all you care about is systems that support GNU make and gcc (such as all linux variants and most unix like systems these days), you just use gcc’s various
-Mflags to generate the dependencies and then-includethem in your Makefile. There’s some good info in this question — generally there’s no need to use sed or any more complex tools.