mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
381 lines
14 KiB
Plaintext
381 lines
14 KiB
Plaintext
# (C) Copyright David Abrahams 2001. Permission to copy, use,
|
|
# modify, sell and distribute this software is granted provided this
|
|
# copyright notice appears in all copies. This software is provided
|
|
# "as is" without express or implied warranty, and with no claim as
|
|
# to its suitability for any purpose.
|
|
|
|
# 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.
|
|
#//<a href="http://gcc.gnu.org/">GNU<br>GCC</a>
|
|
|
|
# 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 ;
|
|
|
|
GCC_BIN_DIRECTORY ?= $(GCC_ROOT_DIRECTORY)/bin/ ;
|
|
GCC_BIN_DIRECTORY ?= "" ; # Don't clobber tool names if GCC_ROOT_DIRECTORY not set
|
|
GCC_STDLIB_DIRECTORY ?= $(GCC_ROOT_DIRECTORY)/lib ;
|
|
|
|
# Make sure this gets set "on" the target
|
|
flags gcc GCC_BIN_DIRECTORY : $(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 ;
|
|
|
|
#
|
|
# set threading options for various platforms:
|
|
#
|
|
if $(NT)
|
|
{
|
|
flags gcc CFLAGS <threading>multi : -mthreads ;
|
|
}
|
|
else if $(UNIX)
|
|
{
|
|
switch $(JAMUNAME)
|
|
{
|
|
case CYGWIN* :
|
|
{
|
|
flags gcc CFLAGS <threading>multi : -mthreads ;
|
|
}
|
|
case SunOS* :
|
|
{
|
|
flags gcc CFLAGS <threading>multi : -pthreads ;
|
|
flags gcc LINKFLAGS <threading>multi : -pthreads ;
|
|
flags gcc FINDLIBS <threading>multi : rt ;
|
|
NO_GNU_LN = true ; # sun seems not to use the GNU linker with gcc
|
|
}
|
|
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 * :
|
|
{
|
|
flags gcc CFLAGS <threading>multi : -pthread ;
|
|
flags gcc LINKFLAGS <threading>multi : -pthread ;
|
|
flags gcc FINDLIBS <threading>multi : rt ;
|
|
}
|
|
}
|
|
}
|
|
|
|
# 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 ;
|
|
# 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 ;
|
|
# 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 ;
|
|
}
|
|
|
|
#
|
|
# 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 STDHDRS <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 ! $(NT) # 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> ;
|
|
|
|
#### Link ####
|
|
|
|
rule Link-action
|
|
{
|
|
SPACE 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 && ! $(NO_GNU_LN)
|
|
{
|
|
OUTTAG on $(<) = ".$(DLLVERSION)" ;
|
|
SOTAG on $(<) = ".$(DLLVERSION)" ;
|
|
ACTION_1 on $(<) = "" ;
|
|
}
|
|
else
|
|
{
|
|
OUTTAG on $(<) = "" ;
|
|
SOTAG on $(<) = ;
|
|
ACTION_1 on $(<) = ;
|
|
}
|
|
# 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 neccessary with some versions of Cygwin.
|
|
IMPLIB_COMMAND on $(<) = "-Wl,--export-all-symbols -Wl,--exclude-symbols,_bss_end__:_bss_start__:_data_end__:_data_start__ -Wl,--out-implib," ;
|
|
DEPENDS $(<) : $(NEEDLIBS) $(NEEDIMPS) ;
|
|
gRUN_LD_LIBRARY_PATH($(<)) += $(STDLIBPATH:T) ;
|
|
if $(<[2]) && $(NT) && ( -mno-cygwin in $(gBUILD_PROPERTIES:G=) )
|
|
{
|
|
gcc-dllwrap $(<) : $(>) ;
|
|
}
|
|
else
|
|
{
|
|
# 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 && ! $(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
|
|
{
|
|
$(SHELL_SET)$(gSHELL_LIBPATH)=$(RUN_LD_LIBRARY_PATH)
|
|
$(SHELL_EXPORT)$(gSHELL_LIBPATH)
|
|
$(GCC_BIN_DIRECTORY)$(GXX) $(IMPLIB_COMMAND)$(<[2]) $(LINKFLAGS) -o "$(<[1])$(OUTTAG)" -L"$(LIBPATH:T)" -L"$(STDLIBPATH:T)" "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" "$(IMPLIB_FLAGS)$(NEEDIMPS)" -l$(FINDLIBS) $(LNOPT)-Wl,-rpath-link,.$(SPACE)"-Wl,-soname,$(<[1]:D=)$(SOTAG)"
|
|
$(ACTION_1)$(LN)$(SPACE)-fs$(SPACE)"$(<[1]:D=)$(OUTTAG)"$(SPACE)"$(<[1])"
|
|
}
|
|
|
|
actions gcc-dllwrap bind NEEDLIBS NEEDIMPS
|
|
{
|
|
dllwrap --dllname $(<[1]) -o foo.pyd $(>) -s --entry _DllMain@12 --target=i386-mingw32 -L"$(LIBPATH:T)" -L"$(STDLIBPATH:T)" "$(>)" "$(NEEDLIBS)" "$(NEEDLIBS)" "$(IMPLIB_FLAGS)$(NEEDIMPS)" -l"$(FINDLIBS)" -Wl,-rpath-link,. $(LINKFLAGS)
|
|
}
|
|
|
|
#### Cc #####
|
|
|
|
rule Cc-action
|
|
{
|
|
SPACE on $(<) = " " ;
|
|
gcc-Cc-action $(<) : $(>) ;
|
|
}
|
|
|
|
actions gcc-Cc-action
|
|
{
|
|
$(GCC_BIN_DIRECTORY)$(GCC) -c -Wall -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) -I"$(HDRS)" -I$(SPACE)"$(STDHDRS)" -o "$(<)" "$(>)"
|
|
}
|
|
|
|
#### C++ ####
|
|
rule C++-action
|
|
{
|
|
SPACE on $(<) = " " ;
|
|
gcc-C++-action $(<) : $(>) ;
|
|
}
|
|
|
|
actions gcc-C++-action
|
|
{
|
|
$(GCC_BIN_DIRECTORY)$(GXX) -c -Wall -ftemplate-depth-100 -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(C++FLAGS) -I"$(HDRS)" -I$(SPACE)"$(STDHDRS)" -o "$(<)" "$(>)"
|
|
}
|
|
|
|
#### Archive ####
|
|
|
|
rule Archive-action
|
|
{
|
|
gcc-Archive-action $(<) : $(>) ;
|
|
}
|
|
|
|
actions updated together piecemeal gcc-Archive-action
|
|
{
|
|
ar ru$(ARFLAGS) "$(<:T)" "$(>:T)"
|
|
}
|