[Scons-users] Overriding the default compilation behavior / supporting new compilers

Dan Čermák dan.cermak at cgc-instruments.com
Wed Sep 27 11:20:05 EDT 2017


Hi Yanghao,

you can override the environment variable 'CCCOM' to tell scons how your
compiler behaves (based on some condition).

For example:

env = Environment()

env["CC"] = os.getenv("CC") or "gcc"

if env["CC"] == "xyz-cc":
   env["CCCOM"] = '$CC -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES'

You can find the documentation of all these CC-something variables here:
http://scons.org/doc/1.0.1/HTML/scons-user/a4754.html
(the example I gave here is more or less copy-pasted from my SConstruct,
which I use to build a arm cortex m4 firmware with arm-none-eabi-gcc &
TI's armcl compiler)

Hope this is what you wanted to know.


Cheers,

Dan

Hua Yanghao <huayanghao at gmail.com> writes:

> Dear Scons Friends,
> I looked at https://bitbucket.org/scons/scons/wiki/ToolsForFools which
> is a good starting point explaining how to use scons to implement
> tools. However I am missing one part how scons is actually connecting
> the CC=xyz-cc to the tools/xyz-cc.py file. For cross-compilation (e.g.
> CC=arm-none-eabi-gcc) it just works (I assume it is using the GCC
> command line options).
>
> Assume I have a customized C compiler called xyz-cc which uses
> completely different command line options to generate object files and
> a customized library archiver xyz-ar for building static libraries.
> Instead of making a new builder name (e.g. xyzObject(),
> xyzStaticLibrary), how can I change the default behaviour of the
> Object/StaticLibrary/Program builder to use my customized compilation
> tool chain?
>
> Best Regards,
> Yanghao
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users


More information about the Scons-users mailing list