Boost logo

Boost-Build :

From: Christopher Currie (Christopher_at_[hidden])
Date: 2003-07-28 14:48:50


All,

Attached is a basic toolset file for the Sun family of C++ compilers for
Solaris. I've named it "sun.jam" because the compiler has changed
marketing names several times in the last five years, but all of them
largely take the same set of options.

This should be placed in $(BOOST_BUILD_ROOT)/tools, and can be used by
adding "using sun ;" to your $(BOOST_BUILD_ROOT)/new/user-config.jam file.

Let me know if anyone has problems using this toolset. I've tested it
using Sun C++ 5.4.

Christopher
 --------------070702030509010903070101 Content-Type: text/plain;
name="sun[1].jam"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="sun[1].jam"

# Copyright (C) Christopher Currie 2003. 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.

import property ;
import generators ;
import os ;
import toolset : flags ;
import feature ;
import type ;

toolset.register sun ;
feature.subfeature toolset sun : version ;

# Installation root to use for versionless toolset
.root = "" ;

rule init ( version ? : root ? )
{
# If version is not provided, change the global variable
if ! $(version)
{
if ! $(root)
{
# versionless and rootless, we assume that user has CC
# in the path, so we try and find it, and set up the
# paths accordingly
import regex ;
import modules ;
local SUNCC = [ GLOB [ modules.peek : Path ] [ modules.peek : PATH ] : CC ] ;
root = $(SUNCC[1]:D) ; root = $(root:P) ;
}
if $(root)
{
toolset.flags sun .root <toolset>sun : $(root)/bin/ ;
}
}
else
{
feature exetend-subfeature toolset sun : version : $(version) ;
local condition = <toolset>sun-$(version) ;
root = $(root)/bin/ ;
root ?= "" ;
toolset.flags sun .root $(condition) : $(root) ;
}
# this return is needed, because if absent the unversion/unrooted
# case doesn't work at all
return ;
}

# Declare generators
generators.register-c-compiler sun.compile.c : C : OBJ : <toolset>sun ;
generators.register-c-compiler sun.compile.c++ : CPP : OBJ : <toolset>sun ;
generators.register-composing sun.archive : OBJ : STATIC_LIB : <toolset>sun ;
generators.register-linker sun.link.dll : LIB OBJ : SHARED_LIB : <toolset>sun ;
generators.register-linker sun.link : LIB OBJ : EXE : <toolset>sun ;

# Declare flags and actions for compilation
flags sun.compile OPTIONS <debug-symbols>on : -g ;
flags sun.compile OPTIONS <profiling>on : -xprofile=tcov ;
flags sun.compile OPTIONS <optimization>speed : -fast -xarch=generic ;
flags sun.compile OPTIONS <optimization>space : -xO2 -xspace ;
flags sun.compile OPTIONS <threading>multi : -mt ;

flags sun.compile.c++ OPTIONS <inlining>off : +d ;

flags sun.compile OPTIONS <cflags> ;
flags sun.compile.c++ OPTIONS <cxxflags> ;
flags sun.compile DEFINES <define> ;
flags sun.compile INCLUDES <include> ;

actions compile.c
{
"$(.root)cc" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

actions compile.c++
{
"$(.root)CC" $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
}

# Declare flags and actions for linking
flags sun.link OPTIONS <debug-symbols>on : -g ;
# Strip the binary when no debugging is needed
flags sun.link OPTIONS <debug-symbols>off : -s ;
flags sun.link OPTIONS <profiling>on : -xprofile=tcov ;
flags sun.link OPTIONS <threading>multi : -mt ;
flags sun.link OPTIONS <linkflags> ;
flags sun.link LINKPATH <library-path> ;
flags sun.link FINDLIBS-ST <find-static-library> ;
flags sun.link FINDLIBS-SA <find-shared-library> ;
flags sun.link LIBRARIES <library> ;
flags sun.link LINK-RUNTIME <link-runtime>static : static ;
flags sun.link LINK-RUNTIME <link-runtime>shared : dynamic ;
flags sun.link RPATH <dll-path> ;

rule link ( targets * : sources * : properties * )
{
SPACE on $(targets) = " " ;
}

actions link bind LIBRARIES
{
"$(.root)CC" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
}

# Slight mods for dlls
rule link.dll ( targets * : sources * : properties * )
{
SPACE on $(targets) = " " ;
}

actions link.dll bind LIBRARIES
{
"$(.root)CC" $(OPTIONS) -L"$(LINKPATH)" -R"$(RPATH)" -o "$(<)" -h$(<[1]:D=) -G "$(>)" "$(LIBRARIES)" -Bdynamic -l$(FINDLIBS-SA) -Bstatic -l$(FINDLIBS-ST) -B$(LINK-RUNTIME)
}

# Declare action for creating static libraries
actions piecemeal archive
{
"$(.root)CC" -xar -o "$(<)" "$(>)"
}

 --------------070702030509010903070101--


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk