]> git.proxmox.com Git - ceph.git/blame - ceph/src/boost/tools/build/src/engine/build.jam
add subtree-ish sources for 12.0.3
[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 ; }
187toolset cc $(CC) : "-o " : -D
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 :
286 [ opt --release : -s -O3 -g0 -INLINE:none ]
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)
345 : -L$(--python-lib[1]) -l$(--python-lib[2]) [ if-os AIX : -bmaxdata:0x40000000 ] ;
346
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)
353 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
354
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 ]
360 -I$(--python-include) -I$(--extra-include)
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]) ;
404toolset vc15 cl : /Fe /Fe /Fd /Fo : -D
405 : /nologo
406 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
407 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
408 -I$(--python-include) -I$(--extra-include)
409 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
410## VMS/OpenVMS DEC C
411toolset vmsdecc cc : /OBJECT= : "/DEFINES=(" "," ")"
412 : /STANDARD=VAXC /PREFIX_LIBRARY_ENTRIES=(ALL_ENTRIES)
413 [ opt --release : /OPTIMIZE /NODEBUG /WARN=DISABLE=(LONGEXTERN) ]
414 [ opt --debug : /NOOPTIMIZE /DEBUG ] ;
415toolset vmsdecc LINK .link : /EXECUTABLE= :
416 : /NOMAP
417 [ opt --release : /NODEBUG ]
418 [ opt --debug : /DEBUG ] ;
419
420# First set the build commands and options according to the
421# preset toolset.
422toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
423if ! $(toolset)
424{
425 # For some reason, the following test does not catch empty toolset.
426 ECHO "###" ;
427 ECHO "###" No toolset specified. Please use --toolset option. ;
428 ECHO "###" ;
429 ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
430 EXIT "###" ;
431}
432if ! $(toolset) in $(toolsets)
433{
434 ECHO "###" ;
435 ECHO "###" Unknown toolset: $(toolset) ;
436 ECHO "###" ;
437 ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
438 EXIT "###" ;
439}
440--cc = $(tool.$(toolset).cc) ;
441if $(tool.$(toolset).opt.out[2])
442{
443 if $(tool.$(toolset).opt.out[1]) = $(tool.$(toolset).opt.out[2])
444 {
445 --out = $(tool.$(toolset).opt.out[1]) ;
446 --dir = $(tool.$(toolset).opt.out[3-]) ;
447 }
448 else
449 {
450 --bin = $(tool.$(toolset).opt.out[1]) ;
451 --dir = $(tool.$(toolset).opt.out[2-]) ;
452 }
453}
454else
455{
456 --out = $(tool.$(toolset).opt.out) ;
457}
458--def = $(tool.$(toolset).opt.define) ;
459--flags = $(tool.$(toolset).flags) ;
460--defs = $(tool.$(toolset).defines) ;
461--libs = $(tool.$(toolset).linklibs) ;
462if $(tool.$(toolset).link.cc)
463{
464 --link = $(tool.$(toolset).link.cc) ;
465 if $(tool.$(toolset).link.opt.out[2])
466 {
467 if $(tool.$(toolset).link.opt.out[1]) = $(tool.$(toolset).link.opt.out[2])
468 {
469 --link-out = $(tool.$(toolset).link.opt.out[1]) ;
470 --link-dir = $(tool.$(toolset).link.opt.out[3-]) ;
471 }
472 else
473 {
474 --link-bin = $(tool.$(toolset).link.opt.out[1]) ;
475 --link-dir = $(tool.$(toolset).link.opt.out[2-]) ;
476 }
477 }
478 else
479 {
480 --link-out = $(tool.$(toolset).link.opt.out) ;
481 }
482 --link-def = $(tool.$(toolset).link.opt.define) ;
483 --link-flags = $(tool.$(toolset).link.flags) ;
484 --link-defs = $(tool.$(toolset).link.defines) ;
485 --link-libs = $(tool.$(toolset).link.linklibs) ;
486}
487
488# Put executables in platform-specific subdirectory.
489locate-target = $(LOCATE_TARGET) ;
490if $(OSPLAT)
491{
492 locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
493 platform = $(OS:L)$(OSPLAT:L) ;
494}
495else
496{
497 locate-target ?= bin$(.)$(OS:L) ;
498 platform = $(OS:L) ;
499}
500if $(debug)
501{
502 locate-target = [ .path $(locate-target)$(.)debug ] ;
503}
504if $(profile)
505{
506 locate-target = [ .path $(locate-target)$(.)profile ] ;
507}
508else
509{
510 locate-target = [ .path $(locate-target) ] ;
511}
512
513if --show-locate-target in $(ARGV)
514{
515 ECHO $(locate-target) ;
516}
517
518# We have some different files for UNIX, VMS, and NT.
519jam.source =
520 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c
521 hash.c hcache.c headers.c hdrmacro.c jam.c jambase.c jamgram.c lists.c
522 make.c make1.c mem.c object.c option.c output.c parse.c pathsys.c regexp.c
523 rules.c scan.c search.c subst.c w32_getreg.c timestamp.c variable.c
524 modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c
525 [ .path modules set.c ] [ .path modules path.c ] [ .path modules regex.c ]
526 [ .path modules property-set.c ] [ .path modules sequence.c ] [ .path modules order.c ] ;
527if $(OS) = NT
528{
529 jam.source += execnt.c filent.c pathnt.c ;
530}
531else if $(OS) = VMS
532{
533 jam.source += execvms.c filevms.c pathvms.c ;
534 --flags += /INCLUDE=(\""./modules"\") ;
535}
536else
537{
538 jam.source += execunix.c fileunix.c pathunix.c ;
539}
540
541# Debug assertions, or not.
542if ! $(debug) || --noassert in $(ARGV)
543{
544 --defs += NDEBUG ;
545}
546
547# Enable some optional features.
548--defs += OPT_HEADER_CACHE_EXT ;
549--defs += OPT_GRAPH_DEBUG_EXT ;
550--defs += OPT_SEMAPHORE ;
551--defs += OPT_AT_FILES ;
552--defs += OPT_DEBUG_PROFILE ;
553
554# Bug fixes
555--defs += OPT_FIX_TARGET_VARIABLES_EXT ;
556#~ --defs += OPT_NO_EXTERNAL_VARIABLE_SPLIT ;
557
558# Improvements
559--defs += OPT_IMPROVED_PATIENCE_EXT ;
560
561# Use Boehm GC memory allocator?
562if $(--boehm-gc)
563{
564 --defs += OPT_BOEHM_GC ;
565 if $(debug)
566 {
567 --defs += GC_DEBUG ;
568 }
569}
570
571if $(--duma)
572{
573 --defs += OPT_DUMA ;
574}
575
576if ( $(OS) = NT ) && ! NT in $(--defs)
577{
578 --defs += NT ;
579}
580if $(OS) = VMS
581{
582 --defs += VMS ;
583}
584--defs += YYSTACKSIZE=5000 ;
585
586if $(with-python)
587{
588 --defs += HAVE_PYTHON ;
589}
590
591if $(debug)
592{
593 --defs += BJAM_NEWSTR_NO_ALLOCATE ;
594}
595
596
597# The basic symbolic targets...
598NOTFILE all clean dist ;
599ALWAYS clean ;
600
601# Utility rules and actions...
602rule .clean
603{
604 [DELETE] clean : $(<) ;
605}
606if $(OS) = NT { actions piecemeal together existing [DELETE] {
607 del /F /Q "$(>)"
608} }
609if $(UNIX) = true { actions piecemeal together existing [DELETE] {
610 rm -f "$(>)"
611} }
612if $(OS) = VMS { actions piecemeal together existing [DELETE] {
613 DELETE /NOCONF $(>:WJ=;*, );*
614} }
615if $(OS) = NT {
616 --chmod+w = "attrib -r " ;
617}
618if $(UNIX) = true {
619 --chmod+w = "chmod +w " ;
620}
621if $(OS) = VMS {
622 --chmod+w = "SET FILE/PROT=(W:RWED) " ;
623}
624
625rule .mkdir
626{
627 NOUPDATE $(<) ;
628 if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
629 if ! $(md<$(<)>) { [MKDIR] $(<) ; md<$(<)> = - ; }
630}
631if $(OS) = NT { actions [MKDIR] {
632 md "$(<)"
633} }
634if $(UNIX) = true { actions [MKDIR] {
635 mkdir "$(<)"
636} }
637if $(OS) = VMS { actions [MKDIR] {
638 CREATE/DIR $(<:WJ=, )
639} }
640
641rule .exe
642{
643 local exe = $(<) ;
644 if $(OS) = NT || ( $(UNIX) = true && $(OS) = CYGWIN ) || $(OS) = VMS { exe = $(exe:S=.exe) ; }
645 LOCATE on $(exe) = $(locate-target) ;
646 DEPENDS all : $(exe) ;
647 .mkdir $(locate-target) ;
648 if $(--link)
649 {
650 local objs ;
651 for local s in $(>)
652 {
653 # Translate any subdir elements into a simple file name.
654 local o = [ MATCH "([^/]+)[/]?(.+)" : $(s) ] ;
655
656 o = $(o:J=_) ;
657 o = $(o:S=.o) ;
658 if $(OS) = VMS { o = $(o:S=.obj) ; }
659 objs += $(o) ;
660 LOCATE on $(o) = $(locate-target) ;
661 DEPENDS $(exe) : $(o) ;
662 DEPENDS $(o) : $(s) ;
663 DEPENDS $(o) : $(locate-target) ;
664 [COMPILE] $(o) : $(s) ;
665 .clean $(o) ;
666 }
667 DEPENDS $(exe) : $(objs) ;
668 DEPENDS $(exe) : $(locate-target) ;
669 [COMPILE.LINK] $(exe) : $(objs) ;
670 .clean $(exe) ;
671 }
672 else
673 {
674 DEPENDS $(exe) : $(>) ;
675 DEPENDS $(exe) : $(locate-target) ;
676 [COMPILE] $(exe) : $(>) ;
677 .clean $(exe) ;
678 }
679 return $(exe) ;
680}
681
682if $(OS) = VMS { actions [COMPILE] {
683 $(--cc) $(--bin)$(<:WD=) $(--dir)$(<:D)$(./) $(--out)$(<:W) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) $(>:W) $(--libs)
684} }
685else if ! $(--def[2]) { actions [COMPILE] {
686 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def)$(--defs)" "$(--flags)" "$(>)" "$(--libs)"
687} }
688else { actions [COMPILE] {
689 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def[1])$(--defs:J=$(--def[2]))$(--def[3])" "$(--flags)" "$(>)" "$(--libs)"
690} }
691
692if $(OS) = VMS { actions [COMPILE.LINK] {
693 $(--link) $(--link-bin)$(<:WD=) $(--link-dir)$(<:WD)$(./) $(--link-out)$(<:W) $(--link-def)$(--link-defs) $(--link-flags) $(--link-libs) $(>:WJ=, )
694} }
695else { actions [COMPILE.LINK] {
696 "$(--link)" "$(--link-bin)$(<:D=)" "$(--link-dir)$(<:D)$(./)" "$(--link-out)$(<)" "$(--link-def)$(--link-defs)" "$(--link-flags)" "$(>)" "$(--link-libs)"
697} }
698
699rule .link
700{
701 DEPENDS all : $(<) ;
702 DEPENDS $(<) : $(>) ;
703 [LINK] $(<) : $(>) ;
704 .clean $(<) ;
705}
706if $(OS) = NT { actions [LINK] {
707 copy "$(>)" "$(<)"
708} }
709if $(UNIX) = true { actions [LINK] {
710 ln -fs "$(>)" "$(<)"
711} }
712if $(OS) = VMS { actions [LINK] {
713 COPY/REPLACE $(>:W) $(<:W)
714} }
715
716rule .copy
717{
718 DEPENDS all : $(<) ;
719 DEPENDS $(<) : $(>) ;
720 [COPY] $(<) : $(>) ;
721 .clean $(<) ;
722}
723
724# Will be redefined later.
725if $(OS) = VMS { actions [COPY] {
726 COPY/REPLACE $(>:W) $(<:W)
727} }
728else { actions [COPY] {
729} }
730
731
732rule .move
733{
734 DEPENDS $(<) : $(>) ;
735 [MOVE] $(<) : $(>) ;
736}
737if $(OS) = NT { actions [MOVE] {
738 del /f "$(<)"
739 rename "$(>)" "$(<)"
740} }
741if $(UNIX) = true { actions [MOVE] {
742 mv -f "$(>)" "$(<)"
743} }
744if $(OS) = VMS { actions [MOVE] {
745 RENAME /NOCONF $(>:W) $(<:W)
746} }
747
748# Generate the grammar tokens table, and the real yacc grammar.
749rule .yyacc
750{
751 local exe = [ .exe yyacc : yyacc.c ] ;
752 NOUPDATE $(exe) ;
753 DEPENDS $(<) : $(exe) $(>) ;
754 LEAVES $(<) ;
755 yyacc.exe on $(<) = $(exe:R=$(locate-target)) ;
756 [YYACC] $(<) : $(>) ;
757}
758actions [YYACC] {
759 $(--chmod+w)$(<[1])
760 $(--chmod+w)$(<[2])
761 "$(yyacc.exe)" "$(<)" "$(>)"
762}
763if $(grammar)
764{
765 .yyacc jamgram.y jamgramtab.h : jamgram.yy ;
766}
767else if $(debug)
768{
769 .exe yyacc : yyacc.c ;
770}
771
772# How to build the grammar.
773if $(OS) = NT
774{
775 SUFEXE = .exe ;
776 # try some other likely spellings...
777 PATH ?= $(Path) ;
778 PATH ?= $(path) ;
779}
780SUFEXE ?= "" ;
781
782yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ;
783yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ;
784yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin"
785 "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ;
786yacc = $(yacc[1]) ;
787switch $(yacc:D=:S=)
788{
789 case bison : yacc += -d --yacc ;
790 case yacc : yacc += -d ;
791}
792if $(debug) && $(yacc)
793{
794 yacc += -t -v ;
795}
796yacc += $(YACCFLAGS) ;
797
798rule .yacc
799{
800 DEPENDS $(<) : $(>) ;
801 LEAVES $(<) ;
802 [YACC] $(<) : $(>) ;
803}
804if $(OS) = NT { actions [YACC] {
805 "$(yacc)" "$(>)"
806 if not errorlevel 1 (
807 del /f "$(<[1])"
808 rename y.tab$(<[1]:S) "$(<[1])"
809 del /f $(<[2])
810 rename y.tab$(<[2]:S) "$(<[2])"
811 ) else set _error_ =
812} }
813if $(UNIX) = true { actions [YACC] {
814 if ` "$(yacc)" "$(>)" ` ; then
815 mv -f y.tab$(<[1]:S) "$(<[1])"
816 mv -f y.tab$(<[2]:S) "$(<[2])"
817 else
818 exit 1
819 fi
820} }
821if $(OS) = VMS { actions [YACC] {
822 IF $(yacc) $(>)
823 THEN
824 RENAME /NOCONF y_tab$(<[1]:S) $(<[1]:W)
825 RENAME /NOCONF y_tab$(<[2]:S) $(<[2]:W)
826 ENDIF
827} }
828if $(grammar) && ! $(yacc)
829{
830 EXIT Could not find the 'yacc' tool, and therefore can not build the
831 grammar. ;
832}
833if $(grammar) && $(yacc)
834{
835 .yacc jamgram.c jamgram.h : jamgram.y ;
836}
837
838# How to build the compiled in jambase.
839rule .mkjambase
840{
841 local exe = [ .exe mkjambase : mkjambase.c ] ;
842 DEPENDS $(<) : $(exe) $(>) ;
843 LEAVES $(<) ;
844 mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
845 [MKJAMBASE] $(<) : $(>) ;
846}
847actions [MKJAMBASE] {
848 $(--chmod+w)$(<)
849 $(mkjambase.exe) "$(<)" "$(>)"
850}
851if $(debug)
852{
853 .mkjambase jambase.c : Jambase ;
854}
855
856# How to build Jam.
857rule .jam
858{
859 $(>).exe = [ .exe $(>) : $(jam.source) ] ;
860 DEPENDS all : $($(>).exe) ;
861
862 # Make a copy under the old name.
863 $(<).exe = $(<:S=$($(>).exe:S)) ;
864 LOCATE on $($(<).exe) = $(locate-target) ;
865 .copy $($(<).exe) : $($(>).exe) ;
866 DEPENDS all : $($(<).exe) ;
867}
868.jam bjam : b2 ;
869
870
871# Scan sources for header dependencies.
872#
873# In order to keep things simple, we made a slight compromise here - we only
874# detect changes in headers included relative to the current folder as opposed
875# to those included from somewhere on the include path.
876rule .scan ( targets + )
877{
878 HDRRULE on $(targets) = .hdr.scan ;
879 HDRSCAN on $(targets) = "^[ \t]*#[ \t]*include[ \t]*\"([^\"]*)\".*$" ;
880}
881rule .hdr.scan ( target : includes * : binding )
882{
883 local target-path = [ NORMALIZE_PATH $(binding:D) ] ;
884 # Extra grist provides target name uniqueness when referencing same name
885 # header files from different folders.
886 local include-targets = <$(target-path)>$(includes) ;
887 NOCARE $(include-targets) ;
888 INCLUDES $(target) : $(include-targets) ;
889 SEARCH on $(include-targets) = $(target-path) ;
890 ISFILE $(include-targets) ;
891 .scan $(include-targets) ;
892}
893.scan $(jam.source) ;
894
895
896# Distribution making from here on out. Assumes that the docs are already built
897# as HTML at ../doc/html. Otherwise they will not be included in the built
898# distribution archive.
899dist.license =
900 [ GLOB . : $(LICENSE).txt ]
901 ;
902dist.license = $(dist.license:D=)
903 [ GLOB [ .path .. .. .. ] : $(LICENSE).txt ]
904 [ GLOB [ .path .. boost ] : $(LICENSE).txt ] ;
905dist.docs =
906 [ GLOB . : *.png *.css *.html ]
907 ;
908dist.docs = $(dist.docs:D=)
909 [ GLOB [ .path images ] : *.png ]
910 [ GLOB [ .path jam ] : *.html ]
911 ;
912dist.source =
913 [ GLOB . : *.c *.h ]
914 ;
915dist.source = $(dist.source:D=)
916 $(dist.license[1])
917 $(dist.docs)
918 build.jam build.bat build.sh build_vms.com
919 Jambase
920 jamgram.y jamgram.yy
921 [ .path modules set.c ]
922 [ .path modules path.c ]
923 [ .path modules regex.c ]
924 [ .path modules property-set.c ]
925 [ .path modules sequence.c ]
926 [ .path modules order.c ]
927 [ GLOB [ .path boehm_gc ] : * ]
928 [ GLOB [ .path boehm_gc include ] : * ]
929 [ GLOB [ .path boehm_gc include private ] : * ]
930 [ GLOB [ .path boehm_gc cord ] : * ]
931 [ GLOB [ .path boehm_gc Mac_files ] : * ]
932 [ GLOB [ .path boehm_gc tests ] : * ]
933 [ GLOB [ .path boehm_gc doc ] : * ]
934 ;
935dist.bin =
936 bjam
937 ;
938dist.bin =
939 $(dist.license[1])
940 $(dist.bin:S=$(bjam.exe:S))
941 ;
942
943if $(OS) = NT
944{
945 zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7z.exe" ] ;
946 zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7zn.exe" ] ;
947 zip ?= [ GLOB $(PATH) : zip.exe ] ;
948 zip ?= zip ;
949 zip = $(zip[1]) ;
950 switch $(zip:D=:S=)
951 {
952 case 7z* : zip += a -r -tzip -mx=9 ;
953 case zip : zip += -9r ;
954 }
955 actions piecemeal [PACK] {
956 "$(zip)" "$(<)" "$(>)"
957 }
958 actions piecemeal [ZIP] {
959 "$(zip)" "$(<)" "$(>)"
960 }
961 actions piecemeal [COPY] {
962 copy /Y "$(>)" "$(<)" >NUL:
963 }
964}
965if $(UNIX) = true
966{
967 tar ?= [ GLOB $(PATH) : star bsdtar tar ] ;
968 tar = $(tar[1]) ;
969 switch $(tar:D=:S=)
970 {
971 case star : tar += -c artype=pax -D -d -to-stdout ;
972 case * : tar += -c -f - ;
973 }
974 actions [PACK] {
975 "$(tar)" "$(>)" | gzip -c9 > "$(<)"
976 }
977 #~ actions [PACK] {
978 #~ tar cf "$(<:S=.tar)" "$(>)"
979 #~ }
980 actions [ZIP] {
981 gzip -c9 "$(>)" > "$(<)"
982 }
983 actions [COPY] {
984 cp -Rpf "$(>)" "$(<)"
985 }
986}
987
988# The single binary, compressed.
989rule .binary
990{
991 local zip ;
992 if $(OS) = NT { zip = $($(<).exe:S=.zip) ; }
993 if $(UNIX) = true { zip = $($(<).exe:S=.tgz) ; }
994 zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ;
995 DEPENDS $(zip) : $($(<).exe) ;
996 DEPENDS dist : $(zip) ;
997 #~ LOCATE on $(zip) = $(locate-target) ;
998 if $(OS) = NT { [ZIP] $(zip) : $($(<).exe) ; }
999 if $(UNIX) = true { [PACK] $(zip) : $($(<).exe) ; }
1000 .clean $(zip) ;
1001}
1002
1003# Package some file.
1004rule .package ( dst-dir : src-files + )
1005{
1006 local dst-files ;
1007 local src-files-actual ;
1008 for local src-path in $(src-files)
1009 {
1010 if ! [ GLOB $(src-path:P) : $(src-path:B) ] || [ CHECK_IF_FILE $(src-path) ]
1011 {
1012 local src-subdir = $(src-path:D) ;
1013 local src-file = $(src-path) ;
1014 while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; }
1015 if $(src-subdir) = ".."
1016 {
1017 src-file = $(src-file:D=) ;
1018 }
1019 dst-files += $(src-file:R=$(dst-dir)) ;
1020 src-files-actual += $(src-path) ;
1021 }
1022 }
1023
1024 local pack ;
1025 if $(OS) = NT { pack = $(dst-dir).zip ; }
1026 if $(UNIX) = true { pack = $(dst-dir).tgz ; }
1027
1028 DEPENDS dist : $(pack) ;
1029 DEPENDS $(pack) : $(dst-files) ;
1030
1031 local dst-files-queue = $(dst-files) ;
1032 for local src-path in $(src-files-actual)
1033 {
1034 local dst-file = $(dst-files-queue[1]) ;
1035 dst-files-queue = $(dst-files-queue[2-]) ;
1036 DEPENDS $(dst-file) : $(src-path) $(dst-file:D) ;
1037 .mkdir $(dst-file:D) ;
1038
1039 [COPY] $(dst-file) : $(src-path) ;
1040 .clean $(dst-file) ;
1041 }
1042
1043 [PACK] $(pack) : $(dst-files) ;
1044 .clean $(pack) ;
1045}
1046
1047# RPM distro file.
1048rpm-tool = [ GLOB $(PATH) : "rpmbuild" ] ;
1049rpm-tool ?= [ GLOB $(PATH) : "rpm" ] ;
1050rpm-tool = $(rpm-tool[1]) ;
1051rule .rpm ( name : source )
1052{
1053 local rpm-arch ;
1054 switch $(OSPLAT)
1055 {
1056 case X86 : rpm-arch ?= i386 ;
1057 case PPC : rpm-arch ?= ppc ;
1058 case AXP : rpm-arch ?= alpha ;
1059 # no guaranty for these:
1060 case IA64 : rpm-arch ?= ia64 ;
1061 case ARM : rpm-arch ?= arm ;
1062 case SPARC : rpm-arch ?= sparc ;
1063 case * : rpm-arch ?= other ;
1064 }
1065 local target = $(name)-rpm ;
1066 NOTFILE $(target) ;
1067 DEPENDS dist : $(target) ;
1068 DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ;
1069 DEPENDS $(name).$(rpm-arch).rpm : $(source) ;
1070 DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ;
1071 docs on $(target) = $(dist.docs:J=" ") ;
1072 arch on $(target) = $(rpm-arch) ;
1073 if $(rpm-arch) = ppc { target-opt on $(target) = --target= ; }
1074 else { target-opt on $(target) = "--target " ; }
1075 [RPM] $(target) : $(source) ;
1076 .clean $(name).$(rpm-arch).rpm $(name).src.rpm ;
1077}
1078actions [RPM] {
1079 set -e
1080 export BOOST_JAM_TOOLSET="$(toolset)"
1081 $(rpm-tool) -ta $(target-opt)$(arch) $(>) | tee rpm.out
1082 cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` .
1083 rm -f rpm.out
1084}
1085
1086# The distribution targets. Do not bother with them unless this is a
1087# distribution build.
1088if dist in $(ARGV)
1089{
1090 #~ .binary bjam ;
1091 .package $(NAME)-$(VERSION) : $(dist.source) ;
1092 .package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ;
1093 if $(rpm-tool)
1094 {
1095 #~ .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ;
1096 }
1097}