next up previous [pdf]

Next: Executing SCons Up: Scripting Madagascar Previous: SConstructs and commands

Creating an SConstruct

Now that we have the three SConstruct commands, we can write our first SConstruct. To do so, open the SConstruct file in your favorite text editor. Before we can create any Flow, Plot or Result statements we have to add a first statement to the SConstruct. Enter the following statement (verbatim) into your new SConstruct:
from rsf.proj import *
This statement tells SCons where to find the Flow, Plot and Result commands, and must be included in every SConstruct.

After that statement has been entered, you can enter as many Flow, Plot and Result commands as you wish making sure to use proper syntax. It's helpful to use a text editor that has Python syntax highlighting, as that will help you find and remedy strings that are not closed. You can also create Python comments using the $\char93 $ mark to indicate the beginning of a comment to help document your SConstructs.

Lastly, you must include the following statement at the end of your SConstruct:

End()
This statement tells SCons that the script is done and that it should not look for anything else in the script. Make sure to include this statement as the very last item in every SConstruct.

Here's a sample SConstruct:
\begin{lstlisting}
from rsf.proj import *  ...
Note: you do not have to order your Flow, Plot and Result commands as shown above. You can mix Flow, Plot and Result in any order. SCons automatically establishes the relationships between related files and commands.


next up previous [pdf]

Next: Executing SCons Up: Scripting Madagascar Previous: SConstructs and commands

2011-11-03