The Program
builder method is only one of
many builder methods that SCons provides
to build different types of files.
Another is the Object
builder method,
which tells SCons to build an object file
from the specified source file:
Object('hello.c')
Now when you run the scons
command to build the program,
it will build just the hello.o
object file on a POSIX system:
% scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cc -o hello.o -c hello.c
scons: done building targets.
And just the hello.obj
object file
on a Windows system (with the Microsoft Visual C++ compiler):
C:\>scons
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
cl /Fohello.obj /c hello.c /nologo
scons: done building targets.