[Scons-users] Builder

Neven Klacar nklacar at gmail.com
Tue Nov 26 21:56:53 EST 2013


Hi, trying to make a builder that takes source file
a.c and creates a new C file, a_altered.c using a python script or program
that in this example will be preprocess lets say.

Then I want to pass the altered file to be built in normal workflow

newfile=MyBuilder("a.c")
object=env.Object(newFile)
env.Library(object)
....

In the builder I created a an emitter which modifies the target files to
have a different name.
*Builder*
def generate(env):
my_bld = env.Builder(action = 'preprocess< $SOURCE > $TARGET'
,
source_scanner = SCons.Scanner.C.CScanner(),
emitter = my_emitter,
suffix = '.c2', src_suffix = '.c')

env.Append(BUILDERS = {'MyBuilder' : my_bld})



def my_emitter(target, source, env):

for t in target:

t.name=t.name[:t.name.rfind('.')]+'_altered.c'

return (target,source)



The basic error I get is that there seems to be two ways to build the same
file

.../project/build/objects/a_altered.c failed: Multiple ways to build the
same target were specified for: ...project/build/objects/a_altered.c (from
['.../project/src/a.c'] and from ['.../project/src/a.c'])



Am I going about this the right way?


I appreciate any help or suggestions!


Thanks,

Neven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131126/c0d8202c/attachment-0001.htm


More information about the Scons-users mailing list