]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/engine/build.jam
Add patch for failing prerm scripts
[ceph.git] / ceph / src / boost / tools / build / src / engine / build.jam
CommitLineData
7c673cae
FG
1#~ Copyright 2002-2007 Rene Rivera.
2#~ Distributed under the Boost Software License, Version 1.0.
3#~ (See accompanying file LICENSE_1_0.txt or copy at
4#~ http://www.boost.org/LICENSE_1_0.txt)
5
6# Clean env vars of any "extra" empty values.
7for local v in ARGV CC CFLAGS LIBS
8{
9 local values ;
10 for local x in $($(v))
11 {
12 if $(x) != ""
13 {
14 values += $(x) ;
15 }
16 }
17 $(v) = $(values) ;
18}
19
20# Platform related specifics.
21if $(OS) = NT { rule .path { return "$(<:J=\\)" ; } ./ = "/" ; }
22else { rule .path { return "$(<:J=/)" ; } }
23
24if $(OS) = VMS { . = "_" ; }
25else { . = "." ; }
26./ ?= "" ;
27
28# Info about what we are building.
29_VERSION_ = 3 1 19 ;
30NAME = boost-jam ;
31VERSION = $(_VERSION_:J=$(.)) ;
32RELEASE = 1 ;
33LICENSE = LICENSE_1_0 ;
34
35# Generate development debug binaries?
36if --debug in $(ARGV)
37{
38 debug = true ;
39}
40
41if --profile in $(ARGV)
42{
43 profile = true ;
44}
45
46# Attempt to generate and/or build the grammar?
47if --grammar in $(ARGV)
48{
49 grammar = true ;
50}
51
52# Do we need to add a default build type argument?
53if ! ( --release in $(ARGV) ) &&
54 ! ( --debug in $(ARGV) ) &&
55 ! ( --profile in $(ARGV) )
56{
57 ARGV += --release ;
58}
59
60# Enable, and configure, Python hooks.
61with-python = ;
62python-location = [ MATCH --with-python=(.*) : $(ARGV) ] ;
63if $(python-location)
64{
65 with-python = true ;
66}
67if $(with-python)
68{
69 if $(OS) = NT
70 {
71 --python-include = [ .path $(python-location) include ] ;
72 --python-lib = ;
73 for local v in 27 26 25 24 23 22
74 {
75 --python-lib ?=
76 [ GLOB [ .path $(python-location) libs ] : "python$(v).lib" ]
77 [ GLOB $(python-location) [ .path $(python-location) libs ]
78 $(Path) $(PATH) $(path) : "python$(v).dll" ]
79 ;
80 if ! $(--python-lib[2])
81 {
82 --python-lib = ;
83 }
84 }
85 --python-lib = $(--python-lib[1]) ;
86 }
87 else if $(OS) = MACOSX
88 {
89 --python-include = [ .path $(python-location) Headers ] ;
90 --python-lib = $(python-location) Python ;
91 }
92 else
93 {
94 --python-include = ;
95 --python-lib = ;
96 for local v in 2.7 2.6 2.5 2.4 2.3 2.2
97 {
98 local inc = [ GLOB [ .path $(python-location) include ] : python$(v) ] ;
99 local lib = [ GLOB [ .path $(python-location) lib ] : libpython$(v)* ] ;
100 if $(inc) && $(lib)
101 {
102 --python-include ?= $(inc) ;
103 --python-lib ?= $(lib[1]:D) python$(v) ;
104 }
105 }
106 }
107}
108
109if $(--python-include) || $(--python-lib)
110{
111 ECHO "Python includes: $(--python-include:J=)" ;
112 ECHO "Python includes: $(--python-lib:J=)" ;
113}
114
115# Boehm GC?
116if --gc in $(ARGV)
117{
118 --boehm-gc = true ;
119}
120if $(--boehm-gc)
121{
122 --extra-include += [ .path [ PWD ] "boehm_gc" "include" ] ;
123}
124
125# Duma?
126if --duma in $(ARGV)
127{
128 --duma = true ;
129}
130if $(--duma)
131{
132 --extra-include += [ .path [ PWD ] "duma" ] ;
133}
134
135# An explicit root for the toolset? (trim spaces)
136toolset-root = [ MATCH --toolset-root=(.*) : $(ARGV) ] ;
137{
138 local t = [ MATCH "[ ]*(.*)" : $(toolset-root:J=" ") ] ;
139 toolset-root = ;
140 while $(t)
141 {
142 t = [ MATCH "([^ ]+)([ ]*)(.*)" : $(t) ] ;
143 toolset-root += $(t[1]) ;
144 if $(t[3]) { toolset-root += $(t[2]) ; }
145 t = $(t[3]) ;
146 }
147 toolset-root = $(toolset-root:J="") ;
148}
149
150# Configure the implemented toolsets. These are minimal commands and options to
151# compile the full Jam. When adding new toolsets make sure to add them to the
152# "known" list also.
153
154rule toolset ( name command .type ? : opt.out + : opt.define * : flags * : linklibs * )
155{
156 .type ?= "" ;
157 tool.$(name)$(.type).cc ?= $(command) ;
158 tool.$(name)$(.type).opt.out ?= $(opt.out) ;
159 tool.$(name)$(.type).opt.define ?= $(opt.define) ;
160 tool.$(name)$(.type).flags ?= $(flags) ;
161 tool.$(name)$(.type).linklibs ?= $(linklibs) ;
162 if ! $(name) in $(toolsets) { toolsets += $(name) ; }
163}
164
165rule if-os ( os + : yes-opt * : no-opt * )
166 { if $(os) in $(OS) { return $(yes-opt) ; } else { return $(no-opt) ; } }
167
168rule opt ( type : yes-opt * : no-opt * )
169 { if $(type) in $(ARGV) { return $(yes-opt) ; } else { return $(no-opt) ; } }
170
171## HP-UX aCC compiler
172toolset acc cc : "-o " : -D
173 : -Ae
174 [ opt --release : -s -O3 ]
175 [ opt --debug : -g -pg ]
176 -I$(--python-include) -I$(--extra-include)
177 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
178## Borland C++ 5.5.x
179toolset borland bcc32 : -e -n : /D
180 : -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib"
181 [ opt --release : -O2 -vi -w-inl ]
182 [ opt --debug : -v -Od -vi- ]
183 -I$(--python-include) -I$(--extra-include)
184 : $(--python-lib[1]) ;
185## Generic Unix cc
186if ! $(CC) { CC = cc ; }
11fdf7f2 187toolset cc $(CC) : "-o " : -D
7c673cae
FG
188 : $(CFLAGS)
189 [ opt --release : -s -O ]
190 [ opt --debug : -g ]
191 -I$(--python-include) -I$(--extra-include)
192 : $(LIBS) -L$(--python-lib[1]) -l$(--python-lib[2]) ;
193## Comeau C/C++ 4.x
194toolset como como : "-o " : -D
195 : --c
196 [ opt --release : --inlining ]
197 [ opt --debug : --no_inlining ]
198 -I$(--python-include) -I$(--extra-include)
199 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
200## Clang Linux 2.8+
201toolset clang clang : "-o " : -D
202 : -Wno-unused -Wno-format
203 [ opt --release : -Os ]
204 [ opt --debug : -g -O0 -fno-inline ]
205 [ opt --profile : -finline-functions -g ]
206 -I$(--python-include) -I$(--extra-include)
207 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
208## MacOSX Darwin, using GCC 2.9.x, 3.x
209toolset darwin cc : "-o " : -D
210 :
211 [ opt --release : -Wl,-x -O3 -finline-functions ]
212 [ opt --debug : -g -O0 -fno-inline -pg ]
213 [ opt --profile : -Wl,-x -O3 -finline-functions -g -pg ]
214 -I$(--python-include) -I$(--extra-include)
215 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
216## GCC 2.x, 3.x, 4.x
217toolset gcc gcc : "-o " : -D
218 : -pedantic -fno-strict-aliasing
219 [ opt --release : [ opt --symbols : -g : -s ] -O3 ]
220 [ opt --debug : -g -O0 -fno-inline ]
221 [ opt --profile : -O3 -g -pg ]
222 -I$(--python-include) -I$(--extra-include) -Wno-long-long
223 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
224## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll
225toolset gcc-nocygwin gcc : "-o " : -D
226 : -s -O3 -mno-cygwin
227 [ opt --release : -finline-functions ]
228 [ opt --debug : -s -O3 -fno-inline -pg ]
229 -I$(--python-include) -I$(--extra-include)
230 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
231## Intel C/C++ for Darwin
232toolset intel-darwin icc : "-o " : -D
233 :
234 [ opt --release : -O3 ]
235 [ opt --debug : -g -O0 -p ]
236 -I$(--python-include) -I$(--extra-include)
237 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
238## Intel C/C++ for Linux
239toolset intel-linux icc : "-o " : -D
240 :
241 [ opt --release : -Xlinker -s -O3 ]
242 [ opt --debug : -g -O0 -p ]
243 -I$(--python-include) -I$(--extra-include)
244 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
245## Intel C/C++ for Win32
246toolset intel-win32 icl : /Fe : -D
247 : /nologo
248 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /GB ]
249 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 ]
250 -I$(--python-include) -I$(--extra-include)
251 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
252## KCC ?
253toolset kcc KCC : "-o " : -D
254 :
255 [ opt --release : -s +K2 ]
256 [ opt --debug : -g +K0 ]
257 -I$(--python-include) -I$(--extra-include)
258 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
259## Borland Kylix
260toolset kylix bc++ : -o : -D
261 : -tC -q
262 [ opt --release : -O2 -vi -w-inl ]
263 [ opt --debug : -v -Od -vi- ]
264 -I$(--python-include) -I$(--extra-include)
265 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
266## Metrowerks CodeWarrior 8.x
267{
268 # Even though CW can compile all files at once, it crashes if it tries in
269 # the bjam case.
270 local mwcc ; if $(OS) != NT { mwcc = mwc$(OSPLAT:L) ; }
271 mwcc ?= mwcc ;
272 toolset metrowerks $(mwcc) : "-o " : -D
273 : -c -lang c -subsystem console -cwd include
274 [ opt --release : -runtime ss -opt full -inline all ]
275 [ opt --debug : -runtime ssd -opt none -inline off ]
276 -I$(--python-include) -I$(--extra-include) ;
277 toolset metrowerks $(mwcc) .link : "-o " :
278 : -subsystem console -lkernel32.lib -ladvapi32.lib -luser32.lib
279 [ opt --release : -runtime ss ]
280 [ opt --debug : -runtime ssd ]
281 : $(--python-lib[1]) ;
282}
283## MIPS Pro
284toolset mipspro cc : "-o " : -D
285 :
11fdf7f2 286 [ opt --release : -s -O3 -g0 "-INLINE:none" ]
7c673cae
FG
287 [ opt --debug : -g -O0 -INLINE ]
288 -I$(--python-include) -I$(--extra-include)
289 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
290## Microsoft Visual Studio C++ 6.x
291toolset msvc cl : /Fe /Fe /Fd /Fo : -D
292 : /nologo
293 [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
294 [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ]
295 -I$(--python-include) -I$(--extra-include)
296 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
297## QNX 6.x GCC 3.x/2.95.3
298toolset qcc qcc : "-o " : -D
299 : -Wc,-pedantic -Wc,-fno-strict-aliasing
300 [ opt --release : [ opt --symbols : -g ] -O3 -Wc,-finline-functions ]
301 [ opt --debug : -g -O0 -Wc,-fno-inline ]
302 -I$(--python-include) -I$(--extra-include)
303 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
304## Qlogic Pathscale 2.4
305toolset pathscale pathcc : "-o " : -D
306 :
307 [ opt --release : -s -O3 ]
308 [ opt --debug : -g ]
309 -I$(--python-include) -I$(--extra-include)
310 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
311## Portland Group Pgi 6.2
312toolset pgi pgcc : "-o " : -D
313 :
314 [ opt --release : -s -O3 ]
315 [ opt --debug : -g ]
316 -I$(--python-include) -I$(--extra-include)
317 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
318## Sun Workshop 6 C++
319toolset sun cc : "-o " : -D
320 :
321 [ opt --release : -s -xO3 ]
322 [ opt --debug : -g ]
323 -I$(--python-include) -I$(--extra-include)
324 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
325## Sun Workshop 6 C++ (old alias)
326toolset sunpro cc : "-o " : -D
327 :
328 [ opt --release : -s -xO3 ]
329 [ opt --debug : -g ]
330 -I$(--python-include) -I$(--extra-include)
331 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
332## Compaq Alpha CXX
333toolset tru64cxx cc : "-o " : -D
334 :
335 [ opt --release : -s -O5 -inline speed ]
336 [ opt --debug : -g -O0 -pg ]
337 -I$(--python-include) -I$(--extra-include)
338 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
339## IBM VisualAge C++ or IBM XL C/C++ for Aix or IBM XL C/C++ for Linux (Big endian)
340toolset vacpp xlc : "-o " : -D
341 :
342 [ opt --release : -s -O3 -qstrict -qinline ]
343 [ opt --debug : -g -qNOOPTimize -qnoinline -pg ]
344 -I$(--python-include) -I$(--extra-include)
11fdf7f2
TL
345 : -L$(--python-lib[1]) -l$(--python-lib[2]) [ if-os AIX : "-bmaxdata:0x40000000" ] ;
346
7c673cae
FG
347## IBM XL C/C++ for Linux (little endian)
348toolset xlcpp xlC : "-o " : -D
349 : -Wno-unused -Wno-format
350 [ opt --release : -s ]
351 [ opt --debug : -g -qNOOPTimize -qnoinline -pg ]
352 -I$(--python-include) -I$(--extra-include)
11fdf7f2
TL
353 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
354
7c673cae
FG
355## Microsoft Visual C++ .NET 7.x
356toolset vc7 cl : /Fe /Fe /Fd /Fo : -D
357 : /nologo
358 [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
359 [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ]
b32b8144 360 -I$(--python-include) -I$(--extra-include) -D_WIN32_WINNT=0x0501
7c673cae
FG
361 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
362## Microsoft Visual C++ 2005
363toolset vc8 cl : /Fe /Fe /Fd /Fo : -D
364 : /nologo
365 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
366 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
367 -I$(--python-include) -I$(--extra-include)
368 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
369## Microsoft Visual C++ 2008
370toolset vc9 cl : /Fe /Fe /Fd /Fo : -D
371 : /nologo
372 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
373 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
374 -I$(--python-include) -I$(--extra-include)
375 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
376## Microsoft Visual C++ 2010
377toolset vc10 cl : /Fe /Fe /Fd /Fo : -D
378 : /nologo
379 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
380 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
381 -I$(--python-include) -I$(--extra-include)
382 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
383## Microsoft Visual C++ 2012
384toolset vc11 cl : /Fe /Fe /Fd /Fo : -D
385 : /nologo
386 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
387 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
388 -I$(--python-include) -I$(--extra-include)
389 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
390## Microsoft Visual C++ 2013
391toolset vc12 cl : /Fe /Fe /Fd /Fo : -D
392 : /nologo
393 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
394 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
395 -I$(--python-include) -I$(--extra-include)
396 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
397## Microsoft Visual C++ 2015
398toolset vc14 cl : /Fe /Fe /Fd /Fo : -D
399 : /nologo
400 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
401 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
402 -I$(--python-include) -I$(--extra-include)
403 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
b32b8144
FG
404## Microsoft Visual C++ 2017
405toolset vc141 cl : /Fe /Fe /Fd /Fo : -D
7c673cae
FG
406 : /nologo
407 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
408 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
409 -I$(--python-include) -I$(--extra-include)
410 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
411## VMS/OpenVMS DEC C
412toolset vmsdecc cc : /OBJECT= : "/DEFINES=(" "," ")"
413 : /STANDARD=VAXC /PREFIX_LIBRARY_ENTRIES=(ALL_ENTRIES)
414 [ opt --release : /OPTIMIZE /NODEBUG /WARN=DISABLE=(LONGEXTERN) ]
415 [ opt --debug : /NOOPTIMIZE /DEBUG ] ;
416toolset vmsdecc LINK .link : /EXECUTABLE= :
417 : /NOMAP
418 [ opt --release : /NODEBUG ]
419 [ opt --debug : /DEBUG ] ;
420
421# First set the build commands and options according to the
422# preset toolset.
423toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
424if ! $(toolset)
425{
426 # For some reason, the following test does not catch empty toolset.
427 ECHO "###" ;
428 ECHO "###" No toolset specified. Please use --toolset option. ;
429 ECHO "###" ;
11fdf7f2 430 ECHO "###" Known toolsets "are:" $(toolsets:J=", ") ;
7c673cae
FG
431 EXIT "###" ;
432}
433if ! $(toolset) in $(toolsets)
434{
435 ECHO "###" ;
11fdf7f2 436 ECHO "###" Unknown "toolset:" $(toolset) ;
7c673cae 437 ECHO "###" ;
11fdf7f2 438 ECHO "###" Known toolsets "are:" $(toolsets:J=", ") ;
7c673cae
FG
439 EXIT "###" ;
440}
441--cc = $(tool.$(toolset).cc) ;
442if $(tool.$(toolset).opt.out[2])
443{
444 if $(tool.$(toolset).opt.out[1]) = $(tool.$(toolset).opt.out[2])
445 {
446 --out = $(tool.$(toolset).opt.out[1]) ;
447 --dir = $(tool.$(toolset).opt.out[3-]) ;
448 }
449 else
450 {
451 --bin = $(tool.$(toolset).opt.out[1]) ;
452 --dir = $(tool.$(toolset).opt.out[2-]) ;
453 }
454}
455else
456{
457 --out = $(tool.$(toolset).opt.out) ;
458}
459--def = $(tool.$(toolset).opt.define) ;
460--flags = $(tool.$(toolset).flags) ;
461--defs = $(tool.$(toolset).defines) ;
462--libs = $(tool.$(toolset).linklibs) ;
463if $(tool.$(toolset).link.cc)
464{
465 --link = $(tool.$(toolset).link.cc) ;
466 if $(tool.$(toolset).link.opt.out[2])
467 {
468 if $(tool.$(toolset).link.opt.out[1]) = $(tool.$(toolset).link.opt.out[2])
469 {
470 --link-out = $(tool.$(toolset).link.opt.out[1]) ;
471 --link-dir = $(tool.$(toolset).link.opt.out[3-]) ;
472 }
473 else
474 {
475 --link-bin = $(tool.$(toolset).link.opt.out[1]) ;
476 --link-dir = $(tool.$(toolset).link.opt.out[2-]) ;
477 }
478 }
479 else
480 {
481 --link-out = $(tool.$(toolset).link.opt.out) ;
482 }
483 --link-def = $(tool.$(toolset).link.opt.define) ;
484 --link-flags = $(tool.$(toolset).link.flags) ;
485 --link-defs = $(tool.$(toolset).link.defines) ;
486 --link-libs = $(tool.$(toolset).link.linklibs) ;
487}
488
489# Put executables in platform-specific subdirectory.
490locate-target = $(LOCATE_TARGET) ;
491if $(OSPLAT)
492{
493 locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
494 platform = $(OS:L)$(OSPLAT:L) ;
495}
496else
497{
498 locate-target ?= bin$(.)$(OS:L) ;
499 platform = $(OS:L) ;
500}
501if $(debug)
502{
503 locate-target = [ .path $(locate-target)$(.)debug ] ;
504}
505if $(profile)
506{
507 locate-target = [ .path $(locate-target)$(.)profile ] ;
508}
509else
510{
511 locate-target = [ .path $(locate-target) ] ;
512}
513
514if --show-locate-target in $(ARGV)
515{
516 ECHO $(locate-target) ;
517}
518
519# We have some different files for UNIX, VMS, and NT.
520jam.source =
b32b8144 521 command.c compile.c constants.c debug.c debugger.c execcmd.c frames.c function.c glob.c
7c673cae
FG
522 hash.c hcache.c headers.c hdrmacro.c jam.c jambase.c jamgram.c lists.c
523 make.c make1.c mem.c object.c option.c output.c parse.c pathsys.c regexp.c
524 rules.c scan.c search.c subst.c w32_getreg.c timestamp.c variable.c
525 modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c
526 [ .path modules set.c ] [ .path modules path.c ] [ .path modules regex.c ]
527 [ .path modules property-set.c ] [ .path modules sequence.c ] [ .path modules order.c ] ;
528if $(OS) = NT
529{
530 jam.source += execnt.c filent.c pathnt.c ;
531}
532else if $(OS) = VMS
533{
534 jam.source += execvms.c filevms.c pathvms.c ;
535 --flags += /INCLUDE=(\""./modules"\") ;
536}
537else
538{
539 jam.source += execunix.c fileunix.c pathunix.c ;
540}
541
542# Debug assertions, or not.
543if ! $(debug) || --noassert in $(ARGV)
544{
545 --defs += NDEBUG ;
546}
547
548# Enable some optional features.
549--defs += OPT_HEADER_CACHE_EXT ;
550--defs += OPT_GRAPH_DEBUG_EXT ;
551--defs += OPT_SEMAPHORE ;
552--defs += OPT_AT_FILES ;
553--defs += OPT_DEBUG_PROFILE ;
b32b8144 554--defs += JAM_DEBUGGER ;
7c673cae
FG
555
556# Bug fixes
557--defs += OPT_FIX_TARGET_VARIABLES_EXT ;
558#~ --defs += OPT_NO_EXTERNAL_VARIABLE_SPLIT ;
559
560# Improvements
561--defs += OPT_IMPROVED_PATIENCE_EXT ;
562
563# Use Boehm GC memory allocator?
564if $(--boehm-gc)
565{
566 --defs += OPT_BOEHM_GC ;
567 if $(debug)
568 {
569 --defs += GC_DEBUG ;
570 }
571}
572
573if $(--duma)
574{
575 --defs += OPT_DUMA ;
576}
577
578if ( $(OS) = NT ) && ! NT in $(--defs)
579{
580 --defs += NT ;
581}
582if $(OS) = VMS
583{
584 --defs += VMS ;
585}
586--defs += YYSTACKSIZE=5000 ;
587
588if $(with-python)
589{
590 --defs += HAVE_PYTHON ;
591}
592
593if $(debug)
594{
595 --defs += BJAM_NEWSTR_NO_ALLOCATE ;
596}
597
598
599# The basic symbolic targets...
600NOTFILE all clean dist ;
601ALWAYS clean ;
602
603# Utility rules and actions...
604rule .clean
605{
11fdf7f2 606 "[DELETE]" clean : $(<) ;
7c673cae 607}
11fdf7f2 608if $(OS) = NT { actions piecemeal together existing "[DELETE]" {
7c673cae
FG
609 del /F /Q "$(>)"
610} }
11fdf7f2 611if $(UNIX) = true { actions piecemeal together existing "[DELETE]" {
7c673cae
FG
612 rm -f "$(>)"
613} }
11fdf7f2 614if $(OS) = VMS { actions piecemeal together existing "[DELETE]" {
7c673cae
FG
615 DELETE /NOCONF $(>:WJ=;*, );*
616} }
617if $(OS) = NT {
618 --chmod+w = "attrib -r " ;
619}
620if $(UNIX) = true {
621 --chmod+w = "chmod +w " ;
622}
623if $(OS) = VMS {
624 --chmod+w = "SET FILE/PROT=(W:RWED) " ;
625}
626
627rule .mkdir
628{
629 NOUPDATE $(<) ;
630 if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
11fdf7f2 631 if ! $(md<$(<)>) { "[MKDIR]" $(<) ; md<$(<)> = - ; }
7c673cae 632}
11fdf7f2 633if $(OS) = NT { actions "[MKDIR]" {
7c673cae
FG
634 md "$(<)"
635} }
11fdf7f2 636if $(UNIX) = true { actions "[MKDIR]" {
7c673cae
FG
637 mkdir "$(<)"
638} }
11fdf7f2 639if $(OS) = VMS { actions "[MKDIR]" {
7c673cae
FG
640 CREATE/DIR $(<:WJ=, )
641} }
642
643rule .exe
644{
645 local exe = $(<) ;
646 if $(OS) = NT || ( $(UNIX) = true && $(OS) = CYGWIN ) || $(OS) = VMS { exe = $(exe:S=.exe) ; }
647 LOCATE on $(exe) = $(locate-target) ;
648 DEPENDS all : $(exe) ;
649 .mkdir $(locate-target) ;
650 if $(--link)
651 {
652 local objs ;
653 for local s in $(>)
654 {
655 # Translate any subdir elements into a simple file name.
656 local o = [ MATCH "([^/]+)[/]?(.+)" : $(s) ] ;
657
658 o = $(o:J=_) ;
659 o = $(o:S=.o) ;
660 if $(OS) = VMS { o = $(o:S=.obj) ; }
661 objs += $(o) ;
662 LOCATE on $(o) = $(locate-target) ;
663 DEPENDS $(exe) : $(o) ;
664 DEPENDS $(o) : $(s) ;
665 DEPENDS $(o) : $(locate-target) ;
11fdf7f2 666 "[COMPILE]" $(o) : $(s) ;
7c673cae
FG
667 .clean $(o) ;
668 }
669 DEPENDS $(exe) : $(objs) ;
670 DEPENDS $(exe) : $(locate-target) ;
11fdf7f2 671 "[COMPILE.LINK]" $(exe) : $(objs) ;
7c673cae
FG
672 .clean $(exe) ;
673 }
674 else
675 {
676 DEPENDS $(exe) : $(>) ;
677 DEPENDS $(exe) : $(locate-target) ;
11fdf7f2 678 "[COMPILE]" $(exe) : $(>) ;
7c673cae
FG
679 .clean $(exe) ;
680 }
681 return $(exe) ;
682}
683
11fdf7f2 684if $(OS) = VMS { actions "[COMPILE]" {
7c673cae
FG
685 $(--cc) $(--bin)$(<:WD=) $(--dir)$(<:D)$(./) $(--out)$(<:W) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) $(>:W) $(--libs)
686} }
11fdf7f2 687else if ! $(--def[2]) { actions "[COMPILE]" {
7c673cae
FG
688 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def)$(--defs)" "$(--flags)" "$(>)" "$(--libs)"
689} }
11fdf7f2 690else { actions "[COMPILE]" {
7c673cae
FG
691 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def[1])$(--defs:J=$(--def[2]))$(--def[3])" "$(--flags)" "$(>)" "$(--libs)"
692} }
693
11fdf7f2 694if $(OS) = VMS { actions "[COMPILE.LINK]" {
7c673cae
FG
695 $(--link) $(--link-bin)$(<:WD=) $(--link-dir)$(<:WD)$(./) $(--link-out)$(<:W) $(--link-def)$(--link-defs) $(--link-flags) $(--link-libs) $(>:WJ=, )
696} }
11fdf7f2 697else { actions "[COMPILE.LINK]" {
7c673cae
FG
698 "$(--link)" "$(--link-bin)$(<:D=)" "$(--link-dir)$(<:D)$(./)" "$(--link-out)$(<)" "$(--link-def)$(--link-defs)" "$(--link-flags)" "$(>)" "$(--link-libs)"
699} }
700
701rule .link
702{
703 DEPENDS all : $(<) ;
704 DEPENDS $(<) : $(>) ;
11fdf7f2 705 "[LINK]" $(<) : $(>) ;
7c673cae
FG
706 .clean $(<) ;
707}
11fdf7f2 708if $(OS) = NT { actions "[LINK]" {
7c673cae
FG
709 copy "$(>)" "$(<)"
710} }
11fdf7f2 711if $(UNIX) = true { actions "[LINK]" {
7c673cae
FG
712 ln -fs "$(>)" "$(<)"
713} }
11fdf7f2 714if $(OS) = VMS { actions "[LINK]" {
7c673cae
FG
715 COPY/REPLACE $(>:W) $(<:W)
716} }
717
718rule .copy
719{
720 DEPENDS all : $(<) ;
721 DEPENDS $(<) : $(>) ;
11fdf7f2 722 "[COPY]" $(<) : $(>) ;
7c673cae
FG
723 .clean $(<) ;
724}
725
726# Will be redefined later.
11fdf7f2 727if $(OS) = VMS { actions "[COPY]" {
7c673cae
FG
728 COPY/REPLACE $(>:W) $(<:W)
729} }
11fdf7f2 730else { actions "[COPY]" {
7c673cae
FG
731} }
732
733
734rule .move
735{
736 DEPENDS $(<) : $(>) ;
11fdf7f2 737 "[MOVE]" $(<) : $(>) ;
7c673cae 738}
11fdf7f2 739if $(OS) = NT { actions "[MOVE]" {
7c673cae
FG
740 del /f "$(<)"
741 rename "$(>)" "$(<)"
742} }
11fdf7f2 743if $(UNIX) = true { actions "[MOVE]" {
7c673cae
FG
744 mv -f "$(>)" "$(<)"
745} }
11fdf7f2 746if $(OS) = VMS { actions "[MOVE]" {
7c673cae
FG
747 RENAME /NOCONF $(>:W) $(<:W)
748} }
749
750# Generate the grammar tokens table, and the real yacc grammar.
751rule .yyacc
752{
753 local exe = [ .exe yyacc : yyacc.c ] ;
754 NOUPDATE $(exe) ;
755 DEPENDS $(<) : $(exe) $(>) ;
756 LEAVES $(<) ;
757 yyacc.exe on $(<) = $(exe:R=$(locate-target)) ;
11fdf7f2 758 "[YYACC]" $(<) : $(>) ;
7c673cae 759}
11fdf7f2 760actions "[YYACC]" {
7c673cae
FG
761 $(--chmod+w)$(<[1])
762 $(--chmod+w)$(<[2])
763 "$(yyacc.exe)" "$(<)" "$(>)"
764}
765if $(grammar)
766{
767 .yyacc jamgram.y jamgramtab.h : jamgram.yy ;
768}
769else if $(debug)
770{
771 .exe yyacc : yyacc.c ;
772}
773
774# How to build the grammar.
775if $(OS) = NT
776{
777 SUFEXE = .exe ;
778 # try some other likely spellings...
779 PATH ?= $(Path) ;
780 PATH ?= $(path) ;
781}
782SUFEXE ?= "" ;
783
784yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ;
785yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ;
786yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin"
787 "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ;
788yacc = $(yacc[1]) ;
789switch $(yacc:D=:S=)
790{
791 case bison : yacc += -d --yacc ;
792 case yacc : yacc += -d ;
793}
794if $(debug) && $(yacc)
795{
796 yacc += -t -v ;
797}
798yacc += $(YACCFLAGS) ;
799
800rule .yacc
801{
802 DEPENDS $(<) : $(>) ;
803 LEAVES $(<) ;
11fdf7f2 804 "[YACC]" $(<) : $(>) ;
7c673cae 805}
11fdf7f2 806if $(OS) = NT { actions "[YACC]" {
7c673cae
FG
807 "$(yacc)" "$(>)"
808 if not errorlevel 1 (
809 del /f "$(<[1])"
810 rename y.tab$(<[1]:S) "$(<[1])"
811 del /f $(<[2])
812 rename y.tab$(<[2]:S) "$(<[2])"
813 ) else set _error_ =
814} }
11fdf7f2 815if $(UNIX) = true { actions "[YACC]" {
7c673cae
FG
816 if ` "$(yacc)" "$(>)" ` ; then
817 mv -f y.tab$(<[1]:S) "$(<[1])"
818 mv -f y.tab$(<[2]:S) "$(<[2])"
819 else
820 exit 1
821 fi
822} }
11fdf7f2 823if $(OS) = VMS { actions "[YACC]" {
7c673cae
FG
824 IF $(yacc) $(>)
825 THEN
826 RENAME /NOCONF y_tab$(<[1]:S) $(<[1]:W)
827 RENAME /NOCONF y_tab$(<[2]:S) $(<[2]:W)
828 ENDIF
829} }
830if $(grammar) && ! $(yacc)
831{
832 EXIT Could not find the 'yacc' tool, and therefore can not build the
833 grammar. ;
834}
835if $(grammar) && $(yacc)
836{
837 .yacc jamgram.c jamgram.h : jamgram.y ;
838}
839
840# How to build the compiled in jambase.
841rule .mkjambase
842{
843 local exe = [ .exe mkjambase : mkjambase.c ] ;
844 DEPENDS $(<) : $(exe) $(>) ;
845 LEAVES $(<) ;
846 mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
11fdf7f2 847 "[MKJAMBASE]" $(<) : $(>) ;
7c673cae 848}
11fdf7f2 849actions "[MKJAMBASE]" {
7c673cae
FG
850 $(--chmod+w)$(<)
851 $(mkjambase.exe) "$(<)" "$(>)"
852}
853if $(debug)
854{
855 .mkjambase jambase.c : Jambase ;
856}
857
858# How to build Jam.
859rule .jam
860{
861 $(>).exe = [ .exe $(>) : $(jam.source) ] ;
862 DEPENDS all : $($(>).exe) ;
863
864 # Make a copy under the old name.
865 $(<).exe = $(<:S=$($(>).exe:S)) ;
866 LOCATE on $($(<).exe) = $(locate-target) ;
867 .copy $($(<).exe) : $($(>).exe) ;
868 DEPENDS all : $($(<).exe) ;
869}
870.jam bjam : b2 ;
871
872
873# Scan sources for header dependencies.
874#
875# In order to keep things simple, we made a slight compromise here - we only
876# detect changes in headers included relative to the current folder as opposed
877# to those included from somewhere on the include path.
878rule .scan ( targets + )
879{
880 HDRRULE on $(targets) = .hdr.scan ;
881 HDRSCAN on $(targets) = "^[ \t]*#[ \t]*include[ \t]*\"([^\"]*)\".*$" ;
882}
883rule .hdr.scan ( target : includes * : binding )
884{
885 local target-path = [ NORMALIZE_PATH $(binding:D) ] ;
886 # Extra grist provides target name uniqueness when referencing same name
887 # header files from different folders.
888 local include-targets = <$(target-path)>$(includes) ;
889 NOCARE $(include-targets) ;
890 INCLUDES $(target) : $(include-targets) ;
891 SEARCH on $(include-targets) = $(target-path) ;
892 ISFILE $(include-targets) ;
893 .scan $(include-targets) ;
894}
895.scan $(jam.source) ;
896
897
898# Distribution making from here on out. Assumes that the docs are already built
899# as HTML at ../doc/html. Otherwise they will not be included in the built
900# distribution archive.
901dist.license =
902 [ GLOB . : $(LICENSE).txt ]
903 ;
904dist.license = $(dist.license:D=)
905 [ GLOB [ .path .. .. .. ] : $(LICENSE).txt ]
906 [ GLOB [ .path .. boost ] : $(LICENSE).txt ] ;
907dist.docs =
908 [ GLOB . : *.png *.css *.html ]
909 ;
910dist.docs = $(dist.docs:D=)
911 [ GLOB [ .path images ] : *.png ]
912 [ GLOB [ .path jam ] : *.html ]
913 ;
914dist.source =
915 [ GLOB . : *.c *.h ]
916 ;
917dist.source = $(dist.source:D=)
918 $(dist.license[1])
919 $(dist.docs)
920 build.jam build.bat build.sh build_vms.com
921 Jambase
922 jamgram.y jamgram.yy
923 [ .path modules set.c ]
924 [ .path modules path.c ]
925 [ .path modules regex.c ]
926 [ .path modules property-set.c ]
927 [ .path modules sequence.c ]
928 [ .path modules order.c ]
929 [ GLOB [ .path boehm_gc ] : * ]
930 [ GLOB [ .path boehm_gc include ] : * ]
931 [ GLOB [ .path boehm_gc include private ] : * ]
932 [ GLOB [ .path boehm_gc cord ] : * ]
933 [ GLOB [ .path boehm_gc Mac_files ] : * ]
934 [ GLOB [ .path boehm_gc tests ] : * ]
935 [ GLOB [ .path boehm_gc doc ] : * ]
936 ;
937dist.bin =
938 bjam
939 ;
940dist.bin =
941 $(dist.license[1])
942 $(dist.bin:S=$(bjam.exe:S))
943 ;
944
945if $(OS) = NT
946{
947 zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7z.exe" ] ;
948 zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7zn.exe" ] ;
949 zip ?= [ GLOB $(PATH) : zip.exe ] ;
950 zip ?= zip ;
951 zip = $(zip[1]) ;
952 switch $(zip:D=:S=)
953 {
954 case 7z* : zip += a -r -tzip -mx=9 ;
955 case zip : zip += -9r ;
956 }
11fdf7f2 957 actions piecemeal "[PACK]" {
7c673cae
FG
958 "$(zip)" "$(<)" "$(>)"
959 }
11fdf7f2 960 actions piecemeal "[ZIP]" {
7c673cae
FG
961 "$(zip)" "$(<)" "$(>)"
962 }
11fdf7f2 963 actions piecemeal "[COPY]" {
7c673cae
FG
964 copy /Y "$(>)" "$(<)" >NUL:
965 }
966}
967if $(UNIX) = true
968{
969 tar ?= [ GLOB $(PATH) : star bsdtar tar ] ;
970 tar = $(tar[1]) ;
971 switch $(tar:D=:S=)
972 {
973 case star : tar += -c artype=pax -D -d -to-stdout ;
974 case * : tar += -c -f - ;
975 }
11fdf7f2 976 actions "[PACK]" {
7c673cae
FG
977 "$(tar)" "$(>)" | gzip -c9 > "$(<)"
978 }
11fdf7f2 979 #~ actions "[PACK]" {
7c673cae
FG
980 #~ tar cf "$(<:S=.tar)" "$(>)"
981 #~ }
11fdf7f2 982 actions "[ZIP]" {
7c673cae
FG
983 gzip -c9 "$(>)" > "$(<)"
984 }
11fdf7f2 985 actions "[COPY]" {
7c673cae
FG
986 cp -Rpf "$(>)" "$(<)"
987 }
988}
989
990# The single binary, compressed.
991rule .binary
992{
993 local zip ;
994 if $(OS) = NT { zip = $($(<).exe:S=.zip) ; }
995 if $(UNIX) = true { zip = $($(<).exe:S=.tgz) ; }
996 zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ;
997 DEPENDS $(zip) : $($(<).exe) ;
998 DEPENDS dist : $(zip) ;
999 #~ LOCATE on $(zip) = $(locate-target) ;
11fdf7f2
TL
1000 if $(OS) = NT { "[ZIP]" $(zip) : $($(<).exe) ; }
1001 if $(UNIX) = true { "[PACK]" $(zip) : $($(<).exe) ; }
7c673cae
FG
1002 .clean $(zip) ;
1003}
1004
1005# Package some file.
1006rule .package ( dst-dir : src-files + )
1007{
1008 local dst-files ;
1009 local src-files-actual ;
1010 for local src-path in $(src-files)
1011 {
1012 if ! [ GLOB $(src-path:P) : $(src-path:B) ] || [ CHECK_IF_FILE $(src-path) ]
1013 {
1014 local src-subdir = $(src-path:D) ;
1015 local src-file = $(src-path) ;
1016 while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; }
1017 if $(src-subdir) = ".."
1018 {
1019 src-file = $(src-file:D=) ;
1020 }
1021 dst-files += $(src-file:R=$(dst-dir)) ;
1022 src-files-actual += $(src-path) ;
1023 }
1024 }
1025
1026 local pack ;
1027 if $(OS) = NT { pack = $(dst-dir).zip ; }
1028 if $(UNIX) = true { pack = $(dst-dir).tgz ; }
1029
1030 DEPENDS dist : $(pack) ;
1031 DEPENDS $(pack) : $(dst-files) ;
1032
1033 local dst-files-queue = $(dst-files) ;
1034 for local src-path in $(src-files-actual)
1035 {
1036 local dst-file = $(dst-files-queue[1]) ;
1037 dst-files-queue = $(dst-files-queue[2-]) ;
1038 DEPENDS $(dst-file) : $(src-path) $(dst-file:D) ;
1039 .mkdir $(dst-file:D) ;
1040
11fdf7f2 1041 "[COPY]" $(dst-file) : $(src-path) ;
7c673cae
FG
1042 .clean $(dst-file) ;
1043 }
1044
11fdf7f2 1045 "[PACK]" $(pack) : $(dst-files) ;
7c673cae
FG
1046 .clean $(pack) ;
1047}
1048
1049# RPM distro file.
1050rpm-tool = [ GLOB $(PATH) : "rpmbuild" ] ;
1051rpm-tool ?= [ GLOB $(PATH) : "rpm" ] ;
1052rpm-tool = $(rpm-tool[1]) ;
1053rule .rpm ( name : source )
1054{
1055 local rpm-arch ;
1056 switch $(OSPLAT)
1057 {
1058 case X86 : rpm-arch ?= i386 ;
1059 case PPC : rpm-arch ?= ppc ;
1060 case AXP : rpm-arch ?= alpha ;
1061 # no guaranty for these:
1062 case IA64 : rpm-arch ?= ia64 ;
1063 case ARM : rpm-arch ?= arm ;
1064 case SPARC : rpm-arch ?= sparc ;
1065 case * : rpm-arch ?= other ;
1066 }
1067 local target = $(name)-rpm ;
1068 NOTFILE $(target) ;
1069 DEPENDS dist : $(target) ;
1070 DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ;
1071 DEPENDS $(name).$(rpm-arch).rpm : $(source) ;
1072 DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ;
1073 docs on $(target) = $(dist.docs:J=" ") ;
1074 arch on $(target) = $(rpm-arch) ;
1075 if $(rpm-arch) = ppc { target-opt on $(target) = --target= ; }
1076 else { target-opt on $(target) = "--target " ; }
11fdf7f2 1077 "[RPM]" $(target) : $(source) ;
7c673cae
FG
1078 .clean $(name).$(rpm-arch).rpm $(name).src.rpm ;
1079}
11fdf7f2 1080actions "[RPM]" {
7c673cae
FG
1081 set -e
1082 export BOOST_JAM_TOOLSET="$(toolset)"
1083 $(rpm-tool) -ta $(target-opt)$(arch) $(>) | tee rpm.out
1084 cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` .
1085 rm -f rpm.out
1086}
1087
1088# The distribution targets. Do not bother with them unless this is a
1089# distribution build.
1090if dist in $(ARGV)
1091{
1092 #~ .binary bjam ;
1093 .package $(NAME)-$(VERSION) : $(dist.source) ;
1094 .package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ;
1095 if $(rpm-tool)
1096 {
1097 #~ .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ;
1098 }
1099}