]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/tools/convert.jam
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / tools / build / src / tools / convert.jam
CommitLineData
7c673cae
FG
1# Copyright (c) 2009 Vladimir Prus
2#
3# Use, modification and distribution is subject to the Boost Software
1e59de90
TL
4# License Version 1.0. (See accompanying file LICENSE.txt or
5# https://www.bfgroup.xyz/b2/LICENSE.txt)
7c673cae
FG
6
7# Implements 'convert' target that takes a bunch of source and
8# tries to convert each one to the specified type.
9#
10# For example:
11#
12# convert objects obj : a.cpp b.cpp ;
13#
14
15import targets ;
16import generators ;
17import project ;
18import type ;
19import "class" : new ;
20
21class convert-target-class : typed-target
22{
23 rule __init__ ( name : project : type
24 : sources * : requirements * : default-build * : usage-requirements * )
25 {
26 typed-target.__init__ $(name) : $(project) : $(type)
27 : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ;
28 }
29
30 rule construct ( name : source-targets * : property-set )
31 {
32 local r = [ generators.construct $(self.project) : $(self.type)
33 : [ property-set.create [ $(property-set).raw ] # [ feature.expand
34 <main-target-type>$(self.type) ]
35 # ]
36 : $(source-targets) ] ;
37 if ! $(r)
38 {
39 errors.error "unable to construct" [ full-name ] ;
40 }
41
42 return $(r) ;
43 }
44
45}
46
47rule convert ( name type : sources * : requirements * : default-build *
48 : usage-requirements * )
49{
50 local project = [ project.current ] ;
51
52 # This is a circular module dependency, so it must be imported here
53 modules.import targets ;
54 targets.main-target-alternative
55 [ new convert-target-class $(name) : $(project) : [ type.type-from-rule-name $(type) ]
56 : [ targets.main-target-sources $(sources) : $(name) ]
57 : [ targets.main-target-requirements $(requirements) : $(project) ]
58 : [ targets.main-target-default-build $(default-build) : $(project) ]
59 : [ targets.main-target-usage-requirements $(usage-requirements) : $(project) ]
60 ] ;
61}
62IMPORT $(__name__) : convert : : convert ;