Boost logo

Boost Users :

From: Rene Rivera (grafik.list_at_[hidden])
Date: 2005-05-25 11:46:36


David Abrahams wrote:
> Patrik Jonsson <patrik_at_[hidden]> writes:
>
>>Thanks for the -o option, that made things easier to debug. I think I've
>>got it mostly working now (with gcc 3.4, with 3.2 it fails with strange
>>pthread errors), using the command
>>
>>bjam -a "-sTOOLS=gcc" "-sBUILD=<cxxflags>-maix64 <linkflags>-maix64
>><arflags>-X 64" --prefix=$HOME --libdir=$HOME/lib64-gcc
>>--includedir=$HOME/include-gcc install
>>
>>This seems to build most of the shared libraries, but some things won't
>>build under 64-bit (see below). However, the <arflags> doesn't work. The
>
> Hm. Rene, this one's your line:
>
> 1.87 (grafik 05-Mar-04): "$(.AR[1])" ru$(ARFLAGS:J=) "$(<)" "$(>)"
>
> Do you know what's going on?

It's the bjam "variable space split" behavior causing the -sBUILD to be
split at an unintended place.

By the way it's fairly easy to add support for this as we already
support some of the other platform related options for gcc. For example
doing:

bjam ... "-sBUILD=<architecture>power/<address-model>64"

Would give you the "-mpower64" option in most of the commands. Just need
to know what the eventual complete commands are :-) But it's looks like
I can get that from this post.

>>The correct command line to get ar to process 64-bit files is "ar -X 64
>>ru ...". The -X option is put in the wrong place, and the 64 ended up
>>completely wrong. I don't know how to specify this.
>
> Actually I think you need to do
>
> <arflags>-X <arflags>64
>
> if you want it to work.

Unfortunately, wouldn't work :-( The current gcc/ar invocation assumes
that all the ar flags should come together as one argument. So it would
end up with "ar ru-X64 ...". The gcc toolset needs to change to support
options that are not part of the "ru.." command arg.

>>In general, it seems it would make sense to have dedicated functionality
>>to switch between 32 and 64-bit ABI on machines where this makes sense,
>>especially since I guess this now affects AMD Athlon64 machines and not
>>just us fringe RS/6000 users... ;-)
>
> Well, we do have <address-model>64

Yep.. And it was intended exactly for this situation.. Just didn't have
anyone that actually exercised this until now. Well at least no one
complained until now ;-)

OK.. I've made some changes that will hopefully handle this particular
situation. Patrik if you want to try them out, the two files that you
need to replace are attached. Just put them into the */tools/build/v1
directory. And to get the functionality you need to invoke bjam
something like:

bjam ...
"-sBUILD=<architecture>power/<address-model>64/<object-model>aix" ...

Tell me if it works for you so I can commit the changes to CVS (for the
next release).

-- 
-- Grafik - Don't Assume Anything
-- Redshift Software, Inc. - http://redshift-software.com
-- rrivera/acm.org - grafik/redshift-software.com
-- 102708583/icq - grafikrobot/aim - Grafik/jabber.org

#~ Copyright David Abrahams 2001.
#~ Copyright Rene Rivera 2004.

#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

# A summary of features:
#
# - "feature" has a fixed list of values, of which the first is the default.
# Affect link compatability.
#
# - "free-feature" has a variable or fixed list of values, default is empty.
# Does not affect link compatability.
#
# - "path-feature" has a variable list of path values, default is empty.
# Does not affect link compatability.
#
# - "dependency-feature" like "path-feature" but affects dependency rebuilds.

# Profiling feature support by Toon Knapen <toon_at_[hidden]>.
feature profiling : off on ;

# C/C++ alignment of structure members
feature struct-alignment : auto 1 2 4 8 16 ;

# Type of exceptions to use, Metrowerks/CodeWarrior only.
feature eh-model : default fast msvc ;

# ??, GCC only.
feature vtable-thunks : default on off ;

# Generate code to support, or not threading.
feature threading : single multi ;

# Link to the language runtime libraries as a shared object, or statically
# link them into the produced object.
feature runtime-link : dynamic static ;

# Use either the debug or release versions of the language runtime,
# when available.
feature runtime-build : debug release ;

# Compilation optimization level.
feature optimization : off speed space ;

# Inlining, "off" disables it, "on" enables with "inline" keywords, and
# "full" enables it for specified functions and any others the compiler
# deams inline-able.
feature inlining : off on full ;

# Generate and include debug symbol information.
feature debug-symbols : on off ;

# ??.
free-feature debug-store : object database ;

# What type of OS subsystem to target. Windows only.
free-feature user-interface : console gui ;

# ??.
feature unicode-application : on off ;

# Enable/disable exceptions.
feature exception-handling : on off ;

# Enable/disable C++ runtime type information.
feature rtti : on off ;

# Set the feature to "no" in order to skip the build of this target.
# Useful to disable known non-working compilers or variants.
feature build : yes no ;

# ??.
feature stdlib : "default" gcc stlport ;

# Used to specify "default-BUILD" properties that will be used if not
# overridden by the BUILD variable.
free-feature "default" ;

# Custom flags for the various build procedures.
free-feature cflags ;
free-feature linkflags ;
free-feature cxxflags ;
free-feature arflags ;

# Preprocessor definitions.
free-feature define ; # <define>PYTHON=foo
free-feature undef ; # <undef>PYTHON=foo

# Add a user include path (#include "x.h").
path-feature "include" ; # <include>../foo/bar/mumble

# Add a system include path (#include <x.h>).
path-feature sysinclude ; # <sysinclude>/fu/man/chu

# Finding libraries needs a search path and a base library name.
path-feature library-path ;
free-feature find-library ;

# Link in an external library file.
dependency-feature library-file ;

# The version of a shared object. <dllversion>1.27.0 (for use with soname-ing)
free-feature dllversion ;

# Add a name tag to a target, see Boost.Build documentation for details.
free-feature tag ;

# ??.
free-feature version ;

# Control warnings, to turn the on, off, how many, and which ones.
# Values are toolset dependent, but the ones listed here must
# be supported...
# - "on", default has warnings enabled.
# - "off", no warnings.
# - "error", turn warnings into errors.
# For toolsets that support it specifying a number
# will limit the number of warnings produced.
free-feature warnings ;

# Control how many errors to tollerate.
free-feature errors ;

# Include file as prefix before all other includes.
free-feature prefix ;

# How to interpret relative paths in includes.
# - "relative", as GCC search relative to inclusion point.
# - "directory", relative to current directory.
# - "source", realtive to original source file.
# - "paths", only search given include and sysinclude paths.
free-feature include-search : relative directory source paths ;

# Can the target participate in a shared library?
feature shared-linkable : false true ;

# The addressing model to generate code for.
# Currently a limited set only specifying the bit size of pointers.
feature address-model : default 16 32 64 ;

# Type of CPU architecture to compile for.
feature architecture :
    # The default is the machine we are on, i.e. nothing
    native
    # x86 and compatible
    x86
    # Sparc
    sparc
    # RS/6000 & PowerPC
    power
    # MIPS/SGI
    mips1 mips2 mips3 mips4
    ;

# The specific instruction set in an architecture to compile.
feature instruction-set :
    # Default should probably always be the lowest common denominator.
    default
    # x86 and compatible
    i386 i486 i586 i686 pentium pentium-mmx pentiumpro pentium2 pentium3 pentium4
    k6 k6-2 k6-3 athlon athlon-tbird athlon-4 athlon-xp athlon-mp
    # Sparc
    v7 cypress v8 supersparc sparclite hypersparc sparclite86x
    f930 f934 sparclet tsc701 v9 ultrasparc
    # RS/6000 & PowerPC
    rios rios1 rsc rios2 rs64a
    601 602 603 603e 604 604e 620 630 740 750
    power power2 powerpc power64
    403 505 801 821 823 860
    power-common
    # MIPS
    r2000 r3000 r3900 r4000 r4100 r4300 r4400 r4600 r4650 r5000 r6000 r8000 orion
    ;

# The object model the compiler uses when compiling C++ code. Currently only
# relevant for Compaq C++ V6.3 and newer.
feature object-model :
    # Use the default object model which works best for boost. This most
    # probably should be 'ansi' in all cases.
    default
    # Explicitly select the 'arm' object model. Used for backward compatible
    # binaries.
    arm
    # Explicitly select the 'ansi' object model. Used to support the complete
    # standard.
    ansi
    # AIX has it's own ABI, this is available with the gcc -maix32/64 options.
    aix
    ;

gLINK_COMPATIBLE = <shared-linkable>true <target-type> <inlining> ;

gALWAYS_RELEVANT = <target-type> <tag> <default> <build> ;

##### Requirements by target type #####
gTARGET_TYPE_REQUIREMENTS(DLL) = <shared-linkable>true ;

##### Variant definitions ####
variant common :
    <vtable-thunks>default
    <struct-alignment>auto
    <eh-model>default
    <threading>single
    <unicode-application>off
    <exception-handling>on
    <rtti>on
    <shared-linkable>false
    <address-model>default
    <architecture>native
    <instruction-set>default
    <profiling>off
    <object-model>default
    ;

variant debug : common :
    <debug-symbols>on
    <runtime-build>debug
    <optimization>off
    <inlining>off
    ;

if $(NT)
{
    variant debug-python : debug :
      <define>BOOST_DEBUG_PYTHON
      <gcc><define>Py_DEBUG
      ;
}
else
{
    variant debug-python : debug :
      <define>BOOST_DEBUG_PYTHON
      <define>Py_DEBUG
      ;
}

variant release : common :
    <debug-symbols>off
    <runtime-build>release
    <optimization>speed
    <inlining>full
    <define>NDEBUG
    ;

# Profiling variant by Toon Knapen <toon_at_[hidden]>
variant profile : release :
    <profiling>on
    <debug-symbols>on
    ;


# Copyright (c) 2001 David Abrahams.
# Copyright (c) 2002-2003 Rene Rivera.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

# The following #// line will be used by the regression test table generation
# program as the column heading for HTML tables. Must not include version number.
#//GNU
GCC

# compute directories for invoking GCC
#
# The gcc toolset can be user-configured using the following
# variables:
#
# GCC_ROOT_DIRECTORY
# The directory in which GCC was installed. Defaults to
# unset. Usually, there is no need to set this variable at
# all. However, if G++ is not in the path it is usually
# sufficient to configure this one variable. More fine-grained
# configuration is available by setting the following:
#
# GCC_BIN_DIRECTORY
# the directory prefix used to find the gcc executables. Defaults to
# $(GCC_ROOT_DIRECTORY)/bin/, or "" if GCC_ROOT_DIRECTORY is
# not set.
#
# GCC_INCLUDE_DIRECTORY
# the directory in which to find system includes. Defaults to
# empty.
#
# GCC_STDLIB_DIRECTORY
# the directory in which to find the standard library
# objects associated with this build of gcc. Defaults to
# $(GCC_ROOT_DIRECTORY)/lib.
#
# GXX
# The name by which g++ is invoked. You can also use this in
# lieu of setting the <cxxflags> property to force options such
# as "-V3.0.4" into the g++ command line: "-sGXX=g++ -V3.0.4".
#
# GCC
# Similar to GXX, the name by which gcc is invoked for "C"
# language targets.

# singleton variables...
set-as-singleton GCC_ROOT_DIRECTORY GCC_BIN_DIRECTORY GCC_INCLUDE_DIRECTORY GCC_STDLIB_DIRECTORY ;

flags gcc GCC_BIN_DIRECTORY : $(GCC_BIN_DIRECTORY) ;
flags gcc GCC_INCLUDE_DIRECTORY : $(GCC_INCLUDE_DIRECTORY) ;
flags gcc GCC_STDLIB_DIRECTORY : $(GCC_STDLIB_DIRECTORY) ;

GCC_BIN_DIRECTORY ?= $(GCC_ROOT_DIRECTORY)$(SLASH)bin ;
GCC_BIN_DIRECTORY ?= "" ; # Don't clobber tool names if GCC_ROOT_DIRECTORY not set
GCC_STDLIB_DIRECTORY ?= $(GCC_ROOT_DIRECTORY)$(SLASH)lib ;

# Make sure this gets set "on" the target
flags gcc GCC_BIN_DIR : $(GCC_BIN_DIRECTORY) ;

flags gcc LINKFLAGS <runtime-link>static : -static ;
flags gcc CFLAGS <debug-symbols>on : -g ;
flags gcc LINKFLAGS <debug-symbols>on : -g ;
flags gcc CFLAGS <optimization>off : -O0 ;
flags gcc CFLAGS <optimization>speed : -O3 ;

# Other optimizations we might want for GCC
# -fforce-mem -fomit-frame-pointer
# -foptimize-sibling-calls -finline-functions -ffast-math -finline-limit=10000

flags gcc CFLAGS <optimization>space : -Os ;
flags gcc CFLAGS <inlining>off : -fno-inline ;
flags gcc CFLAGS <inlining>on : -Wno-inline ;
flags gcc CFLAGS <inlining>full : -finline-functions -Wno-inline ;

flags gcc .GXX : $(GXX) ;
flags gcc .GCC : $(GCC) ;

#
# set threading options for various platforms:
#
local on-windows ;

if $(NT)
{
    on-windows = 1 ;
}
else if $(UNIX)
{
    switch $(JAMUNAME)
    {
        case CYGWIN* :
        {
            on-windows = 1 ;
        }
    }
}

flags gcc ON_WINDOWS : $(on-windows) ;

if $(on-windows)
{
    flags gcc CFLAGS <threading>multi : -mthreads ;
    flags gcc LINKFLAGS <threading>multi : -mthreads ;
}
else if $(UNIX)
{
    switch $(JAMUNAME)
    {
    case SunOS* :
        {
        flags gcc CFLAGS <threading>multi : -pthreads ;
        flags gcc LINKFLAGS <threading>multi : -pthreads ;
        flags gcc FINDLIBS <threading>multi : rt ;
        }
    case BeOS :
        {
        # BeOS has no threading options, don't set anything here.
        }
    case Darwin :
        {
        # MacOS X, doesn't need any threading options set
        # -lpthread is linked to by default.
        # There is no gcc/g++, we need to use cc/c++ instead:
        .GCC ?= cc ;
        .GXX ?= c++ ;
        }
    case *BSD :
        {
        flags gcc CFLAGS <threading>multi : -pthread ;
        flags gcc LINKFLAGS <threading>multi : -pthread ;
        # there is no -lrt on BSD
        }
    case DragonFly :
        {
        flags gcc CFLAGS <threading>multi : -pthread ;
        flags gcc LINKFLAGS <threading>multi : -pthread ;
        # there is no -lrt on BSD - DragonFly is a FreeBSD variant,
        # which anoyingly doesn't say it's a *BSD.
        }
    case IRIX :
        {
        # gcc on IRIX does not support multi-threading, don't set anything here.
        }
    case HP_UX :
        {
        # gcc on HP-UX does not support multi-threading, don't set anything here
        }
    case * :
        {
        flags gcc CFLAGS <threading>multi : -pthread ;
        flags gcc LINKFLAGS <threading>multi : -pthread ;
        flags gcc FINDLIBS <threading>multi : rt ;
        }
    }
}

# Some possibly supported, or not, linker flags. The support depends on the OS linker.
#
flags gcc RPATH_LINK ;
flags gcc SONAME ;

# Set/reset options for the linker of the platform.
#
if $(UNIX)
{
    switch $(JAMUNAME)
    {
    case SunOS* :
        {
        NO_GNU_LN = true ; # sun seems not to use the GNU linker with gcc
        flags gcc OBJCOPY_FLAGS <debug-symbols>on : "--set-section-flags .debug_str=contents" ;
        }
    case Linux :
        {
        RPATH_LINK = -Wl,-rpath-link, ;
        SONAME = -Wl,-soname, ;
        flags gcc OBJCOPY_FLAGS <debug-symbols>on : "--set-section-flags .debug_str=contents,debug" ;
        }
    case OpenBSD :
        {
        SONAME = -Wl,-soname, ;
        }
    case AIX* :
        {
        NO_GNU_LN = true ;
        IMPLIB_FLAGS = "-Wl,-bI:" ;
        }
    }
}

# Set architecture/instruction-set options.
#
# x86 and compatible
.ARCH = <architecture>x86 <architecture>native ;
flags gcc CFLAGS <architecture>x86/<instruction-set>default : -mcpu=i386 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>i386 : -mcpu=i386 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>i486 : -mcpu=i486 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>i586 : -mcpu=i586 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>i686 : -mcpu=i686 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>pentium : -mcpu=pentium ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>pentium-mmx : -mcpu=pentium-mmx ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>pentiumpro : -mcpu=pentiumpro ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>pentium2 : -mcpu=pentium2 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>pentium3 : -mcpu=pentium3 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>pentium4 : -mcpu=pentium4 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>k6 : -mcpu=k6 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>k6-2 : -mcpu=k6-2 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>k6-3 : -mcpu=k6-3 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>athlon : -mcpu=athlon ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>athlon-tbird : -mcpu=athlon-tbird ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>athlon-4 : -mcpu=athlon-4 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>athlon-xp : -mcpu=athlon-xp ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>athlon-mp : -mcpu=athlon-mp ;
# Sparc
.ARCH = <architecture>sparc <architecture>native ;
flags gcc CFLAGS <architecture>sparc/<instruction-set>default : -mcpu=v7 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>v7 : -mcpu=v7 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>cypress : -mcpu=cypress ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>v8 : -mcpu=v8 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>supersparc : -mcpu=supersparc ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>sparclite : -mcpu=sparclite ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>hypersparc : -mcpu=hypersparc ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>sparclite86x : -mcpu=sparclite86x ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>f930 : -mcpu=f930 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>f934 : -mcpu=f934 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>sparclet : -mcpu=sparclet ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>tsc701 : -mcpu=tsc701 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>v9 : -mcpu=v9 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>ultrasparc : -mcpu=ultrasparc ;
flags gcc CFLAGS <architecture>sparc/<address-model>64 : -m64 ;
flags gcc LINKFLAGS <architecture>sparc/<address-model>64 : -m64 ;
# RS/6000 & PowerPC
.ARCH = <architecture>power <architecture>native ;
flags gcc CFLAGS <architecture>power/<instruction-set>default : -mcpu=power ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>rios : -mcpu=rios ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>rios1 : -mcpu=rios1 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>rsc : -mcpu=rsc ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>rios2 : -mcpu=rios2 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>rs64a : -mcpu=rs64a ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>601 : -mcpu=601 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>602 : -mcpu=602 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>603 : -mcpu=603 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>603e : -mcpu=603e ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>604 : -mcpu=604 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>604e : -mcpu=604e ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>620 : -mcpu=620 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>630 : -mcpu=630 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>740 : -mcpu=740 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>750 : -mcpu=750 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>power : -mcpu=power ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>power2 : -mcpu=power2 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>powerpc : -mcpu=powerpc ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>power64 : -mcpu=power64 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>403 : -mcpu=403 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>505 : -mcpu=505 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>801 : -mcpu=801 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>821 : -mcpu=821 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>823 : -mcpu=823 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>860 : -mcpu=860 ;
flags gcc CFLAGS $(.ARCH)/<instruction-set>power-common : -mcpu=common ;
flags gcc CFLAGS <architecture>power/<address-model>64 : -mpowerpc64 ;
# AIX variant of RS/6000 & PowerPC
flags gcc CFLAGS <architecture>power/<address-model>32/<object-model>aix : -maix32 ;
flags gcc LINKFLAGS <architecture>power/<address-model>32/<object-model>aix : -maix32 ;
flags gcc CFLAGS <architecture>power/<address-model>64/<object-model>aix : -maix64 ;
flags gcc LINKFLAGS <architecture>power/<address-model>64/<object-model>aix : -maix64 ;
flags gcc AROPTIONS <architecture>power/<address-model>64/<object-model>aix : "-X 64" ;
# MIPS-1-2-3-4
flags gcc MIPS <architecture>mips1 <architecture>mips2 <architecture>mips3 <architecture>mips4 : TRUE ;
flags gcc MIPS
    <instruction-set>r2000 <instruction-set>r3000 <instruction-set>r3900
    <instruction-set>r4000 <instruction-set>r4100 <instruction-set>r4300
    <instruction-set>r4400 <instruction-set>r4600 <instruction-set>r4650
    <instruction-set>r5000 <instruction-set>r6000 <instruction-set>r8000
    <instruction-set>orion
    : TRUE ;
if $(MIPS)
{
    flags gcc CFLAGS <architecture>mips1 : -mips1 ;
    flags gcc CFLAGS <architecture>mips2 : -mips2 ;
    flags gcc CFLAGS <architecture>mips3 : -mips3 ;
    flags gcc CFLAGS <architecture>mips4 : -mips4 ;
    flags gcc CFLAGS <instruction-set>r2000 : -mcpu=r2000 ;
    flags gcc CFLAGS <instruction-set>r3000 : -mcpu=r3000 ;
    flags gcc CFLAGS <instruction-set>r3900 : -mcpu=r3900 ;
    flags gcc CFLAGS <instruction-set>r4000 : -mcpu=r4000 ;
    flags gcc CFLAGS <instruction-set>r4100 : -mcpu=r4100 ;
    flags gcc CFLAGS <instruction-set>r4300 : -mcpu=r4300 ;
    flags gcc CFLAGS <instruction-set>r4400 : -mcpu=r4400 ;
    flags gcc CFLAGS <instruction-set>r4600 : -mcpu=r4600 ;
    flags gcc CFLAGS <instruction-set>r4650 : -mcpu=r4650 ;
    flags gcc CFLAGS <instruction-set>r5000 : -mcpu=r5000 ;
    flags gcc CFLAGS <instruction-set>r6000 : -mcpu=r6000 ;
    flags gcc CFLAGS <instruction-set>r8000 : -mcpu=r8000 ;
    flags gcc CFLAGS <instruction-set>orion : -mcpu=orion ;
    # ...addressing model options
    flags gcc ADDRESS_MODEL_INVALID <address-model>16 : TRUE ;
    if $(ADDRESS_MODEL_INVALID)
    {
        EXIT "Error: Invalid addressing model for MIPS architecture (16)." ;
    }
    flags gcc CFLAGS <address-model>default : -mgp32 ;
    flags gcc CFLAGS <address-model>32 : -mgp32 ;
    flags gcc CFLAGS <address-model>64 : -mgp64 -mlong64 ;
}
#S390
if $(OSPLAT) = 390
{
    flags gcc CFLAGS <threading>multi : -D_REENTRANT ;
}

#
# define compiler names if not set:
.GCC ?= gcc ;
.GXX ?= g++ ;

flags gcc CFLAGS <profiling>on : -pg ;
flags gcc LINKFLAGS <profiling>on : -pg ;

flags gcc C++FLAGS <rtti>off : -fno-rtti ;
flags gcc C++FLAGS <vtable-thunks>on : -fvtable-thunks ;
flags gcc C++FLAGS <vtable-thunks>off : -fvtable-thunks=0 ;

flags gcc CFLAGS <cflags> ;
flags gcc C++FLAGS <cxxflags> ;
flags gcc DEFINES <define> ;
flags gcc UNDEFS <undef> ;
flags gcc HDRS <include> ;
flags gcc SYSHDRS <sysinclude> ;
flags gcc LINKFLAGS <linkflags> ;
flags gcc LINKFLAGS <debug-symbols>off : -s ;
flags gcc ARFLAGS <arflags> ;

flags gcc STDHDRS : $(GCC_INCLUDE_DIRECTORY) ;
flags gcc STDLIBPATH : $(GCC_STDLIB_DIRECTORY) ;

if ! $(ARFLAGS)
{
    flags gcc ARFLAGS : "" ;
}

if ! $(on-windows) # The compiler complains about -fPIC on NT
{
    flags gcc CFLAGS <shared-linkable>true : -fPIC ;
    flags gcc LINKFLAGS <shared-linkable>true : -fPIC ;
}

if $(BETOOLS)
{
    flags gcc LINKFLAGS <target-type>$(SHARED_TYPES) : -nostart ;
}
else
{
    flags gcc LINKFLAGS <target-type>$(SHARED_TYPES) : -shared ;
}

flags gcc LIBPATH <library-path> ;
flags gcc NEEDLIBS <library-file> ;
flags gcc FINDLIBS <find-library> ;

flags gcc DLLVERSION <dllversion> ;
DLLVERSION = $(DLLVERSION[1]) ;
DLLVERSION ?= $(BOOST_VERSION) ;

flags gcc TARGET_TYPE <target-type> ;

# allow for "ar" to be part of the compiler distribution, for
# example in mingw and cygwin
flags gcc .AR : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : ar ar.exe ] ;
.AR ?= ar ;

# used to manipulate the object files produced by GCC to
# prevent the merging of debug symbols (which happens to be n^2 slow)
flags gcc .OBJCOPY : [ GLOB $(GCC_BIN_DIRECTORY) $(PATH) : objcopy ] ;

if ! $(on-windows)
{
    flags gcc .SET_EXIT : "set -e" ;
}

#### Link ####

rule Link-action
{
    _ on $(<) = " " ;
    # if we don't have a GNU linker then we can't pass any GNU-ld specific flags:
    if $(NO_GNU_LN)
    {
        LNOPT on $(<) = ;
    }
    else
    {
        LNOPT on $(<) = "" ;
    }
    # do we use sonames or not?
    if $(DLLVERSION) && $(TARGET_TYPE) in $(SHARED_TYPES) && ( $(OS) = LINUX || $(OS) = OPENBSD ) && ! $(NO_GNU_LN)
    {
        OUTTAG on $(<) = ".$(DLLVERSION)" ;
        SOTAG on $(<) = ".$(DLLVERSION)" ;
        ACTION_1 on $(<) = "" ;
    }
    else
    {
        OUTTAG on $(<) = "" ;
        SOTAG on $(<) = ;
        ACTION_1 on $(<) = ;
    }

    if [ on $(<) return $(ON_WINDOWS) ]
    {
        # On Win32, choose different image bases for load-time efficiency
        DLL_LINK_FLAGS on $(<) += "-Wl,--enable-auto-image-base" ;
    }

    if $(<[2]) && [ on $(<) return $(ON_WINDOWS) ]
    {
        # Allow gcc-nocygwin to avoid this flag
        if ! $(GCC_NO_EXPORT_ALL)
        {
            DLL_LINK_FLAGS on $(<) += "-Wl,--export-all-symbols" ;
        }

        # This will appear before the import library name when building a DLL, but
        # will be "multiplied away" otherwise. The --exclude-symbols directive
        # proved to be necessary with some versions of Cygwin.
        DLL_LINK_FLAGS on $(<) += "-Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start__" ;

        # set the link command to generate an import library
        if ! $(NO_GNU_LN)
        {
            IMPLIB_COMMAND on $(<) = "-Wl,--out-implib," ;
        }
    }

    DEPENDS $(<) : $(NEEDLIBS) $(NEEDIMPS) ;
    gRUN_LD_LIBRARY_PATH($(<)) += $(STDLIBPATH:T) ;
    
    # Workaround GCC's lack of command-files and NT's line-length limitation.
    if $(NT) {
        JAMSHELL on $(<) = % ;
    }

    gcc-Link-action $(<) : $(>) ;

    if $(DLLVERSION) && $(TARGET_TYPE) in $(SHARED_TYPES) && ( $(OS) = LINUX || $(OS) = OPENBSD ) && ! $(NO_GNU_LN)
    {
        return "$(<[1]).$(DLLVERSION)" ;
    }
}

# for gcc, we repeat all libraries so that dependencies are always resolved
actions gcc-Link-action bind NEEDLIBS NEEDIMPS
{
    $(.SET_EXIT)
    $(SHELL_SET)$(gSHELL_LIBPATH)=$(LINK_LIBPATH)$(gAPPEND_LD_LIBRARY_PATH)
    $(SHELL_EXPORT)$(gSHELL_LIBPATH)
    "$(.GXX[1]:R=$(GCC_BIN_DIR))" $(.GXX[2-]) "$(DLL_LINK_FLAGS)" "$(IMPLIB_COMMAND)$(<[2])" $(LINKFLAGS) -o "$(<[1])$(OUTTAG)" -L"$(LIBPATH:T)" -L"$(STDLIBPATH:T)" "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" "$(IMPLIB_FLAGS)$(NEEDIMPS)" -l$(FINDLIBS) $(LNOPT)$(RPATH_LINK). $(LNOPT)$(SONAME)$(<[1]:D=)$(SOTAG)
    $(ACTION_1)$(LN)$(_)-fs$(_)"$(<[1]:D=)$(OUTTAG)"$(_)"$(<[1])"
}

#### Cc #####

rule Cc-action
{
    _ on $(<) = " " ;
    gcc-Cc-action $(<) : $(>) ;
}

actions gcc-Cc-action
{
    $(.SET_EXIT)
    "$(.GCC[1]:R=$(GCC_BIN_DIR))" $(.GCC[2-]) -c -Wall -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I$(_)"$(STDHDRS)" -I$(_)"$(SYSHDRS)" -o "$(<)" "$(>)"
    "$(.OBJCOPY[1])"$(_)$(OBJCOPY_FLAGS)$(_)"$(<)"
}

#### C++ ####
rule C++-action
{
    _ on $(<) = " " ;
    gcc-C++-action $(<) : $(>) ;
}

actions gcc-C++-action
{
    $(.SET_EXIT)
    "$(.GXX[1]:R=$(GCC_BIN_DIR))" $(.GXX[2-]) -c -Wall -ftemplate-depth-255 -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I$(_)"$(STDHDRS)" -I$(_)"$(SYSHDRS)" -o "$(<)" "$(>)"
    "$(.OBJCOPY[1])"$(_)$(OBJCOPY_FLAGS)$(_)"$(<)"
}

#### Archive ####

rule Archive-action
{
    gcc-Archive-action $(<) : $(>) ;
}

actions updated together piecemeal gcc-Archive-action
{
    "$(.AR[1])" $(AROPTIONS) ru$(ARFLAGS:J=) "$(<)" "$(>)"
}


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net