diff options
author | Kenneth Heafield <github@kheafield.com> | 2012-05-12 14:01:52 -0400 |
---|---|---|
committer | Kenneth Heafield <github@kheafield.com> | 2012-05-12 14:01:52 -0400 |
commit | 3faecf9a00512dcbc8712c4bca9adae72fb64410 (patch) | |
tree | 9761b50d12f81a675fb7cbc663ceebad15079f78 /jam-files/boost-build/tools/make.py | |
parent | c806a8fff63043f63773874986301f2822a2b552 (diff) |
Give in and copy bjam into cdec source code
Diffstat (limited to 'jam-files/boost-build/tools/make.py')
-rw-r--r-- | jam-files/boost-build/tools/make.py | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/jam-files/boost-build/tools/make.py b/jam-files/boost-build/tools/make.py new file mode 100644 index 00000000..10baa1cb --- /dev/null +++ b/jam-files/boost-build/tools/make.py @@ -0,0 +1,59 @@ +# Status: ported. +# Base revision: 64068 + +# Copyright 2003 Dave Abrahams +# Copyright 2003 Douglas Gregor +# Copyright 2006 Rene Rivera +# Copyright 2002, 2003, 2004, 2005, 2006 Vladimir Prus +# Distributed under the Boost Software License, Version 1.0. +# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) + +# This module defines the 'make' main target rule. + +from b2.build.targets import BasicTarget +from b2.build.virtual_target import Action, FileTarget +from b2.build import type +from b2.manager import get_manager +import b2.build.property_set + + +class MakeTarget(BasicTarget): + + def construct(self, name, source_targets, property_set): + + action_name = property_set.get("<action>")[0] + action = Action(get_manager(), source_targets, action_name[1:], property_set) + target = FileTarget(self.name(), type.type(self.name()), + self.project(), action, exact=True) + return [ b2.build.property_set.empty(), + [self.project().manager().virtual_targets().register(target)]] + +def make (target_name, sources, generating_rule, + requirements=None, usage_requirements=None): + + target_name = target_name[0] + generating_rule = generating_rule[0] + if generating_rule[0] != '@': + generating_rule = '@' + generating_rule + + if not requirements: + requirements = [] + + + requirements.append("<action>%s" % generating_rule) + + m = get_manager() + targets = m.targets() + project = m.projects().current() + engine = m.engine() + engine.register_bjam_action(generating_rule) + + targets.main_target_alternative(MakeTarget( + target_name, project, + targets.main_target_sources(sources, target_name), + targets.main_target_requirements(requirements, project), + targets.main_target_default_build([], project), + targets.main_target_usage_requirements(usage_requirements or [], project))) + +get_manager().projects().add_rule("make", make) + |