1 # Copyright 2003 Dave Abrahams
2 # Copyright 2003, 2005, 2006 Rene Rivera
3 # Copyright 2003, 2005, 2006 Vladimir Prus
4 # Distributed under the Boost Software License, Version 1.0.
5 # (See accompanying file LICENSE_1_0.txt or copy at
6 # http://www.boost.org/LICENSE_1_0.txt)
8 # First of all, check the jam version.
9 if $(JAM_VERSION:J="") < 030112
11 ECHO "error: Boost.Jam version 3.1.12 or later required" ;
15 local required-rules = GLOB-RECURSIVELY HAS_NATIVE_RULE ;
16 for local r in $(required-rules)
18 if ! $(r) in [ RULENAMES ]
20 ECHO "error: builtin rule '$(r)' is not present" ;
21 ECHO "error: your version of bjam is likely out of date" ;
22 ECHO "error: please get a fresh version from SVN." ;
27 local native = regex transform 2 ;
30 if ! [ HAS_NATIVE_RULE $(native[1]) : $(native[2]) : $(native[3]) ]
32 ECHO "error: missing native rule '$(native[1]).$(native[2])'" ;
33 ECHO "error: or interface version of that rule is too low" ;
34 ECHO "error: your version of bjam is likely out of date" ;
35 ECHO "error: please get a fresh version from SVN." ;
38 native = $(native[4-]) ;
42 # Check that the builtin .ENVIRON module is present. We do not have a builtin to
43 # check that a module is present, so we assume that the PATH environment
44 # variable is always set and verify that the .ENVIRON module has a non-empty
45 # value of that variable.
48 local p = $(PATH) $(Path) $(path) ;
51 ECHO "error: no builtin module .ENVIRON is found" ;
52 ECHO "error: your version of bjam is likely out of date" ;
53 ECHO "error: please get a fresh version from SVN." ;
58 # Check that @() functionality is present. Similarly to modules, we do not have
59 # a way to test this directly. Instead we check that $(TMPNAME) functionality is
60 # present which was added at roughly the same time (more precisely, it was added
65 ECHO "error: no @() functionality found" ;
66 ECHO "error: your version of b2 is likely out of date" ;
67 ECHO "error: please get a fresh version from SVN." ;
72 # Make sure that \n escape is avaiable.
77 ECHO "warning: escape sequences are not supported" ;
78 ECHO "warning: this will cause major misbehaviour on cygwin" ;
79 ECHO "warning: your version of b2 is likely out of date" ;
80 ECHO "warning: please get a fresh version from SVN." ;
85 # Bootstrap the module system. Then bring the import rule into the global module.
87 SEARCH on <module@>modules.jam = $(.bootstrap-file:D) ;
88 module modules { include <module@>modules.jam ; }
89 IMPORT modules : import : : import ;
92 # Add module subdirectories to the BOOST_BUILD_PATH, which allows us to make
93 # incremental refactoring steps by moving modules to appropriate
94 # subdirectories, thereby achieving some physical separation of different
95 # layers without changing all of our code to specify subdirectories in
96 # import statements or use an extra level of qualification on imported
100 kernel # only the most-intrinsic modules: modules, errors
101 util # low-level substrate: string/number handling, etc.
102 build # essential elements of the build system architecture
103 tools # toolsets for handling specific build jobs and targets.
104 contrib # user contributed (unreviewed) modules
105 . # build-system.jam lives here
107 local whereami = [ NORMALIZE_PATH $(.bootstrap-file:DT) ] ;
108 BOOST_BUILD_PATH += $(whereami:D)/$(subdirs) ;
110 modules.poke .ENVIRON : BOOST_BUILD_PATH : $(BOOST_BUILD_PATH) ;
112 modules.poke : EXTRA_PYTHONPATH : $(whereami) ;
115 # Reload the modules, to clean up things. The modules module can tolerate being
120 # Process option plugins first to allow them to prevent loading the rest of the
124 local dont-build = [ option.process ] ;
126 # Should we skip building, i.e. loading the build system, according to the
131 if ! --python in $(ARGV)
133 # Allow users to override the build system file from the command-line
134 # (mostly for testing).
135 local build-system = [ MATCH --build-system=(.*) : $(ARGV) ] ;
136 build-system ?= build-system ;
138 # Use last element in case of multiple command-line options.
139 import $(build-system[-1]) ;
144 # Define additional interface exposed to Python code. Python code will
145 # also have access to select bjam builtins in the 'bjam' module, but
146 # some things are easier to define outside C.
147 module python_interface
149 rule load ( module-name : location )
151 USER_MODULE $(module-name) ;
152 # Make all rules in the loaded module available in the global
153 # namespace, so that we do not have to bother specifying the
154 # "correct" module when calling from Python.
155 module $(module-name)
159 local rules = [ RULENAMES $(1) ] ;
160 IMPORT $(1) : $(rules) : $(1) : $(1).$(rules) ;
164 rule peek ( module-name ? : variables + )
172 rule set-variable ( module-name : name : value * )
180 rule set-top-level-targets ( targets * )
182 DEPENDS all : $(targets) ;
185 rule call-in-module ( m : rulename : * )
189 return [ $(2) $(3) : $(4) : $(5) : $(6) : $(7) : $(8) : $(9)
190 : $(10) : $(11) : $(12) : $(13) : $(14) : $(15) : $(16)
191 : $(17) : $(18) : $(19) ] ;
196 rule set-update-action ( action : targets * : sources * :
199 $(action) $(targets) : $(sources) : $(properties) ;
202 rule set-update-action-in-module ( m : action : targets * :
203 sources * : properties * )
207 $(2) $(3) : $(4) : $(5) ;
211 rule set-target-variable ( targets + : variable : value * : append ?
216 $(variable) on $(targets) += $(value) ;
220 $(variable) on $(targets) = $(value) ;
224 rule get-target-variable ( targets + : variable )
226 return [ on $(targets) return $($(variable)) ] ;
229 rule import-rules-from-parent ( parent-module : this-module :
232 IMPORT $(parent-module) : $(user-rules) : $(this-module) :
234 EXPORT $(this-module) : $(user-rules) ;
237 rule mark-included ( targets * : includes * )
240 INCLUDES $(targets) : $(includes) ;
245 PYTHON_IMPORT_RULE bootstrap : bootstrap : PyBB : bootstrap ;
246 modules.poke PyBB : root : [ NORMALIZE_PATH $(.bootstrap-file:DT)/.. ] ;
250 local ok = [ bootstrap $(root) ] ;
258 #PYTHON_IMPORT_RULE boost.build.build_system : main : PyBB : main ;