Compiling Multiple Programs

In order to compile multiple programs within the same SConstruct file, simply call the Program method multiple times, once for each program you need to build:

       Program('foo.c')
       Program('bar', ['bar1.c', 'bar2.c'])
    

SCons would then build the programs as follows:

       % scons -Q
       cc -c -o bar1.o bar1.c
       cc -c -o bar2.o bar2.c
       cc -o bar bar1.o bar2.o
       cc -c -o foo.o foo.c
       cc -o foo foo.o
    

Notice that SCons does not necessarily build the programs in the same order in which you specify them in the SConstruct file. SCons does, however, recognize that the individual object files must be built before the resulting program can be built. We'll discuss this in greater detail in the "Dependencies" section, below.