[Scons-users] separation of behavior between building objects for shared libs and for executables
    Mats Wichmann 
    mats at wichmann.us
       
    Thu Jun 15 16:12:31 EDT 2017
    
    
  
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.
    
    
More information about the Scons-users
mailing list