diff options
author | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-05-13 03:35:30 +0200 |
---|---|---|
committer | Patrick Simianer <simianer@cl.uni-heidelberg.de> | 2012-05-13 03:35:30 +0200 |
commit | d94373453c69c6cfec952a0f7b427cacc78654d8 (patch) | |
tree | 43febdf719c103d19bd5d22d0be734e1574bc1e9 /jam-files/boost-build/tools/convert.jam | |
parent | cc9650b8b664d1f6836a0fa86a012401b51aafa0 (diff) | |
parent | a65a80c5d5b6fc4cbd32280f07cae9be71551b70 (diff) |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'jam-files/boost-build/tools/convert.jam')
-rw-r--r-- | jam-files/boost-build/tools/convert.jam | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/jam-files/boost-build/tools/convert.jam b/jam-files/boost-build/tools/convert.jam new file mode 100644 index 00000000..ac1d7010 --- /dev/null +++ b/jam-files/boost-build/tools/convert.jam @@ -0,0 +1,62 @@ +# Copyright (c) 2009 Vladimir Prus +# +# Use, modification and distribution is subject to the Boost Software +# License Version 1.0. (See accompanying file LICENSE_1_0.txt or +# http://www.boost.org/LICENSE_1_0.txt) + +# Implements 'convert' target that takes a bunch of source and +# tries to convert each one to the specified type. +# +# For example: +# +# convert objects obj : a.cpp b.cpp ; +# + +import targets ; +import generators ; +import project ; +import type ; +import "class" : new ; + +class convert-target-class : typed-target +{ + rule __init__ ( name : project : type + : sources * : requirements * : default-build * : usage-requirements * ) + { + typed-target.__init__ $(name) : $(project) : $(type) + : $(sources) : $(requirements) : $(default-build) : $(usage-requirements) ; + } + + rule construct ( name : source-targets * : property-set ) + { + local r = [ generators.construct $(self.project) : $(self.type) + : [ property-set.create [ $(property-set).raw ] # [ feature.expand + <main-target-type>$(self.type) ] + # ] + : $(source-targets) ] ; + if ! $(r) + { + errors.error "unable to construct" [ full-name ] ; + } + + return $(r) ; + } + +} + +rule convert ( name type : sources * : requirements * : default-build * + : usage-requirements * ) +{ + local project = [ project.current ] ; + + # This is a circular module dependency, so it must be imported here + modules.import targets ; + targets.main-target-alternative + [ new convert-target-class $(name) : $(project) : [ type.type-from-rule-name $(type) ] + : [ 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__) : convert : : convert ; |