[Scons-users] Builder

Carl Cerecke carl.cerecke at compacsort.com
Wed Nov 27 17:31:54 EST 2013


I'm not sure exactly what you are trying to do, but you might find that cog
http://nedbatchelder.com/code/cog/ will do the code generation part more
conveniently than what you are doing now. And running cog from scons should
be pretty straightforward.

Cheers,
Carl.


On 27 November 2013 15:56, Neven Klacar <nklacar at gmail.com> wrote:


> 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

>

> _______________________________________________

> Scons-users mailing list

> Scons-users at scons.org

> http://four.pairlist.net/mailman/listinfo/scons-users

>

>



--
Carl Cerecke
SENIOR SOFTWARE DEVELOPER



*M:* +64 21 205 0239
*F:* +64 9 634 4491
*Skype:* carl-compac
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://four.pairlist.net/pipermail/scons-users/attachments/20131128/64221cf4/attachment.html


More information about the Scons-users mailing list