Boost logo

Boost-Build :

From: Reece Dunn (msclrhd_at_[hidden])
Date: 2004-07-04 09:09:30


I have written a Metrowerks CodeWarrior toolset. It has not been extensively
tested (debug, library/archive builds, etc.).

This toolset requires the CVS version of BBv2 and follows the conventions of
the latest CVS changes (NOTE: default-paths rule needs work to detect the
various CodeWarrior versions). This makes the cw toolset configuration
consistent with the other tools:

using cw : 6.1 : "C:/Program Files/Metrowerks/CodeWarrior/Other
Metrowerks Tools/Command Line Tools/mwcc.exe" ;

Q: Are there any plans for a workaround for response files on Metrowerks and
GCC since they don't support them?

Regards,
Reece

_________________________________________________________________
Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo
 ------=_NextPart_000_323e_1061_4c5e Content-Type: text/plain; name="cw.jam"; format=flowed
Content-Transfer-Encoding: 8bit
Content-Disposition: attachment; filename="cw.jam"

# Copyright (C) Reece H Dunn 2004
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt)

# based on the msvc.jam toolset

# TODO: update to the latest CVS code

import property ;
import generators ;
import os ;
import type ;
import toolset : flags ;
import errors : error ;
import feature : feature ;
import path ;
import sequence : unique ;
import common ;

if [ MATCH (--debug-configuration) : [ modules.peek : ARGV ] ]
{
.debug-configuration = true ;
}

feature.extend toolset : cw ;

rule init ( version ? : command * : setup ? compiler ? linker ? )
{
setup ?= cwenv.bat ;
compiler ?= mwcc ;
linker ?= mwld ;

local condition = [ common.check-init-parameters cw : version $(version)
] ;

command = [ common.get-invocation-command cw : mwcc.exe : $(command) : [
default-paths $(version) ] ] ;

if $(command)
{
command = [ common.get-absolute-tool-path $(command[-1]) ] ;
}
local root = $(command) ;

setup = $(root)\\$(setup) ;

# map the batch file in setup so it can be executed

setup = "call \""$(setup)"\" > nul " ;

if [ os.name ] = NT
{
setup = $(setup)"
" ;
}
else
{
setup = "cmd /S /C "$(setup)" \"&&\" " ;
}

# bind the setup command to the tool so it can be executed before the
command

local prefix = $(setup) ;

flags cw.compile .CC $(condition) : $(prefix)$(compiler) ;
flags cw.link .LD $(condition) : $(prefix)$(linker) ;
flags cw.archive .LD $(condition) : $(prefix)$(linker) ;
}

rule default-paths ( version ? ) # FIXME
{
local possible-paths ;

local ProgramFiles = [ modules.peek : ProgramFiles ] ;
if $(ProgramFiles)
{
ProgramFiles = "$(ProgramFiles:J= )" ;
}
else
{
ProgramFiles = "c:\\Program Files" ;
}

# TODO: add support for cw8 and cw9 detection

local version-6-path = $(ProgramFiles)"\\Metrowerks\\CodeWarrior" ;
possible-paths += $(version-6-path) ;

# perform post-processing

possible-paths = $(possible-paths)"\\Other Metrowerks Tools\\Command Line
Tools" ;

possible-paths += [ modules.peek : PATH Path path ] ;

return $(possible-paths) ;
}

## declare generators

generators.register-c-compiler cw.compile.c++ : CPP : OBJ : <toolset>cw ;
generators.register-c-compiler cw.compile.c : C : OBJ : <toolset>cw ;

generators.register-linker cw.link : OBJ SEARCHED_LIB STATIC_LIB IMPORT_LIB
: EXE : <toolset>cw ;
generators.register-linker cw.link.dll : OBJ SEARCHED_LIB STATIC_LIB
IMPORT_LIB : SHARED_LIB IMPORT_LIB : <toolset>cw ;
generators.register-composing cw.archive : OBJ : STATIC_LIB : <toolset>cw ;

## compilation phase

flags cw WHATEVER <toolset-cw:version> ;

flags cw.compile CFLAGS <debug-symbols>on : -g ;
flags cw.compile CFLAGS <optimization>off : -O0 ;
flags cw.compile CFLAGS <optimization>speed : -O4,p ;
flags cw.compile CFLAGS <optimization>space : -O4,s ;
flags cw.compile CFLAGS <inlining>off : -inline off ;
flags cw.compile CFLAGS <inlining>on : -inline on ;
flags cw.compile CFLAGS <inlining>full : -inline all ;
flags cw.compile CFLAGS <exception-handling>off : -Cpp_exceptions off ;
flags cw.compile CFLAGS <rtti>off : -RTTI off ;

flags cw.compile USER_CFLAGS <cflags> : ;
flags cw.compile.c++ USER_CFLAGS <cxxflags> : ;

flags cw.compile DEFINES <define> ;
flags cw.compile UNDEFS <undef> ;
flags cw.compile INCLUDES <include> ;

actions compile.c
{
$(.CC) -c -lang c -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(USER_CFLAGS)
-I"$(INCLUDES)" -o "$(<)" "$(>)"
}
actions compile.c++
{
$(.CC) -c -lang c++ -U$(UNDEFS) -D$(DEFINES) $(CFLAGS) $(USER_CFLAGS)
-I"$(INCLUDES)" -o "$(<)" "$(>)"
}

## linking phase

flags cw.link DEF_FILE <def-file> ;

flags cw LINKFLAGS <debug-symbols>on : -g ;
flags cw LINKFLAGS <user-interface>console : -subsystem console ;
flags cw LINKFLAGS <user-interface>gui : -subsystem windows ;
flags cw LINKFLAGS <user-interface>wince : -subsystem wince ;
flags cw LINKFLAGS <user-interface>native : -subsystem native ;
flags cw LINKFLAGS <user-interface>auto : -subsystem auto ;

flags cw LINKFLAGS <main-target-type>LIB/<link>static : -library ;
flags cw LINKFLAGS <main-target-type>LIB/<link>shared : -shared ;

toolset.flags cw.link USER_LINKFLAGS <linkflags> ;
toolset.flags cw.link LINKPATH <library-path> ;

actions link bind DEF_FILE
{
$(.LD) -o "$(<)" "$(>)" -L"$(LINKPATH)" $(LINKFLAGS) $(USER_LINKFLAGS)
}

actions link.dll bind DEF_FILE
{
$(.LD) -o "$(<)" "$(>)" -L"$(LINKPATH)" $(LINKFLAGS) -f "$(DEF_FILE)"
$(USER_LINKFLAGS)
}

if [ os.name ] in NT
{
actions archive
{
if exist "$(<[1])" DEL "$(<[1])"
$(.LD) -library -o "$(<[1])" "$(>)"
}
}
else # cygwin
{
# TODO: check that this actually works
actions archive
{
_bbv2_out_="$(<)"
if test -f "$_bbv2_out_" ; then
_bbv2_existing_="$(<:W)"
fi
$(.LD) -library "-o $(<:W)" $_bbv2_existing_ "$(>)"
}
}

 ------=_NextPart_000_323e_1061_4c5e--


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