]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Copyright 2003 Dave Abrahams |
2 | # Copyright 2003 Douglas Gregor | |
3 | # Copyright 2006 Rene Rivera | |
4 | # Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus | |
5 | # Distributed under the Boost Software License, Version 1.0. | |
1e59de90 TL |
6 | # (See accompanying file LICENSE.txt or copy at |
7 | # https://www.bfgroup.xyz/b2/LICENSE.txt) | |
7c673cae FG |
8 | |
9 | # This module defines the 'make' main target rule. | |
10 | ||
11 | import "class" : new ; | |
11fdf7f2 | 12 | import param ; |
7c673cae FG |
13 | import project ; |
14 | import property-set ; | |
15 | import targets ; | |
16 | ||
17 | ||
18 | class make-target-class : basic-target | |
19 | { | |
20 | import "class" : new ; | |
11fdf7f2 TL |
21 | import indirect ; |
22 | import toolset ; | |
7c673cae FG |
23 | import type ; |
24 | import virtual-target ; | |
25 | ||
26 | rule __init__ ( name : project : sources * : requirements * | |
27 | : default-build * : usage-requirements * ) | |
28 | { | |
29 | basic-target.__init__ $(name) : $(project) : $(sources) : | |
30 | $(requirements) : $(default-build) : $(usage-requirements) ; | |
31 | } | |
32 | ||
33 | rule construct ( name : source-targets * : property-set ) | |
34 | { | |
35 | local action-name = [ $(property-set).get <action> ] ; | |
36 | # 'm' will always be set -- we add '@' ourselves in the 'make' rule | |
37 | # below. | |
38 | local m = [ MATCH ^@(.*) : $(action-name) ] ; | |
39 | ||
11fdf7f2 TL |
40 | local relevant = [ toolset.relevant [ indirect.get-rule $(m[1]) ] ] ; |
41 | local a = [ new action $(source-targets) : $(m[1]) : [ $(property-set).add $(relevant) ] ] ; | |
7c673cae FG |
42 | local t = [ new file-target $(self.name) exact : [ type.type |
43 | $(self.name) ] : $(self.project) : $(a) ] ; | |
11fdf7f2 | 44 | return $(relevant) [ virtual-target.register $(t) ] ; |
7c673cae FG |
45 | } |
46 | } | |
47 | ||
48 | ||
49 | # Declares the 'make' main target. | |
50 | # | |
51 | rule make ( target-name : sources * : generating-rule + : requirements * : | |
52 | usage-requirements * ) | |
53 | { | |
11fdf7f2 TL |
54 | param.handle-named-params |
55 | sources generating-rule requirements default-build usage-requirements ; | |
7c673cae FG |
56 | # The '@' sign causes the feature.jam module to qualify rule name with the |
57 | # module name of current project, if needed. | |
58 | local m = [ MATCH ^(@).* : $(generating-rule) ] ; | |
59 | if ! $(m) | |
60 | { | |
61 | generating-rule = @$(generating-rule) ; | |
62 | } | |
63 | targets.create-metatarget make-target-class : [ project.current ] : | |
64 | $(target-name) : $(sources) : $(requirements) <action>$(generating-rule) | |
65 | : : $(usage-requirements) ; | |
66 | } | |
67 | ||
68 | ||
69 | IMPORT $(__name__) : make : : make ; |