Built-In Builders

SCons provides the ability to build a lot of different types of files right "out of the box." So far, we've been using SCons' ability to build programs, objects and libraries to illustrate much of the underlying functionality of SCons This section will describe all of the different types of files that you can build with SCons, and the built-in Builder objects used to build them.

Programs: the Program Builder

As we've seen, the Program Builder is used to build an executable program. The source argument is one or more source-code files or object files, and the target argument is the name of the executable program name to be created. For example:

      env = Environment()
      env.Program('prog', 'file1.o')
    

Will create the prog executable on a POSIX system, the prog.exe executable on a Windows system.

The target file's prefix and suffix may be omitted, and the values from the $PROGPREFIX and $PROGSUFFIX construction variables will be appended appropriately. For example:

      env = Environment(PROGPREFIX='my', PROGSUFFIX='.xxx')
      env.Program('prog', ['file1.o', 'file2.o'])
    

Will create a program named myprog.xxx regardless of the system on which it is run.

If you omit the target, the base of the first input file name specified because the base of the target program created. For example:

      env = Environment()
      env.Program(['hello.c', 'goodbye.c'])
    

Will create the hello executable on a POSIX system, the hello.exe executable on a Windows system.