Please note:The SCons wiki is in read-only mode due to ongoing spam/DoS issues. Also, new account creation is currently disabled. We are looking into alternative wiki hosts.
Differences between revisions 5 and 6
Revision 5 as of 2006-11-08 01:14:08
Size: 2325
Comment:
Revision 6 as of 2008-03-12 02:46:58
Size: 2325
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 12: C input files (more sources)

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

Line 17&19: Add dependencies to the targets since I can't add them to the sources. These dependencies are actually included by the ".scm" files, but I can't reference those. Also, note that I am using the reference to the targets that I stored (gambitTargetFiles) rather than explicitly trying to name the ".c" files (ie. "_io.c")

Line 23: Use the normal SCons StaticLibrary builder to convert all the ".c" files into a static library. Note that this will generate a bunch of ".o" files first. Store the SCons reference to this library.

Line 24: Return the reference to the newly built library so that I don't have to hunt for it using a filename

   1 # -*-python-*-
   2 
   3 Import(["env"])
   4 
   5 cpppath = [".", "#include"]
   6 
   7 env.Replace(CPPPATH=cpppath)
   8 
   9 gambitSourceFiles = ["_io.scm", "_num.scm", "_std.scm", "_kernel.scm", "_nonstd.scm", "_repl.scm",
  10                      "_eval.scm", "_thread.scm", "_system.scm"]
  11 
  12 cSourceFiles = ["main.c", "os_tty.c", "c_intf.c", "os_io.c", "setup.c", "mem.c", "os_files.c", "os.c",
  13                 "os_base.c", "os_time.c", "os_shell.c", "os_dyn.c", "_gambc.c"]
  14 
  15 gambitTargetFiles = env.GambitCompiler(gambitSourceFiles)
  16 
  17 env.Depends(gambitTargetFiles, ["header.scm"])
  18 #FIXME: Really need a scanner for this.  With Scheme, this should be pathetically easy to make
  19 env.Depends(gambitTargetFiles, ["_kernel#.scm", "_thread#.scm", "_system#.scm", "_num#.scm", "_io#.scm",
  20                                 "_eval#.scm", "_repl#.scm", "_std#.scm", "_nonstd#.scm"])
  21 
  22 
  23 libgambc = env.StaticLibrary("gambc", [gambitTargetFiles, cSourceFiles])
  24 Return("libgambc")

APLSConscript01-lib (last edited 2008-03-12 02:46:58 by localhost)