]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
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. | |
1e59de90 TL |
7 | # (See accompanying file LICENSE.txt or copy at |
8 | # https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
9 | |
10 | # Defines standard features and rules. | |
11 | ||
12 | import alias ; | |
13 | import "class" : new ; | |
14 | import errors ; | |
15 | import feature ; | |
b32b8144 | 16 | import features/__init_features__ ; |
7c673cae FG |
17 | import generators ; |
18 | import numbers ; | |
19 | import os ; | |
20 | import path ; | |
21 | import print ; | |
22 | import project ; | |
23 | import property ; | |
24 | import regex ; | |
25 | import scanner ; | |
26 | import sequence ; | |
27 | import stage ; | |
28 | import symlink ; | |
29 | import toolset ; | |
30 | import type ; | |
31 | import targets ; | |
32 | import types/register ; | |
33 | import utility ; | |
34 | import virtual-target ; | |
35 | import message ; | |
36 | import convert ; | |
37 | ||
b32b8144 FG |
38 | # Generators need the target types registered first. So this import needs |
39 | # to be after that. | |
40 | import generators/__init_generators__ ; | |
41 | ||
7c673cae FG |
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. | |
45 | import generate ; | |
46 | ||
47 | ||
7c673cae FG |
48 | variant debug : <optimization>off <debug-symbols>on <inlining>off |
49 | <runtime-debugging>on ; | |
50 | variant release : <optimization>speed <debug-symbols>off <inlining>full | |
51 | <runtime-debugging>off <define>NDEBUG ; | |
52 | variant profile : release : <profiling>on <debug-symbols>on ; | |
53 | ||
54 | ||
7c673cae FG |
55 | class 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 | ||
83 | rule 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 | ||
96 | IMPORT $(__name__) : preprocessed : : preprocessed ; |