mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 01:12:13 +00:00
* new/builtin.jam: Made 'toolset' and 'variant'
features symmentic. Document and fix the 'variant' rule.
* new/virtual-target.jam: Refactoring attempts. Split
virtual-target into virtual-target and derived from it
file-target. Eliminate some duplication in setting target
locations.
[SVN r16437]
63 lines
2.0 KiB
Plaintext
63 lines
2.0 KiB
Plaintext
# Copyright (C) Vladimir Prus 2002. Permission to copy, use, modify, sell and
|
|
# distribute this software is granted provided this copyright notice appears in
|
|
# all copies. This software is provided "as is" without express or implied
|
|
# warranty, and with no claim as to its suitability for any purpose.
|
|
|
|
# This module defines the 'prebuilt' rule, which allows to use targets
|
|
# created outside of Boost.Build, or for which no source is available..
|
|
|
|
import targets ;
|
|
import class : class new ;
|
|
import property ;
|
|
import errors : error ;
|
|
import type : type ;
|
|
import regex ;
|
|
|
|
rule prebuilt-target-class ( name : project : type file : requirements * : use-requirements * )
|
|
{
|
|
abstract-target.__init__ $(name) : $(project) ;
|
|
self.type = $(type) ;
|
|
self.file = $(file) ;
|
|
self.requirements = $(requirements) ;
|
|
self.use-requirements = $(use-requirements) ;
|
|
|
|
rule generate ( properties * )
|
|
{
|
|
local pl = [ project.attribute $(self.project) location ] ;
|
|
local path = [ path.root [ path.native $(self.file:D) ] $(pl) ] ;
|
|
|
|
# CONSIDER: refine properties?
|
|
local t = [ new file-target $(self.file:S=:D=) : $(self.type)
|
|
: $(self.project) ] ;
|
|
$(t).set-use-requirements $(self.use-requirements) ;
|
|
$(t).set-path $(path) ;
|
|
$(t).extra-grist [ property.as-path $(self.requirements) ] ;
|
|
$(t).suffix [ MATCH .(.*) : $(self.file:S) ] ;
|
|
return $(t) ;
|
|
}
|
|
|
|
rule requirements ( )
|
|
{
|
|
return $(self.requirements) ;
|
|
}
|
|
}
|
|
|
|
class prebuilt-target-class : abstract-target ;
|
|
|
|
rule prebuilt ( type target-name : file : requirements * : use-requirements * )
|
|
{
|
|
local project = [ CALLER_MODULE ] ;
|
|
|
|
targets.main-target-alternative
|
|
[ new prebuilt-target-class $(target-name) : $(project) :
|
|
$(type) $(file)
|
|
: [ targets.main-target-requirements $(requirements) : $(project) ]
|
|
: [ targets.main-target-use-requirements $(use-requirements) : $(project) ]
|
|
] ;
|
|
|
|
}
|
|
|
|
IMPORT $(__name__) : prebuilt : : prebuilt ;
|
|
|
|
|