Re:One line you should add to every makefile
by lukaslalinsky on Friday April 10, 2015 @11:18AM
(#9354889)
The problem is that C/C++ files have internal depenedencies which make needs to know about. Yes, for gcc you can use a simple trick to extract the dependencies to makefile rules, but in case you use a different compiler, you need to do it yourself. If you are compiling a different language, you need to do it yourself again. Using something like CMake or even automake, which can automatically track the dependencies, saves you a lot of work.
How do they track the dependencies automatically?
With gcc/clang it's a set of flags starting with -M, and with MSVC it's /showIncludes. They're discussed a bit here:
What if we're using a different compiler, then?
The comment that I was replying to sounds like CMake or something has more magic thus power for a future unknown compiler.
Re:One line you should add to every makefile
by lukaslalinsky on Friday April 10, 2015 @05:25PM
(#9357191)
The point I was trying to make is that when you use CMake on any not-completely-unknown compiler, it will do this for you. If you are writing your own makefile, you either need to take the different compilers into account or implement it just for gcc ("screw the other guys") or simply resolve to "make clean && make".
Re:One line you should add to every makefile
by ExpiredLink on Friday April 10, 2015 @12:54PM
(#9355578)
Back in the (not so) good old days we used makedepend.
Re:One line you should add to every makefile
by seanwilson on Friday April 10, 2015 @11:26AM
(#9354943)
Once you start to need loops, conditions, functions to factor common code, switches for production/staging/development builds etc. I don't find Make elegant or easy to maintain even when knowing the syntax personally.
Their reputation has been tarnished by autotools, but in that case you're using autotools as your build system, not make.