SamJansen's work in progress.
make(1) is not for everyone. I've had to maintain the build system for a reasonably large and complex project and using makefiles has been more and more of a headache as time has passed. I have found almost no redeeming features in make - the only thing I can say for it is that most people who wish to compile software will have it installed.
The worst thing about SCons is that it does take some time to learn. It is not hard to learn; being based on the simple but powerful programming language Python helps here, but it can be hard to make the leap from a system you already know to a new one, even if the old system is inferior, simply because of the extra time it takes to learn the new system. However, I recommend learning modern build systems that don't employ make.
program: main.o sam.o johno.o gcc -o $@ $^
Both of these work the same at the first glance, though I believe the SConstruct file (yes, SConstruct is the name of the file that replaces your MakeFile) to be a lot more readable. However the SCons file has the following extra features:
env = Environment(CCFLAGS = '-Wall -pipe', LIBS = ['m', 'jpeg']) env.Program('sam', ["lib.c", "sam.cc"], CPPPATH = ['include', 'common/include']) env.SharedLibrary('testlib', ["source1.cc", "source2.c"])
This also sets the variable CPPPATH, which specifies which directories are to be searched for include files that are scanned during depency tracking. These are also passed to the compiler with the -I flag in the case of GCC. The flags can also be passed in the Program or Library line, constructing and Environment is usually done so multiple things can be built with the same environment.
A full list of the possible options can be found in the SCons manual.
In many cases the above will be enough: often you just want to build a directory of files into a library, shared library, or executable with a specific set of flags and dependencies. Of course, SCons lets you do a lot more, and at little to no extra cost in complexity.
import glob Library(glob.glob('*.c') + glob.glob('source_dir_2/*.cc'), 'sam')
SCons supports hierarchical builds with the use of the SConscript directive. These scripts will be read and their information processed. No new SCons is forked for the SConscript directives, unlike the usual recursive make solution.
lib/main.php:944: Notice: PageInfo: Cannot find action page