2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-16 01:12:13 +00:00
Files
build/v2/tools/make.jam
Vladimir Prus 28867fecac Allow a generator's 'run' method to return additional usage requirements
as the first elements of result. Those usage requirements will be combined
with explicitly specified for the main target.

This is yet another step towards making 'main target classes' unnecessary.

* build/generators.jam
  (try-one-generator): Check if generator returned usage requirements or not.
  (construct): Make sure first element of result is always property set.
  (many other methods): Induced changes

* tools/builtin.jam
  (exe-target-class, lib-target-class): Remove.
  (linking-generator, seached-lib-generator): Compute usage requirements.
  (archiving-generator): New class


[SVN r26192]
2004-11-12 08:11:14 +00:00

71 lines
2.3 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' main target rule.
import targets ;
import "class" : new ;
import property ;
import errors : error ;
import type : type ;
import regex ;
import property-set ;
import project ;
class make-target-class : basic-target
{
import type regex virtual-target ;
import "class" : new ;
rule __init__ ( 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 * : property-set )
{
local t = [ new file-target $(self.name:S=) : [ type.type $(self.name) ]
: $(self.project) ] ;
$(t).suffix [ regex.match .(.*) : $(self.name:S) ] ;
local a = [ new action $(t) : $(source-targets) : $(self.make-rule)
: $(property-set) ] ;
$(t).action $(a) ;
return [ property-set.empty ] [ virtual-target.register $(t) ] ;
}
}
# Declares the 'make' main target.
rule make ( target-name : sources * : generating-rule + : requirements *
: caller ? )
{
caller ?= [ project.current ] ;
caller-module = [ $(caller).project-module ] ;
local rules = [ RULENAMES $(caller-module) ] ;
if $(generating-rule[1]) in $(rules)
{
# This is local rule, make it global
local n = $(caller-module).$(generating-rule[1]) ;
IMPORT $(caller-module) : $(generating-rule[1]) : : $(n) ;
generating-rule = $(n) $(generating-rule[2-]) ;
}
targets.main-target-alternative
[ new make-target-class $(target-name) : $(caller)
: [ targets.main-target-sources $(sources) : $(target-name) ]
: [ targets.main-target-requirements $(requirements) : $(caller) ]
: $(generating-rule)
: [ targets.main-target-default-build : $(caller) ]
] ;
}
IMPORT $(__name__) : make : : make ;