1# Copyright Craig Rodrigues 2005.
2# Copyright (c) 2008 Steven Watanabe
3#
4# Distributed under the Boost
5# Software License, Version 1.0. (See accompanying
6# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7from b2.build import type as type_
8from b2.manager import get_manager
9from b2.tools.cast import cast
10from b2.util import bjam_signature
11
12
13MANAGER = get_manager()
14PROJECT_REGISTRY = MANAGER.projects()
15
16# maps project.name() + type to type
17_project_types = {}
18
19type_.register_type('ASM', ['s', 'S', 'asm'])
20
21
22@bjam_signature((['type_'], ['sources', '*'], ['name', '?']))
23def set_asm_type(type_, sources, name=''):
24    project = PROJECT_REGISTRY.current()
25    _project_types[project.name() + type_] = _project_types.get(
26        project.name() + type_, type_) + '_'
27
28    name = name if name else _project_types[project.name() + type_]
29    type_ += '.asm'
30    cast(name, type_.upper(), sources, [], [], [])
31
32
33PROJECT_REGISTRY.add_rule("set-asm-type", set_asm_type)
34