[Scons-users] Custom builder with conditional actions

Bill Deegan bill at baddogconsulting.com
Tue May 19 19:16:39 EDT 2015


On Tuesday, May 19, 2015, jeremy combs <combs.jeremy at gmail.com> wrote:

> I am trying to create a builder that performs actions similar to how the
> Linux kernel does symbol versioning.
> See (
> https://github.com/torvalds/linux/blob/c0a80c0c27e5e65b180a25e6c4c2f7ef9e386cd3/scripts/Makefile.build#L200
> )
>
> As a first step I am trying to duplicate the linux kernel's steps as close
> as I can:
>
> 1. Build .o file from .c file
> 2. if .o file contains special section
>         2.true.1.  Run:  gcc -E [.c file] | [analaysis program] > [.o.ver
> file]
>         2.true.1   Run: ld -T [.o.ver file] -o [other.o file]
>         2.true.1   Run: mv [other.o file] [.o file]
>    2.false.1  Copy [.o file] [other.o file]
>
> I currently have this with a custom builder to take [.o file] to [other.o
> file] but in this custom builder I can't use SCons built in actions.  I
> have to build the gcc -E command line and execute it via subprocesses.  I
> would like to be able to use the builtin actions as much as possible to
> maintain compatibility.
>
> I have looked at Builders with a generator function, emitters and many
> examples.  Most of these examples run at evaluation time before the .o
> files are available to determine the needed actions.  It seems that every
> option that runs at build context (Scanners and Builders) when the .o files
> are available prevents me from altering the actions or tree at that time.
>
> So after all that I guess my question is: What is the recommended way to
> do something like this where actions are dependent on source file contents?
>
>
What causes the .o file to have a special section?
The source file? Preprocessor flags? Othe command line flags during
compilation?

-Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20150519/ee652bbf/attachment.html>


More information about the Scons-users mailing list