[Scons-users] separation of behavior between building objects for shared libs and for executables

Bill Deegan bill at baddogconsulting.com
Thu Jun 15 16:18:53 EDT 2017


You can create several Environment()'s with different settings, or you can
specify the flags on env.Program(), or env.SharedObject(), or
env.Object(),etc...


What is your goal? (1000 foot view)
Start with that, rather than if I do this thing will it do this other thing?

-Bill

On Thu, Jun 15, 2017 at 4:12 PM, Mats Wichmann <mats at wichmann.us> wrote:

>
> Is this easily possible?
>
> As an example, consider this documented gcc behavior:
>
> -fpic
>     Generate position-independent code (PIC) suitable for use in a
> shared library, if supported for the target machine.
>
> -fpie
> -fPIE
>     These options are similar to -fpic and -fPIC, but generated position
> independent code can be only linked into executables.
>
>
> We see (on my system, x86_64 Linux):
>
>   'CCCOM': '$CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES',
>   'CCFLAGS': [],
>
>   'SHCCCOM': '$SHCC -o $TARGET -c $SHCFLAGS $SHCCFLAGS $_CCCOMCOM
> $SOURCES',
>   'SHCCFLAGS': ['$CCFLAGS', '-fPIC'],
>   'SHCFLAGS': ['$CFLAGS'],
>
>
> Which seems to imply if I set -fpie into CCFLAGS with the idea of using
> it for objects contributing to executables, it will also be picked into
> SHCCFLAGS and thus into the build of objects-for-shared-libraries as well.
>
> _______________________________________________
> Scons-users mailing list
> Scons-users at scons.org
> https://pairlist4.pair.net/mailman/listinfo/scons-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://pairlist4.pair.net/pipermail/scons-users/attachments/20170615/7098438c/attachment.html>


More information about the Scons-users mailing list