1 # Copyright 2019 Rene Rivera
2 # Copyright 2017 Steven Watanabe
3 # Copyright 2016 Vladimir Prus
4 # Copyright 2017 Edward Diener
5 # Distributed under the Boost Software License, Version 1.0.
6 # (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
16 import "class" : new ;
18 import virtual-target ;
20 path-constant SELF : . ;
27 Build the engine and its dependencies outside of the simple core build scripts.
28 This allows us to keep the core build scripts as simple as possible. And lets
29 us support more functionality for development of the engine core.
33 Define custom yyacc tool.
36 feature.feature yyacc : : dependency free ;
37 toolset.flags yyacc TOOL <yyacc> ;
40 : src/engine/yyacc.cpp
44 rule yyacc-gen ( project name : property-set : sources * )
46 local relevant = [ toolset.relevant $(__name__).yyacc ] ;
47 local a = [ new action $(sources[1]) : $(__name__).yyacc : [ $(property-set).add $(relevant) ] ] ;
49 for local n in $(name:S=).y $(name:S=)tab.h
51 targets += [ virtual-target.register
52 [ new file-target $(n) exact : [ type.type $(n) ]
59 actions yyacc bind TOOL
61 "$(TOOL)" "$(<)" "$(>)"
65 : src/engine/jamgram.yy
66 : <generating-rule>@yyacc-gen
68 <yyacc>yyacc <dependency>yyacc
73 Define grammar translation with Bison.
76 rule grammar ( target : source : properties * )
78 # LOCATE on $(target) = $(source:D) ;
79 local BISON = [ os.environ BISON ] ;
81 BISON on $(target) = $(BISON) ;
86 "$(BISON)" --yacc --defines -o "$(<[1])" "$(>)"
90 : src/engine/jamgram.y
92 : <dependency>jamgram.y
93 <location>src/engine ;
94 explicit jamgram.cpp ;
97 Generate the embedded jambase.
100 feature.feature mkjambase : : dependency free ;
101 toolset.flags mkjambase TOOL <mkjambase> ;
104 : src/engine/mkjambase.cpp
108 actions mkjambase bind TOOL
110 "$(TOOL)" "$(<)" "$(>)"
116 : <location>src/engine
117 <mkjambase>mkjambase <dependency>mkjambase ;
118 explicit jambase.cpp ;
121 Define the b2 executable. Sources are based on platform.
122 TODO: Make platform specific source be no-ops when not needed.
125 local python-exe = [ MATCH --with-python=(.*) : [ modules.peek : ARGV ] ] ;
126 local python-include ;
130 python-include = [ SHELL
131 "$(python-exe) -c \"import sysconfig; print(sysconfig.get_path('include'));\""
133 python-libdir = [ SHELL
134 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBDIR'));\""
136 python-ldlib = [ MATCH ".*(python.*)" : [ SHELL
137 "$(python-exe) -c \"import sysconfig; import os.path; print(sysconfig.get_config_var('LIBRARY'));\""
139 python-ldlib = $(python-ldlib:S=) ;
143 : <name>$(python-ldlib) <search>$(python-libdir)
145 : <include>$(python-include) <define>HAVE_PYTHON ;
153 [ glob src/engine/*.cpp src/engine/modules/*.cpp :
154 src/engine/*nt.cpp src/engine/*unix.cpp src/engine/*vms.cpp
155 src/engine/yyacc.cpp src/engine/mkjambase.cpp
157 local b2_src_nt = [ glob src/engine/*nt.cpp ] ;
158 local b2_src_unix = [ glob src/engine/*unix.cpp ] ;
159 local b2_src_vms = [ glob src/engine/*vms.cpp ] ;
160 local unix_os = [ set.difference [ feature.values <target-os> ] : windows vms ] ;
165 : <target-os>windows:<source>$(b2_src_nt)
166 <target-os>vms:<source>$(b2_src_vms)
167 <target-os>$(unix_os):<source>$(b2_src_unix)
168 <dependency>jamgram.cpp
169 <dependency>jambase.cpp
174 Installation of the engine, build, and example files.
178 if [ os.on-windows ] || [ os.on-vms ]
183 package.install boost-build-engine boost-build
186 $(SELF)/src/engine/b2$(ext)
188 explicit boost-build-engine ;
191 for local e in [ glob-tree-ex $(SELF)/example : * : . .svn ]
193 if [ CHECK_IF_FILE [ path.native $(e) ] ]
198 package.install-data boost-build-examples
199 : # Which subdir of $prefix/share
203 : # What is the root of the directory
204 <install-source-root>.
206 explicit boost-build-examples ;
208 local .core-sources =
209 $(SELF)/boost-build.jam
210 $(SELF)/src/build-system.jam
211 [ path.glob-tree $(SELF)/src/build : *.jam ]
212 [ path.glob-tree $(SELF)/src/contrib : *.jam ]
213 [ path.glob-tree $(SELF)/src/kernel : *.jam ]
214 [ path.glob-tree $(SELF)/src/options : *.jam ]
215 [ path.glob-tree $(SELF)/src/util : *.jam ]
216 [ path.glob-tree $(SELF)/src/tools : *.jam *.xml *.xsl *.doxyfile *.hpp doxproc.py ]
221 [ path.glob-tree $(SELF)/src/build : *.py ]
222 [ path.glob-tree $(SELF)/src/contrib : *.py ]
223 [ path.glob-tree $(SELF)/src/kernel : *.py ]
224 [ path.glob-tree $(SELF)/src/options : *.py ]
225 [ path.glob-tree $(SELF)/src/util : *.py ]
226 [ path.glob-tree $(SELF)/src/tools : *.py : doxproc.py ]
230 package.install-data boost-build-core
231 : # Which subdir of $prefix/share
235 : # What is the root of the directory
236 <install-source-root>.
238 explicit boost-build-core ;
241 Only install example files when requested to avoid bloating install footprint.
243 if --with-examples in [ modules.peek : ARGV ]
245 alias install : boost-build-engine boost-build-core boost-build-examples ;
249 alias install : boost-build-engine boost-build-core ;