2 # Base revision: 64429.
4 # Copyright (c) 2005-2010 Vladimir Prus.
6 # Use, modification and distribution is subject to the Boost Software
7 # License Version 1.0. (See accompanying file LICENSE_1_0.txt or
8 # http://www.boost.org/LICENSE_1_0.txt)
11 import b2.build.type as type
12 import b2.build.generators as generators
13 import b2.build.virtual_target as virtual_target
14 import b2.build.toolset as toolset
15 import b2.build.targets as targets
17 from b2.manager import get_manager
18 from b2.util import bjam_signature
20 type.register("NOTFILE_MAIN")
22 class NotfileGenerator(generators.Generator):
24 def run(self, project, name, ps, sources):
26 action_name = ps.get('action')[0]
27 if action_name[0] == '@':
28 action = virtual_target.Action(get_manager(), sources, action_name[1:], ps)
30 action = virtual_target.Action(get_manager(), sources, "notfile.run", ps)
32 return [get_manager().virtual_targets().register(
33 virtual_target.NotFileTarget(name, project, action))]
35 generators.register(NotfileGenerator("notfile.main", False, [], ["NOTFILE_MAIN"]))
37 toolset.flags("notfile.run", "ACTION", [], ["<action>"])
39 get_manager().engine().register_action("notfile.run", "$(ACTION)")
41 @bjam_signature((["target_name"], ["action"], ["sources", "*"], ["requirements", "*"],
42 ["default_build", "*"]))
43 def notfile(target_name, action, sources, requirements, default_build):
45 requirements.append("<action>" + action)
47 return targets.create_typed_metatarget(target_name, "NOTFILE_MAIN", sources, requirements,
51 get_manager().projects().add_rule("notfile", notfile)