Imported Upstream version 1.57.0
[platform/upstream/boost.git] / tools / build / src / tools / types / register.jam
1 # Copyright David Abrahams 2004. Distributed under the Boost
2 # Software License, Version 1.0. (See accompanying
3 # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
4
5 # This module's job is to automatically import all the type
6 # registration modules in its directory.
7 import type os path modules ;
8
9 # Register the given type on the specified OSes, or on remaining OSes
10 # if os is not specified.  This rule is injected into each of the type
11 # modules for the sake of convenience.
12 local rule type ( type : suffixes * : base-type ? : os * )
13 {
14     if ! [ type.registered $(type) ]
15     {
16         if ( ! $(os) ) || [ os.name ] in $(os)
17         {
18             type.register $(type) : $(suffixes) : $(base-type) ;
19         }
20     }
21 }
22
23 .this-module's-file = [ modules.binding $(__name__) ] ;
24 .this-module's-dir = [ path.parent $(.this-module's-file) ] ;
25 .sibling-jamfiles =  [ path.glob $(.this-module's-dir) : *.jam ] ;
26 .sibling-modules = [ MATCH ^(.*)\.jam$ : $(.sibling-jamfiles) ] ;
27
28 # A loop over all modules in this directory
29 for m in $(.sibling-modules)
30 {
31     m = [ path.basename $(m) ] ;
32     m = types/$(m) ;
33     
34     # Inject the type rule into the new module
35     IMPORT $(__name__) : type : $(m) : type ;
36     import $(m) ;
37 }
38
39