Please note:The SCons wiki is now restored from the attack in March 2013. All old passwords have been invalidated. Please reset your password if you have an account. If you note missing pages, please report them to Also, new account creation is currently disabled due to an ongoing spam flood (2013/08/27).
Differences between revisions 6 and 7
Revision 6 as of 2006-11-08 01:22:17
Size: 2146
Revision 7 as of 2008-03-12 02:47:00
Size: 2146
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Line 3: Imports the env from the parent script

Line 5&7: Sets up the C compiler to look in both the current directory and the include directory underneath the main directory in which SCons was started. Note the "#" in the "#include". This is important. That include directory contains a "config.h" file that almost all the C code references and it is not copied over to the build/etc/etc hierarchy.

Line 9: Gambit Scheme input files (sources)

Line 11: Converts the Gambit Scheme input files into C output files (targets) via the GambitCompiler Builder defined in the top-level SConstruct. ie. _gsi.scm becomes _gsi.c. Note that I am saving the targets here for later reference.

Line 15: Make the targets dependent upon libgambc. As the comment says, only the gsi executable is, strictly speaking, dependent upon libgambc. However, the easiest way to pick up the dependencies from _gsi.scm to the lib files is to make the _gsi target depend on the whole library. Yes, it's a bit of a hack which forces libgambc to build first.

Line 17: Gambit requires some extra link information to produce a stand-alone executable. This uses the GambitLinker Builder that was defined in the top-level SConstruct to produce that file. A better example of this is in the gsc SConscript which demonstrates the multiple sources compiling into one target. Here I only have one source.

Line 18: Invoke the normal SCons Program Builder to produce an executable and remember it

Line 19: Not used yet, but I send the reference to the executable back up to the SConstruct for later use, if required.

   1 # -*-python-*-
   3 Import(["env", "libgambc"])
   5 cpppath = [".", "#include"]
   7 env.Replace(CPPPATH=cpppath)
   9 gambitSourceFiles = ["_gsi.scm"]
  11 gambitTargetFiles = env.GambitCompiler(gambitSourceFiles)
  13 # The target files are not strictly dependent upon the entire
  14 # libgambc but on some of the files generated during its build
  15 env.Depends(gambitTargetFiles, libgambc)
  17 gsiLinkerFile = env.GambitLinker([gambitTargetFiles])
  18 gsi = env.Program("gsi", [gambitTargetFiles, gsiLinkerFile, libgambc])
  19 Return("gsi")

APLSConscript01-gsi (last edited 2008-03-12 02:47:00 by localhost)