[Scons-users] Custom builder with conditional actions

jeremy combs combs.jeremy at gmail.com
Tue May 19 11:03:19 EDT 2015


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?

Thanks,

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


More information about the Scons-users mailing list