1. Since make has builtin suffix rules, the Makefile could be simplified to:
CXX=g++\n\n hello: main.o factorial.o hello.o\n\n clean:\n rm -rf *o hello\n
\n2. Shameless plug: he didn't mention redo [1], which is simpler than make and more reliable.\nThe comparable redo scripts to the Makefile would be: cat < @all.do\n redo hello\n EOF\n\n cat < hello.do\n o='main.o factorial.o hello.o'\n redo-ifchange $o\n g++ $o -o $3\n EOF\n\n cat < default.o.do\n redo-ifchange $2.cpp\n g++ -c $1 -o $3\n EOF\n\n cat < @clean.do\n rm -rf *o hello\n EOF\n
\n[Edit: Note that these are heredoc examples showing how to create the do scripts.]These are just shell scripts and can be extended as much as necesary.\nFor instance, one can create a dependency on the compiler flags with these changes:
cat <
\nsed calls could be combined; separated here for readablility.redo is pretty cool, but I ran into trouble with apenwarr's implementation (https://github.com/apenwarr/redo, see https://groups.google.com/d/msg/redo-list/GL5z8eEqT90/tk_vLZ...) with OS X Mavericks. I have no experience with the alternative implementation at https://github.com/gyepisam/redux, since it came out after I reimplemented the build system in question with CMake.
In general, I found CMake quite useable for my needs, and quite clean. It also required less build system code than redo. CMake fits quite nicely into a (C or C++) project which consists of many binaries and libraries which can depend on each other.