mirror of
https://github.com/boostorg/build.git
synced 2026-02-15 13:02:11 +00:00
Commit new version from Jim Douglas.
Also add RPATH/RPATH_LINK settings. [SVN r33212]
This commit is contained in:
239
v2/tools/qcc.jam
239
v2/tools/qcc.jam
@@ -1,85 +1,228 @@
|
||||
# Copyright (c) 2005 Jim Douglas.
|
||||
# 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)
|
||||
# Copyright (c) 2001 David Abrahams.
|
||||
# Copyright (c) 2002-2003 Rene Rivera.
|
||||
# Copyright (c) 2002-2003 Vladimir Prus.
|
||||
#
|
||||
# Use, modification and distribution is subject to the Boost Software
|
||||
# License Version 1.0. (See accompanying file LICENSE_1_0.txt or
|
||||
# http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
|
||||
import toolset ;
|
||||
import feature ;
|
||||
import toolset : flags ;
|
||||
|
||||
import gcc ;
|
||||
import property ;
|
||||
import generators ;
|
||||
import os ;
|
||||
import type ;
|
||||
import feature ;
|
||||
import "class" : new ;
|
||||
import set ;
|
||||
import common ;
|
||||
import errors ;
|
||||
import generators ;
|
||||
|
||||
feature.extend toolset : qcc ;
|
||||
|
||||
import unix ;
|
||||
toolset.inherit-generators qcc : unix : unix.link unix.link.dll ;
|
||||
generators.override builtin.lib-generator : qcc.prebuilt ;
|
||||
toolset.inherit-flags qcc : unix ;
|
||||
toolset.inherit-rules qcc : unix ;
|
||||
|
||||
toolset.inherit-generators qcc : gcc ;
|
||||
generators.override qcc.prebuilt : builtin.lib-generator ;
|
||||
generators.override qcc.prebuilt : builtin.prebuilt ;
|
||||
generators.override qcc.searched-lib-generator : searched-lib-generator ;
|
||||
|
||||
toolset.inherit-rules qcc : gcc ;
|
||||
toolset.inherit-flags qcc : gcc
|
||||
: <inlining>off <inlining>on <inlining>full <debug-symbols>on <link>shared
|
||||
<warnings>off <warnings>all
|
||||
;
|
||||
|
||||
rule init ( version ? : command * : options * )
|
||||
|
||||
# Make the "o" suffix used for qcc toolset on all
|
||||
# platforms
|
||||
type.set-generated-target-suffix OBJ : <toolset>qcc : o ;
|
||||
type.set-generated-target-suffix STATIC_LIB : <toolset>qcc : a ;
|
||||
|
||||
|
||||
# Initializes the qcc toolset for the given version.
|
||||
# If necessary, command may be used to specify where the compiler
|
||||
# is located.
|
||||
# The parameter 'options' is a space-delimited list of options, each
|
||||
# one being specified as <option-name>option-value. Valid option names
|
||||
# are: cxxflags, linkflags and linker-type. Accepted values for linker-type
|
||||
# are gnu and sun, gnu being the default.
|
||||
# Example:
|
||||
# using qcc : 3.4 : : <cxxflags>foo <linkflags>bar <linker-type>sun ;
|
||||
rule init ( version ? : command * : options * )
|
||||
{
|
||||
local condition = [ common.check-init-parameters qcc : version $(version) ] ;
|
||||
|
||||
command = [ common.get-invocation-command qcc : QCC : $(command) : ] ;
|
||||
|
||||
if $(command)
|
||||
{
|
||||
local root = [ common.get-absolute-tool-path $(command[-1]) ] ;
|
||||
local command = [ common.get-invocation-command qcc : QCC : $(command) ] ;
|
||||
|
||||
if $(root)
|
||||
{
|
||||
flags qcc.compile.c C_CONFIG_COMMAND : $(root)/qcc ;
|
||||
}
|
||||
else
|
||||
{
|
||||
# Just for legible output when testing.
|
||||
flags qcc.compile.c C_CONFIG_COMMAND : qcc ;
|
||||
}
|
||||
}
|
||||
command ?= QCC ;
|
||||
|
||||
common.handle-options qcc : $(condition) : $(command) : $(options) ;
|
||||
}
|
||||
|
||||
# For both compile and link.
|
||||
flags qcc OPTIONS <debug-symbols>on : -gstabs+ ;
|
||||
|
||||
generators.register-c-compiler qcc.compile.c++ : CPP : OBJ : <toolset>qcc ;
|
||||
generators.register-c-compiler qcc.compile.c : C : OBJ : <toolset>qcc ;
|
||||
generators.register-c-compiler qcc.compile.asm : ASM : OBJ : <toolset>qcc ;
|
||||
|
||||
|
||||
# Declare flags for compilation
|
||||
flags qcc.compile OPTIONS <debug-symbols>on : -gstabs+ ;
|
||||
|
||||
# Declare flags and action for compilation
|
||||
flags qcc.compile OPTIONS <optimization>off : -O0 ;
|
||||
flags qcc.compile OPTIONS <optimization>speed : -O3 ;
|
||||
flags qcc.compile OPTIONS <optimization>space : -Os ;
|
||||
|
||||
flags qcc.compile OPTIONS <inlining>off : -Wc,-fno-inline ;
|
||||
flags qcc.compile OPTIONS <inlining>on : -Wc,-Wno-inline ;
|
||||
flags qcc.compile OPTIONS <inlining>full : -Wc,-finline-functions,-Wno-inline ;
|
||||
#flags qcc.compile CFLAGS : -Wc,-Wall,-Wno-non-virtual-dtor ;
|
||||
flags qcc.compile OPTIONS <inlining>full : -Wc,-finline-functions -Wc,-Wno-inline ;
|
||||
|
||||
flags qcc.compile OPTIONS <warnings>off : -Wc,-w ;
|
||||
flags qcc.compile OPTIONS <warnings>off : -w ;
|
||||
flags qcc.compile OPTIONS <warnings>all : -Wc,-Wall ;
|
||||
flags qcc.compile OPTIONS <warnings-as-errors>on : -Wc,-Werror ;
|
||||
|
||||
#flags qcc OPTIONS <link>shared : -Wc,-fPIC ;
|
||||
flags qcc.compile OPTIONS <profiling>on : -p ;
|
||||
|
||||
flags qcc.compile OPTIONS <link>shared : -Wc,-fPIC ;
|
||||
flags qcc.compile OPTIONS <cflags> ;
|
||||
flags qcc.compile.c++ OPTIONS <cxxflags> ;
|
||||
flags qcc.compile DEFINES <define> ;
|
||||
flags qcc.compile INCLUDES <include> ;
|
||||
|
||||
flags qcc.link OPTIONS <link>shared : -Wl,-fPIC ;
|
||||
flags qcc.compile OPTIONS <link>shared : -shared ;
|
||||
|
||||
flags qcc FINDLIBS : m ;
|
||||
|
||||
actions compile.c++
|
||||
{
|
||||
"$(CONFIG_COMMAND)" $(LANG) -Wc,-ftemplate-depth-100 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
"$(CONFIG_COMMAND)" -Wc,-ftemplate-depth-100 $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
actions compile.c
|
||||
{
|
||||
"$(C_CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
"$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
actions compile.asm
|
||||
{
|
||||
"$(CONFIG_COMMAND)" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
# The class which check that we don't try to use
|
||||
# the <runtime-link>static property while creating or using shared library,
|
||||
# since it's not supported by qcc/libc.
|
||||
class qcc-linking-generator : unix-linking-generator
|
||||
{
|
||||
rule generated-targets ( sources + : property-set : project name ? )
|
||||
{
|
||||
if <runtime-link>static in [ $(property-set).raw ]
|
||||
{
|
||||
local m ;
|
||||
if [ id ] = "qcc.link.dll"
|
||||
{
|
||||
m = "on qcc, DLL can't be build with <runtime-link>static" ;
|
||||
}
|
||||
if ! $(m) {
|
||||
for local s in $(sources)
|
||||
{
|
||||
local type = [ $(s).type ] ;
|
||||
if $(type) && [ type.is-derived $(type) SHARED_LIB ]
|
||||
{
|
||||
m = "on qcc, using DLLS together with the <runtime-link>static options is not possible " ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if $(m)
|
||||
{
|
||||
errors.user-error $(m) :
|
||||
"it's suggested to use <runtime-link>static together with the <link>static" ;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return [ unix-linking-generator.generated-targets
|
||||
$(sources) : $(property-set) : $(project) $(name) ] ;
|
||||
}
|
||||
}
|
||||
|
||||
generators.register [ new qcc-linking-generator qcc.link : LIB OBJ : EXE
|
||||
: <toolset>qcc ] ;
|
||||
|
||||
generators.register [ new qcc-linking-generator qcc.link.dll : LIB OBJ : SHARED_LIB
|
||||
: <toolset>qcc ] ;
|
||||
|
||||
generators.override qcc.prebuilt : builtin.prebuilt ;
|
||||
generators.override qcc.searched-lib-generator : searched-lib-generator ;
|
||||
|
||||
|
||||
|
||||
# Declare flags for linking
|
||||
# First, the common flags
|
||||
flags qcc.link OPTIONS <debug-symbols>on : -gstabs+ ;
|
||||
flags qcc.link OPTIONS <profiling>on : -p ;
|
||||
flags qcc.link OPTIONS <linkflags> ;
|
||||
flags qcc.link LINKPATH <library-path> ;
|
||||
flags qcc.link FINDLIBS-ST <find-static-library> ;
|
||||
flags qcc.link FINDLIBS-SA <find-shared-library> ;
|
||||
flags qcc.link LIBRARIES <library-file> ;
|
||||
|
||||
flags qcc.link FINDLIBS-SA : m ;
|
||||
|
||||
# For <runtime-link>static we made sure there are no dynamic libraries
|
||||
# in the link
|
||||
flags qcc.link OPTIONS <runtime-link>static : -static ;
|
||||
|
||||
# Assuming this is just like with gcc.
|
||||
flags qcc.link RPATH : <dll-path> : unchecked ;
|
||||
flags qcc.link RPATH_LINK : <xdll-path> : unchecked ;
|
||||
|
||||
|
||||
|
||||
# Declare actions for linking
|
||||
rule link ( targets * : sources * : properties * )
|
||||
{
|
||||
SPACE on $(targets) = " " ;
|
||||
# Serialize execution of the 'link' action, since
|
||||
# running N links in parallel is just slower.
|
||||
# For now, serialize only qcc links, it might be a good
|
||||
# idea to serialize all links.
|
||||
JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
|
||||
}
|
||||
|
||||
actions link bind LIBRARIES
|
||||
{
|
||||
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -Wl,-rpath-link$(SPACE)-Wl,"$(RPATH_LINK)" -o "$(<)" "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)
|
||||
}
|
||||
|
||||
|
||||
# Always remove archive and start again. Here's rationale from
|
||||
# Andre Hentz:
|
||||
# I had a file, say a1.c, that was included into liba.a.
|
||||
# I moved a1.c to a2.c, updated my Jamfiles and rebuilt.
|
||||
# My program was crashing with absurd errors.
|
||||
# After some debugging I traced it back to the fact that a1.o was *still*
|
||||
# in liba.a
|
||||
RM = [ common.rm-command ] ;
|
||||
|
||||
if [ os.name ] = NT
|
||||
{
|
||||
RM = "if exist \"$(<[1])\" DEL \"$(<[1])\"" ;
|
||||
}
|
||||
|
||||
|
||||
# Declare action for creating static libraries
|
||||
# The 'r' letter means to add files to the archive with replacement
|
||||
# Since we remove archive, we don't care about replacement, but
|
||||
# there's no option "add without replacement".
|
||||
# The 'c' letter means suppresses warning in case the archive
|
||||
# does not exists yet. That warning is produced only on
|
||||
# some platforms, for whatever reasons.
|
||||
actions piecemeal archive
|
||||
{
|
||||
$(RM) "$(<)"
|
||||
ar rc "$(<)" "$(>)"
|
||||
}
|
||||
|
||||
|
||||
rule link.dll ( targets * : sources * : properties * )
|
||||
{
|
||||
SPACE on $(targets) = " " ;
|
||||
JAM_SEMAPHORE on $(targets) = <s>qcc-link-semaphore ;
|
||||
}
|
||||
|
||||
# Differ from 'link' above only by -shared.
|
||||
actions link.dll bind LIBRARIES
|
||||
{
|
||||
"$(CONFIG_COMMAND)" -L"$(LINKPATH)" -Wl,-R$(SPACE)-Wl,"$(RPATH)" -o "$(<)" $(HAVE_SONAME)-Wl,-h$(SPACE)-Wl,$(<[1]:D=) -shared "$(>)" "$(LIBRARIES)" -l$(FINDLIBS-ST) -l$(FINDLIBS-SA) $(OPTIONS)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user