As previously described, the SCons Build Engine is interface-independent above its Python API, and can be embedded in any software system that can translate its dependency requirements into the necessary Python calls.
The "main" SCons interface for implementation purposes, uses Python scripts as configuration files. Because this exposes the Build Engine's Python API to the user, it is current called the "Native Python" interface.
This section will also discuss
how SCons will function in the context
of two other interfaces:
the Makefile
interface of the classic Make utility,
and a hypothetical graphical user interface (GUI).
The Native Python interface is intended to be the primary interface by which users will know SCons--that is, it is the interface they will use if they actually type SCons at a command-line prompt.
In the Native Python interface, SCons configuration files are simply Python scripts that directly invoke methods from the Build Engine's Python API to specify target files to be built, rules for building the target files, and dependencies. Additional methods, specific to this interface, are added to handle functionality that is specific to the Native Python interface: reading a subsidiary configuration file; copying target files to an installation directory; etc.
Because configuration files are Python scripts, Python flow control can be used to provide very flexible manipulation of objects and dependencies. For example, a function could be used to invoke a common set of methods on a file, and called iteratively over an array of files.
As an additional advantage, syntax errors in SCons Native Python configuration files will be caught by the Python parser. Target-building does not begin until after all configuration files are read, so a syntax error will not cause a build to fail half-way.
An alternate SCons interface would provide backwards
compatibility with the classic Make utility.
This would be done by embedding the SCons Build Engine
in a Python script that can translate existing
Makefile
s into the underlying calls to the
Build Engine's Python API
for building and tracking dependencies.
Here are approaches to solving some of the issues
that arise from marrying these two pieces:
Makefile
suffix rules can be translated
into an appropriate Builder
object
with suffix maps from the Construction Environment.
Long lists of static dependences
appended to a Makefile
by
various "make depend" schemes
can be preserved
but supplemented by
the more accurate dependency information
provided by Scanner
objects.
Recursive invocations of Make
can be avoided by reading up
the subsidiary Makefile
instead.
Lest this seem like too outlandish an undertaking,
there is a working example of this approach:
Gary Holt's Make++ utility
is a Perl script that provides
admirably complete parsing of complicated Makefile
s
around an internal build engine inspired,
in part, by the classic Cons utility.
The SCons Build Engine is designed from the ground up to be embedded into multiple interfaces. Consequently, embedding the dependency capabilities of SCons into graphical interface would be a matter of mapping the GUI's dependency representation (either implicit or explicit) into corresponding calls to the Python API of the SCons Build Engine.
Note, however, that this proposal leaves the problem of designed a good graphical interface for representing software build dependencies to people with actual GUI design experience...