# Copyright 2002, 2003, 2004, 2005 Dave Abrahams
# Copyright 2002, 2005, 2006, 2007, 2010 Rene Rivera
# Copyright 2006 Juergen Hunold
# Copyright 2005 Toon Knapen
# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus
# 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)
# Defines standard features and rules.
import alias ;
import "class" : new ;
import errors ;
import feature ;
import features/__init_features__ ;
import generators ;
import numbers ;
import os ;
import path ;
import print ;
import project ;
import property ;
import regex ;
import scanner ;
import sequence ;
import stage ;
import symlink ;
import toolset ;
import type ;
import targets ;
import types/register ;
import utility ;
import virtual-target ;
import message ;
import convert ;
# Generators need the target types registered first. So this import needs
# to be after that.
import generators/__init_generators__ ;
# FIXME: the following generate module import is not needed here but removing it
# too hastily will break using code (e.g. the main Boost library Jamroot file)
# that forgot to import the generate module before calling the generate rule.
import generate ;
variant debug : <optimization>off <debug-symbols>on <inlining>off
<runtime-debugging>on ;
variant release : <optimization>speed <debug-symbols>off <inlining>full
<runtime-debugging>off <define>NDEBUG ;
variant profile : release : <profiling>on <debug-symbols>on ;
class preprocessed-target-class : basic-target
{
import generators ;
rule construct ( name : sources * : property-set )
{
local result = [ generators.construct [ project ]
$(name) : PREPROCESSED_CPP : $(property-set) : $(sources) ] ;
if ! $(result)
{
result = [ generators.construct [ project ]
$(name) : PREPROCESSED_C : $(property-set) : $(sources) ] ;
}
if ! $(result)
{
local s ;
for x in $(sources)
{
s += [ $(x).name ] ;
}
local p = [ project ] ;
errors.user-error
"In project" [ $(p).name ] :
"Could not construct preprocessed file \"$(name)\" from $(s:J=, )." ;
}
return $(result) ;
}
}
rule preprocessed ( name : sources * : requirements * : default-build * :
usage-requirements * )
{
local project = [ project.current ] ;
return [ targets.main-target-alternative
[ new preprocessed-target-class $(name) : $(project)
: [ targets.main-target-sources $(sources) : $(name) ]
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build $(default-build) : $(project) ]
: [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
] ] ;
}
IMPORT $(__name__) : preprocessed : : preprocessed ;