Building Object Files

SCons User Guide 0.98.0
Prev | Chapter 2. Simple Builds | Next

# 2.2. Building Object Files

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 /nologo /c hello.c /Fohello.obj
          scons: done building targets.

Prev | Home | Next
Simple Builds | Up | Simple Java Builds