Ticket #7193: vacpp.jam.patch

File vacpp.jam.patch, 8.0 KB (added by Hubert Tong <hstong@…>, 10 years ago)

vacpp.jam improvements

  • tools/build/v2/tools/vacpp.jam

    old new  
    1313import common ;
    1414import generators ;
    1515import os ;
     16if [ os.name ] = LINUX
     17{
     18    import gcc ;
     19}
    1620
    1721feature.extend toolset : vacpp ;
    1822toolset.inherit vacpp : unix ;
     23if [ os.name ] = LINUX
     24{
     25    rule link ( targets * : sources * : properties * )
     26    {
     27        gcc.quote-rpath $(targets) ;
     28    }
     29
     30    rule link.dll ( targets * : sources * : properties * )
     31    {
     32        gcc.quote-rpath $(targets) ;
     33    }
     34
     35    rule archive ( targets * : sources * : properties * )
     36    {
     37        gcc.archive $(targets) : $(sources) : $(properties) ;
     38    }
     39}
    1940generators.override vacpp.prebuilt : builtin.prebuilt ;
    2041generators.override vacpp.searched-lib-generator : searched-lib-generator ;
    2142
     
    2546    local condition = [
    2647        common.check-init-parameters vacpp : version $(version) ] ;
    2748             
    28     command = [ common.get-invocation-command vacpp : xlC
     49    local tool-command = [ common.get-invocation-command vacpp : xlC
    2950        : $(command) : "/usr/vacpp/bin/xlC" ] ;
    3051       
    31     common.handle-options vacpp : $(condition) : $(command) : $(options) ;
     52    common.handle-options vacpp : $(condition) : $(tool-command) : $(options) ;
     53
     54    if [ os.name ] = LINUX
     55    {
     56        gcc.init-link-flags vacpp gnu $(condition) ;
     57    }
    3258}
    3359
    3460# Declare generators
     
    4369flags vacpp CFLAGS <optimization>speed : -O3 -qstrict ;
    4470flags vacpp CFLAGS <optimization>space : -O2 -qcompact ;
    4571
    46 # Discretionary inlining (not recommended)
     72# Inlining
    4773flags vacpp CFLAGS <inlining>off : -qnoinline ;
    48 flags vacpp CFLAGS <inlining>on : -qinline ;
    49 #flags vacpp CFLAGS <inlining>full : -qinline ;
    50 flags vacpp CFLAGS <inlining>full : ;
     74flags vacpp CFLAGS <inlining>on : -qinline=noauto ;
     75flags vacpp CFLAGS <inlining>full : -qinline=auto ;
    5176
    5277# Exception handling
    5378flags vacpp C++FLAGS <exception-handling>off : -qnoeh ;
     
    5984
    6085# Enable 64-bit memory addressing model
    6186flags vacpp CFLAGS <address-model>64 : -q64 ;
    62 flags vacpp LINKFLAGS <address-model>64 : -q64 ;
    63 flags vacpp ARFLAGS <target-os>aix/<address-model>64 : -X 64 ;
     87flags vacpp.link OPTIONS <address-model>64 : -q64 ;
     88flags vacpp AIX_OBJ_MODE <target-os>aix/<address-model>64 : -X 64 ;
    6489
    6590# Use absolute path when generating debug information
    6691flags vacpp CFLAGS <debug-symbols>on : -g -qfullpath ;
    67 flags vacpp LINKFLAGS <debug-symbols>on : -g -qfullpath ;
    68 flags vacpp LINKFLAGS <debug-symbols>off : -s ;
     92flags vacpp.link OPTIONS <debug-symbols>on : -g -qfullpath ;
     93flags vacpp.link OPTIONS <target-os>aix/<debug-symbols>off/<strip>on : -s ;
    6994
    7095if [ os.name ] = AIX
    7196{
    7297    flags vacpp.compile C++FLAGS : -qfuncsect ;
    7398
     99    # Enable 32-bit Very Large Address-Space
     100    flags vacpp.link OPTIONS <address-model>32 : -bmaxdata:0xAFFFFFFF/dsa ;
     101
    74102    # The -bnoipath strips the prepending (relative) path of libraries from
    75103    # the loader section in the target library or executable. Hence, during
    76104    # load-time LIBPATH (identical to LD_LIBRARY_PATH) or a hard-coded
     
    84112    # AIX 4.x and AIX 6.x. For details about the AIX linker see:
    85113    # http://download.boulder.ibm.com/ibmdl/pub/software/dw/aix/es-aix_ll.pdf
    86114    #
    87     flags vacpp.link LINKFLAGS <link>shared : -bnoipath ;
     115    flags vacpp.link OPTIONS <link>shared : -bnoipath ;
    88116
    89117    # Run-time linking
    90118    flags vacpp.link EXE-LINKFLAGS <link>shared : -brtl ;
     
    93121{
    94122    # Linux PPC
    95123    flags vacpp.compile CFLAGS <link>shared : -qpic=large ;
    96     flags vacpp FINDLIBS : rt ;
     124    flags vacpp.link OPTIONS <link>shared : -qpic=large ;
     125    flags vacpp.link FINDLIBS-SA <threading>multi : rt ;
    97126}
    98127
    99128# Profiling
    100129flags vacpp CFLAGS <profiling>on : -pg ;
    101 flags vacpp LINKFLAGS <profiling>on : -pg ;
     130flags vacpp.link OPTIONS <profiling>on : -pg ;
    102131
    103132flags vacpp.compile OPTIONS <cflags> ;
    104133flags vacpp.compile.c++ OPTIONS <cxxflags> ;
     
    106135flags vacpp UNDEFS <undef> ;
    107136flags vacpp HDRS <include> ;
    108137flags vacpp STDHDRS <sysinclude> ;
    109 flags vacpp.link OPTIONS <linkflags> ;
     138
    110139flags vacpp ARFLAGS <arflags> ;
     140flags vacpp ARFLAGS <archiveflags> ;
    111141
    112 flags vacpp LIBPATH <library-path> ;
    113 flags vacpp NEEDLIBS <library-file> ;
    114 flags vacpp FINDLIBS <find-shared-library> ;
    115 flags vacpp FINDLIBS <find-static-library> ;
    116 
    117 # Select the compiler name according to the threading model.
    118 flags vacpp VA_C_COMPILER  <threading>single : xlc   ;
    119 flags vacpp VA_C_COMPILER  <threading>multi : xlc_r ;
    120 flags vacpp VA_CXX_COMPILER <threading>single : xlC   ;
    121 flags vacpp VA_CXX_COMPILER <threading>multi : xlC_r ;
     142flags vacpp.link USER_OPTIONS <linkflags> ;
     143flags vacpp.link LINKPATH <library-path> ;
     144flags vacpp.link LIBRARIES <library-file> ;
     145flags vacpp.link FINDLIBS-ST <find-static-library> ;
     146flags vacpp.link FINDLIBS-SA <find-shared-library> ;
     147
     148# Select the compiler configuration stanza according to the threading model.
     149flags vacpp VA_C_COMPILER_CFG  <threading>single : -F:xlc ;
     150flags vacpp VA_C_COMPILER_CFG  <threading>multi : -F:xlc_r ;
     151flags vacpp VA_CXX_COMPILER_CFG <threading>single : -F:xlC ;
     152flags vacpp VA_CXX_COMPILER_CFG <threading>multi : -F:xlC_r ;
    122153
    123154SPACE = " " ;
    124155
    125 flags vacpp.link.dll HAVE_SONAME <target-os>linux : "" ;
    126 
    127 actions vacpp.link bind NEEDLIBS
     156if [ os.name ] = AIX
    128157{
    129     $(VA_CXX_COMPILER) $(EXE-LINKFLAGS) $(LINKFLAGS) -o "$(<[1])" -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS)
     158    actions vacpp.link bind LIBRARIES
     159    {
     160        $(CONFIG_COMMAND) $(VA_CXX_COMPILER_CFG) $(EXE-LINKFLAGS) -o "$(<[1])" -L$(LINKPATH) "$(>)" "$(LIBRARIES)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS)
     161    }
     162
     163    actions vacpp.link.dll bind LIBRARIES
     164    {
     165        $(CONFIG_COMMAND) $(VA_CXX_COMPILER_CFG) -G -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LINKPATH) "$(>)" "$(LIBRARIES)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS) $(USER_OPTIONS)
     166    }
    130167}
    131 
    132 actions vacpp.link.dll bind NEEDLIBS
     168else
    133169{
    134     xlC_r -G $(LINKFLAGS) -o "$(<[1])" $(HAVE_SONAME)-Wl,-soname$(SPACE)-Wl,$(<[-1]:D=) -L$(LIBPATH) -L$(STDLIBPATH) "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" -l$(FINDLIBS) $(OPTIONS) $(USER_OPTIONS)
     170    actions link bind LIBRARIES
     171    {
     172        $(CONFIG_COMMAND) $(VA_CXX_COMPILER_CFG) -L"$(LINKPATH)" -Wl,-R,$(RPATH) -Wl,-rpath-link,"$(RPATH_LINK)" -o "$(<[1])" $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
     173    }
     174    actions link.dll bind LIBRARIES
     175    {
     176        $(CONFIG_COMMAND) $(VA_CXX_COMPILER_CFG) -G -L"$(LINKPATH)" -Wl,-R,$(RPATH) -o "$(<[1])" -Wl,-h,$(<[-1]:D=) $(START-GROUP) "$(>)" "$(LIBRARIES)" $(FINDLIBS-ST-PFX) -l$(FINDLIBS-ST) $(FINDLIBS-SA-PFX) -l$(FINDLIBS-SA) $(END-GROUP) $(OPTIONS) $(USER_OPTIONS)
     177    }
    135178}
    136179
    137180actions vacpp.compile.c
    138181{
    139     $(VA_C_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)"
     182    $(CONFIG_COMMAND) $(VA_C_COMPILER_CFG) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)"
    140183}
    141184
    142185actions vacpp.compile.c++
    143186{
    144     $(VA_CXX_COMPILER) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)"
     187    $(CONFIG_COMMAND) $(VA_CXX_COMPILER_CFG) -c $(OPTIONS) $(USER_OPTIONS) -I$(BOOST_ROOT) -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I"$(STDHDRS)" -o "$(<)" "$(>)"
    145188}
    146189
    147 actions updated together piecemeal vacpp.archive
     190if [ os.name ] = AIX
     191{
     192    actions updated together piecemeal vacpp.archive
     193    {
     194        ar $(AIX_OBJ_MODE) $(ARFLAGS) rcu "$(<)" "$(>)"
     195        ranlib $(AIX_OBJ_MODE) "$(<)"
     196    }
     197}
     198else
    148199{
    149     ar $(ARFLAGS) ru "$(<)" "$(>)"
     200    actions piecemeal archive
     201    {
     202        ar $(ARFLAGS) rc "$(<)" "$(>)"
     203        ranlib "$(<)"
     204    }
    150205}