Attaching an emitter to an existing builder

Jeremy Elson <[email protected]>
Newsgroups gmane.comp.programming.tools.scons.user
Message-ID <CAKufN8UPA=yuUZjEx89z6+Sad1SUj+LEeO2JL8JyFkMOvTTRqw@mail.gmail.com>
Hi scons gurus,

Is there a way to attach an emitter to a pre-existing builder? I know how
to create my own custom Builders that have emitters, but I'm trying to add
an emitter to one of the standard builders that comes with SCons. I see a
function in Builder called add_emitter, so I tried this:

        def map_emitter(target, source, env):
            print("emitter is being called")

        env["BUILDERS"]["Program"].add_emitter(
            suffix = ".map",
            emitter = map_emitter)

But it throws an exception:

TypeError: 'EmitterProxy' object does not support item assignment

I'm using the standard SCons Program() Builder to build my program. But I
am also passing a linker option in LINKFLAGS so that when gcc is called at
the link stage, it generates both the program binary as its main output and
also an extra file (a .map file) that contains linker symbol metadata. I
want SCons to understand this side-effect so that if the map file gets
deleted, scons will run gcc again to regenerate it.

Thanks!

-Jeremy

_______________________________________________
Scons-users mailing list
[email protected]
https://pairlist4.pair.net/mailman/listinfo/scons-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.