1# Copyright 2002, 2003, 2004, 2005 Dave Abrahams 2# Copyright 2002, 2005, 2006, 2007, 2010 Rene Rivera 3# Copyright 2006 Juergen Hunold 4# Copyright 2005 Toon Knapen 5# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus 6# Distributed under the Boost Software License, Version 1.0. 7# (See accompanying file LICENSE_1_0.txt or copy at 8# http://www.boost.org/LICENSE_1_0.txt) 9 10# Defines standard features and rules. 11 12import alias ; 13import "class" : new ; 14import errors ; 15import feature ; 16import features/__init_features__ ; 17import generators ; 18import numbers ; 19import os ; 20import path ; 21import print ; 22import project ; 23import property ; 24import regex ; 25import scanner ; 26import sequence ; 27import stage ; 28import symlink ; 29import toolset ; 30import type ; 31import targets ; 32import types/register ; 33import utility ; 34import virtual-target ; 35import message ; 36import convert ; 37 38# Generators need the target types registered first. So this import needs 39# to be after that. 40import generators/__init_generators__ ; 41 42# FIXME: the following generate module import is not needed here but removing it 43# too hastily will break using code (e.g. the main Boost library Jamroot file) 44# that forgot to import the generate module before calling the generate rule. 45import generate ; 46 47 48variant debug : <optimization>off <debug-symbols>on <inlining>off 49 <runtime-debugging>on ; 50variant release : <optimization>speed <debug-symbols>off <inlining>full 51 <runtime-debugging>off <define>NDEBUG ; 52variant profile : release : <profiling>on <debug-symbols>on ; 53 54 55class preprocessed-target-class : basic-target 56{ 57 import generators ; 58 rule construct ( name : sources * : property-set ) 59 { 60 local result = [ generators.construct [ project ] 61 $(name) : PREPROCESSED_CPP : $(property-set) : $(sources) ] ; 62 if ! $(result) 63 { 64 result = [ generators.construct [ project ] 65 $(name) : PREPROCESSED_C : $(property-set) : $(sources) ] ; 66 } 67 if ! $(result) 68 { 69 local s ; 70 for x in $(sources) 71 { 72 s += [ $(x).name ] ; 73 } 74 local p = [ project ] ; 75 errors.user-error 76 "In project" [ $(p).name ] : 77 "Could not construct preprocessed file \"$(name)\" from $(s:J=, )." ; 78 } 79 return $(result) ; 80 } 81} 82 83rule preprocessed ( name : sources * : requirements * : default-build * : 84 usage-requirements * ) 85{ 86 local project = [ project.current ] ; 87 return [ targets.main-target-alternative 88 [ new preprocessed-target-class $(name) : $(project) 89 : [ targets.main-target-sources $(sources) : $(name) ] 90 : [ targets.main-target-requirements $(requirements) : $(project) ] 91 : [ targets.main-target-default-build $(default-build) : $(project) ] 92 : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ] 93 ] ] ; 94} 95 96IMPORT $(__name__) : preprocessed : : preprocessed ; 97