The builder for program only knows how to link technically.
The definition is below:
program = SCons.Builder.Builder(action = SCons.Defaults.LinkAction,
emitter = '$PROGEMITTER',
prefix = '$PROGPREFIX',
suffix = '$PROGSUFFIX',
src_suffix = '$OBJSUFFIX',
src_builder = 'Object',
target_scanner = ProgramScanner)
Please note the bold part. ( or src_suffix and src_builder if you cannot see
the bold)
What this allows for in SCons is for the Program builder to pass any “unknown”
file types via extension to the object builder. The object builder will then
look at it and try to build it if it know based on the extensions. You should
see code like this:
for suffix in CXXSuffixes:
static_obj.add_action(suffix, SCons.Defaults.CXXAction)
shared_obj.add_action(suffix, SCons.Defaults.ShCXXAction)
static_obj.add_emitter(suffix, SCons.Defaults.StaticObjectEmitter)
shared_obj.add_emitter(suffix, SCons.Defaults.SharedObjectEmitter)
In the different C++ based tools. This code adds the suffix of the source file
and the action to build the source file for the given C/C++ compiler to the
object builder. You will see similar code to for fortran, except it will add
the correct Fortran extension. Similar work can be done to treat C# or any
other language that could make object form of the file.
Hope this helps.
Jason
From: [email protected] [mailto:[email protected]] On
Behalf Of anatoly techtonik
Sent: Monday, February 04, 2013 2:39 AM
To: SCons Development
Subject: [Scons-dev] Program() builder speccy
Hi,
When I call Program() - how does SCons know which tool to use to compile the
program? Does it use an extension list? Or always uses C/C++ if other tool is
not explicitly specified as some argument or environment flag?
--
anatoly t.
_______________________________________________
Scons-dev mailing list
[email protected]
http://two.pairlist.net/mailman/listinfo/scons-dev