mirror of
https://github.com/boostorg/build.git
synced 2026-02-16 13:22:11 +00:00
63 lines
2.1 KiB
Plaintext
63 lines
2.1 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 'make' rule and associated class, derived from
|
|
# 'basic-target'.
|
|
|
|
import targets ;
|
|
import class : class new ;
|
|
import property ;
|
|
import errors : error ;
|
|
|
|
rule make-target-class ( name : project : sources * : requirements *
|
|
: make-rule + : default-build )
|
|
{
|
|
basic-target.__init__ $(name) : $(project) : $(sources) : $(requirements)
|
|
: $(default-build) ;
|
|
self.make-rule = $(make-rule) ;
|
|
|
|
rule construct ( source-targets * : properties * )
|
|
{
|
|
local t = [ new virtual-target $(self.name)
|
|
: $(self.project) : [ property.remove-free $(properties) ] ] ;
|
|
local a = [ new action $(t) : $(source-targets) : $(self.make-rule)
|
|
: $(properties) ] ;
|
|
$(t).action $(a) ;
|
|
return $(t) ;
|
|
}
|
|
}
|
|
|
|
class make-target-class : basic-target ;
|
|
|
|
rule make ( target-name : sources * : generating-rule : requirements * )
|
|
{
|
|
local project-module = [ CALLER_MODULE ] ;
|
|
local location = [ project.attribute $(project-module) location ] ;
|
|
local ptarget = [ project.target $(location) ] ;
|
|
local default-build = [ project.attribute $(project-module) default-build ] ;
|
|
|
|
|
|
local pr = [ project.attribute $(project-module) requirements ] ;
|
|
|
|
# Don't do anything meaningfull on errors. This will be handled when
|
|
# we implement target types.
|
|
requirements = [ property.refine $(pr) : $(requirements) ] ;
|
|
if $(requirements[1]) = "@error"
|
|
{
|
|
error "Conflicting requirements for target:" $(requirements) ;
|
|
}
|
|
|
|
|
|
local target = [ $(ptarget).main-target $(target-name) ] ;
|
|
|
|
$(target).add-alternative
|
|
[ new make-target-class $(target-name) : $(project-module) : $(sources)
|
|
: $(requirements) : $(generating-rule) : $(default-build) ] ;
|
|
}
|
|
|
|
IMPORT $(__name__) : make : : make ;
|
|
|
|
|