]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/tools/build/src/tools/generators/c-compiling-generator.jam
update sources to v12.2.3
[ceph.git] / ceph / src / boost / tools / build / src / tools / generators / c-compiling-generator.jam
1 # Copyright 2002-2017 Rene Rivera
2 # Copyright 2002-2017 Vladimir Prus
3 # Distributed under the Boost Software License, Version 1.0.
4 # (See accompanying file LICENSE_1_0.txt or copy at
5 # http://www.boost.org/LICENSE_1_0.txt)
6
7 import "class" : new ;
8 import generators ;
9 import virtual-target ;
10
11 # Declare a special compiler generator. The only thing it does is changing the
12 # type used to represent 'action' in the constructed dependency graph to
13 # 'compile-action'. That class in turn adds additional include paths to handle
14 # cases when a source file includes headers which are generated themselves.
15 #
16 class C-compiling-generator : generator
17 {
18 rule __init__ ( id : source-types + : target-types + : requirements *
19 : optional-properties * )
20 {
21 generator.__init__ $(id) : $(source-types) : $(target-types) :
22 $(requirements) : $(optional-properties) ;
23 }
24
25 rule action-class ( )
26 {
27 return compile-action ;
28 }
29 }
30
31
32 rule register-c-compiler ( id : source-types + : target-types + : requirements *
33 : optional-properties * )
34 {
35 generators.register [ new C-compiling-generator $(id) : $(source-types) :
36 $(target-types) : $(requirements) : $(optional-properties) ] ;
37 }
38
39 # FIXME: this is ugly, should find a better way (we would like client code to
40 # register all generators as "generators.some-rule" instead of
41 # "some-module.some-rule".)
42 #
43 IMPORT $(__name__) : register-c-compiler : : generators.register-c-compiler ;
44
45 class compile-action : action
46 {
47 import sequence ;
48
49 rule __init__ ( targets * : sources * : action-name : properties * )
50 {
51 action.__init__ $(targets) : $(sources) : $(action-name) : $(properties) ;
52 }
53
54 # For all virtual targets for the same dependency graph as self, i.e. which
55 # belong to the same main target, add their directories to the include path.
56 #
57 rule adjust-properties ( property-set )
58 {
59 local s = [ $(self.targets[1]).creating-subvariant ] ;
60 if $(s)
61 {
62 return [ $(property-set).add-raw
63 [ $(s).implicit-includes "include" : H ] ] ;
64 }
65 else
66 {
67 return $(property-set) ;
68 }
69 }
70 }