Re:A Simple Makefile for Medium-Sized C/C++ Projects
by rwmj on Friday August 26, 2016 @10:40AM
(#12366586)
Can be done. The question is will the half-assed Makefile that a developer wrote for themselves do any of those things? And I can tell you from bitter experience that is very very unlikely. Plus I will still have to spend the time to understand the Makefile, which I won't need to do if they'd used an established build system in the first place.
Re:A Simple Makefile for Medium-Sized C/C++ Projects
by asveikau on Friday August 26, 2016 @10:44AM
(#12366619)
We can agree that half assed makefiles are bad. I don't believe in throwing out the tool on that basis. If that were the bar, we might as well not write any software in any language with any tool.
Re:A Simple Makefile for Medium-Sized C/C++ Projects
by knome on Friday August 26, 2016 @11:01AM
(#12366728)
I imagine most projects will never leave the hard drive they're first written to. Writing a basic "half-assed" makefile that works for the initial author is fine. If a project turns out useful, rewrite the makefile as people need the compatibility. There's little point in wasting the time when you're just starting out.
> setting custom CFLAGS/LDFLAGS
> changing prefix, libdir, sysconfdir
> cross-compilation
Pretty much all of this can be done trivially in a makefile, using a very innovative construct called "variables".
> parallel builds
make -j. Works especially well if you have working dependencies. This makefile does.
> conditional features
make has ifdef... Granted this makefile uses find to discover source files, which won't totally work. But it's a small fix. Or you can do conditional features through CFLAGS.