2
0
mirror of https://github.com/boostorg/build.git synced 2026-02-15 13:02:11 +00:00
Files
build/src/tools/make.jam
Vladimir Prus d66d2676d6 Make it possible to specify rule name with '@' prefix to the 'make' rule,
just like for 'notfile' rule. Using rule name without '@' still works
for backward compatibility.


[SVN r33632]
2006-04-10 11:26:04 +00:00

69 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 * : default-build * )
{
basic-target.__init__ $(name) : $(project) : $(sources)
: $(requirements) : $(default-build) ;
}
rule construct ( name : source-targets * : property-set )
{
local action-name = [ $(property-set).get <action> ] ;
# 'm' will always be set -- we add '@' outselfs in 'make'
# rule below.
local m = [ MATCH ^@(.*) : $(action-name) ] ;
local a = [ new action $(source-targets) : $(m[1])
: $(property-set) ] ;
local t = [ new file-target $(self.name) exact
: [ type.type $(self.name) ] : $(self.project) : $(a) ] ;
return [ property-set.empty ] [ virtual-target.register $(t) ] ;
}
}
# Declares the 'make' main target.
rule make ( target-name : sources * : generating-rule + : requirements * )
{
local project = [ project.current ] ;
# The '@' sign causes the feature.jam module to qualify rule name
# with the module name of current project, if needed.
local m = [ MATCH ^(@).* : $(generating-rule) ] ;
if ! $(m)
{
generating-rule = @$(generating-rule) ;
}
requirements += <action>$(generating-rule) ;
targets.main-target-alternative
[ new make-target-class $(target-name) : $(project)
: [ targets.main-target-sources $(sources) : $(target-name) ]
: [ targets.main-target-requirements $(requirements) : $(project) ]
: [ targets.main-target-default-build : $(project) ]
] ;
}
IMPORT $(__name__) : make : : make ;