Rule #3 "Life is simplest if the targets are built in the current working directory." is not clear at best, or wrong.
Pretty much any size-able project will build 'in' the source directory but create the objects somewhere else. That's what the O= parameter is when building the linux kernel for example.
Allows 'make clean' to have a single directory to delete, allows you to keep a build for gcc, clang, arm, ia64, debug, release etc etc without risking them clobbering each others.
Other than that, yes, 'modern' Makefiles that use % patterns, and most especially VPATH are a LOT simpler than the nightmare from years past. Combined with gcc -MMD to automatically create the dependencies file it becomes very simple to maintain a clean Makefile!
Add some pkg-config magic, and you really don't need autotools and stuff -- libtool can still be handy if you want 'portability' but it's pretty easy to add...
1 comment
[ 7.7 ms ] story [ 10.2 ms ] threadPretty much any size-able project will build 'in' the source directory but create the objects somewhere else. That's what the O= parameter is when building the linux kernel for example.
Allows 'make clean' to have a single directory to delete, allows you to keep a build for gcc, clang, arm, ia64, debug, release etc etc without risking them clobbering each others.
Other than that, yes, 'modern' Makefiles that use % patterns, and most especially VPATH are a LOT simpler than the nightmare from years past. Combined with gcc -MMD to automatically create the dependencies file it becomes very simple to maintain a clean Makefile!
Add some pkg-config magic, and you really don't need autotools and stuff -- libtool can still be handy if you want 'portability' but it's pretty easy to add...