Chapter 9. Controlling a Build From the Command Line

SCons provides a number of ways that allow the writer of the SConscript files to give users a great deal of control over how to run the builds.

9.1. Not Having to Specify Command-Line Options Each Time: the SCONSFLAGS Environment Variable

Users may find themselves supplying the same command-line options every time they run SCons. For example, a user might find that it saves time to specify a value of -j 2 to run the builds in parallel. To avoid having to type -j 2 by hand every time, you can set the external environment variable SCONSFLAGS to a string containing command-line options that you want SCons to use.

If, for example, you're using a POSIX shell that's compatible with the Bourne shell, and you always want SCons to use the -Q option, you can set the SCONSFLAGS environment as follows:


      % scons
      scons: Reading SConscript files ...
      scons: done reading SConscript files.
      scons: Building targets ...
          ... [build output] ...
      scons: done building targets.
      % export SCONSFLAGS="-Q"
      % scons
          ... [build output] ...
    

Users of csh-style shells on POSIX systems can set the SCONSFLAGS environment as follows:


      $ setenv SCONSFLAGS "-Q"
    

Windows users may typically want to set the SCONSFLAGS in the appropriate tab of the System Properties window.