Imported Upstream version 1.57.0
[platform/upstream/boost.git] / tools / build / src / tools / notfile.jam
1 # Copyright (c) 2005 Vladimir Prus.
2 # Distributed under the Boost Software License, Version 1.0.
3 # (See accompanying file LICENSE_1_0.txt or copy at
4 # http://www.boost.org/LICENSE_1_0.txt)
5
6 import "class" : new ;
7 import generators ;
8 import project ;
9 import targets ;
10 import toolset ;
11 import type ;
12
13
14 type.register NOTFILE_MAIN ;
15
16
17 class notfile-generator : generator
18 {
19     rule __init__ ( * : * )
20     {
21         generator.__init__ $(1) : $(2) : $(3) : $(4) : $(5) : $(6) : $(7) : $(8)
22             : $(9) : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16) :
23             $(17) : $(18) : $(19) ;
24     }
25
26     rule run ( project name ? : property-set : sources * : multiple ? )
27     {
28         local action ;
29         local action-name = [ $(property-set).get <action> ] ;
30         local m = [ MATCH ^@(.*) : $(action-name) ] ;
31         if $(m)
32         {
33             action = [ new action $(sources) : $(m[1]) : $(property-set) ] ;
34         }
35         else
36         {
37             action = [ new action $(sources) : notfile.run : $(property-set) ] ;
38         }
39         local t = [ new notfile-target $(name) : $(project) : $(action) ] ;
40         return [ virtual-target.register $(t) ] ;
41     }
42 }
43
44
45 generators.register [ new notfile-generator notfile.main : : NOTFILE_MAIN ] ;
46
47
48 toolset.flags notfile.run ACTION : <action> ;
49
50
51 actions run
52 {
53     $(ACTION)
54 }
55
56
57 rule notfile ( target-name : action + : sources * : requirements * :
58     default-build * )
59 {
60     targets.create-typed-target NOTFILE_MAIN : [ project.current ] :
61         $(target-name) : $(sources) : $(requirements) <action>$(action) :
62         $(default-build) ;
63 }
64
65 IMPORT $(__name__) : notfile : : notfile ;