]> git.proxmox.com Git - ceph.git/blob - 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
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.
7 for 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.
21 if $(OS) = NT { rule .path { return "$(<:J=\\)" ; } ./ = "/" ; }
22 else { rule .path { return "$(<:J=/)" ; } }
23
24 if $(OS) = VMS { . = "_" ; }
25 else { . = "." ; }
26 ./ ?= "" ;
27
28 # Info about what we are building.
29 _VERSION_ = 3 1 19 ;
30 NAME = boost-jam ;
31 VERSION = $(_VERSION_:J=$(.)) ;
32 RELEASE = 1 ;
33 LICENSE = LICENSE_1_0 ;
34
35 # Generate development debug binaries?
36 if --debug in $(ARGV)
37 {
38 debug = true ;
39 }
40
41 if --profile in $(ARGV)
42 {
43 profile = true ;
44 }
45
46 # Attempt to generate and/or build the grammar?
47 if --grammar in $(ARGV)
48 {
49 grammar = true ;
50 }
51
52 # Do we need to add a default build type argument?
53 if ! ( --release in $(ARGV) ) &&
54 ! ( --debug in $(ARGV) ) &&
55 ! ( --profile in $(ARGV) )
56 {
57 ARGV += --release ;
58 }
59
60 # Enable, and configure, Python hooks.
61 with-python = ;
62 python-location = [ MATCH --with-python=(.*) : $(ARGV) ] ;
63 if $(python-location)
64 {
65 with-python = true ;
66 }
67 if $(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
109 if $(--python-include) || $(--python-lib)
110 {
111 ECHO "Python includes: $(--python-include:J=)" ;
112 ECHO "Python includes: $(--python-lib:J=)" ;
113 }
114
115 # Boehm GC?
116 if --gc in $(ARGV)
117 {
118 --boehm-gc = true ;
119 }
120 if $(--boehm-gc)
121 {
122 --extra-include += [ .path [ PWD ] "boehm_gc" "include" ] ;
123 }
124
125 # Duma?
126 if --duma in $(ARGV)
127 {
128 --duma = true ;
129 }
130 if $(--duma)
131 {
132 --extra-include += [ .path [ PWD ] "duma" ] ;
133 }
134
135 # An explicit root for the toolset? (trim spaces)
136 toolset-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
154 rule 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
165 rule if-os ( os + : yes-opt * : no-opt * )
166 { if $(os) in $(OS) { return $(yes-opt) ; } else { return $(no-opt) ; } }
167
168 rule opt ( type : yes-opt * : no-opt * )
169 { if $(type) in $(ARGV) { return $(yes-opt) ; } else { return $(no-opt) ; } }
170
171 ## HP-UX aCC compiler
172 toolset 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
179 toolset 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
186 if ! $(CC) { CC = cc ; }
187 toolset 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
194 toolset 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+
201 toolset 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
209 toolset 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
217 toolset 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
225 toolset 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
232 toolset 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
239 toolset 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
246 toolset 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 ?
253 toolset 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
260 toolset 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
284 toolset 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
291 toolset 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
298 toolset 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
305 toolset 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
312 toolset 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++
319 toolset 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)
326 toolset 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
333 toolset 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)
340 toolset 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)
348 toolset 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
356 toolset 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) -D_WIN32_WINNT=0x0501
361 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
362 ## Microsoft Visual C++ 2005
363 toolset 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
370 toolset 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
377 toolset 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
384 toolset 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
391 toolset 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
398 toolset 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]) ;
404 ## Microsoft Visual C++ 2017
405 toolset vc141 cl : /Fe /Fe /Fd /Fo : -D
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
412 toolset 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 ] ;
416 toolset 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.
423 toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
424 if ! $(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 "###" ;
430 ECHO "###" Known toolsets "are:" $(toolsets:J=", ") ;
431 EXIT "###" ;
432 }
433 if ! $(toolset) in $(toolsets)
434 {
435 ECHO "###" ;
436 ECHO "###" Unknown "toolset:" $(toolset) ;
437 ECHO "###" ;
438 ECHO "###" Known toolsets "are:" $(toolsets:J=", ") ;
439 EXIT "###" ;
440 }
441 --cc = $(tool.$(toolset).cc) ;
442 if $(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 }
455 else
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) ;
463 if $(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.
490 locate-target = $(LOCATE_TARGET) ;
491 if $(OSPLAT)
492 {
493 locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
494 platform = $(OS:L)$(OSPLAT:L) ;
495 }
496 else
497 {
498 locate-target ?= bin$(.)$(OS:L) ;
499 platform = $(OS:L) ;
500 }
501 if $(debug)
502 {
503 locate-target = [ .path $(locate-target)$(.)debug ] ;
504 }
505 if $(profile)
506 {
507 locate-target = [ .path $(locate-target)$(.)profile ] ;
508 }
509 else
510 {
511 locate-target = [ .path $(locate-target) ] ;
512 }
513
514 if --show-locate-target in $(ARGV)
515 {
516 ECHO $(locate-target) ;
517 }
518
519 # We have some different files for UNIX, VMS, and NT.
520 jam.source =
521 command.c compile.c constants.c debug.c debugger.c execcmd.c frames.c function.c glob.c
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 ] ;
528 if $(OS) = NT
529 {
530 jam.source += execnt.c filent.c pathnt.c ;
531 }
532 else if $(OS) = VMS
533 {
534 jam.source += execvms.c filevms.c pathvms.c ;
535 --flags += /INCLUDE=(\""./modules"\") ;
536 }
537 else
538 {
539 jam.source += execunix.c fileunix.c pathunix.c ;
540 }
541
542 # Debug assertions, or not.
543 if ! $(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 ;
554 --defs += JAM_DEBUGGER ;
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?
564 if $(--boehm-gc)
565 {
566 --defs += OPT_BOEHM_GC ;
567 if $(debug)
568 {
569 --defs += GC_DEBUG ;
570 }
571 }
572
573 if $(--duma)
574 {
575 --defs += OPT_DUMA ;
576 }
577
578 if ( $(OS) = NT ) && ! NT in $(--defs)
579 {
580 --defs += NT ;
581 }
582 if $(OS) = VMS
583 {
584 --defs += VMS ;
585 }
586 --defs += YYSTACKSIZE=5000 ;
587
588 if $(with-python)
589 {
590 --defs += HAVE_PYTHON ;
591 }
592
593 if $(debug)
594 {
595 --defs += BJAM_NEWSTR_NO_ALLOCATE ;
596 }
597
598
599 # The basic symbolic targets...
600 NOTFILE all clean dist ;
601 ALWAYS clean ;
602
603 # Utility rules and actions...
604 rule .clean
605 {
606 "[DELETE]" clean : $(<) ;
607 }
608 if $(OS) = NT { actions piecemeal together existing "[DELETE]" {
609 del /F /Q "$(>)"
610 } }
611 if $(UNIX) = true { actions piecemeal together existing "[DELETE]" {
612 rm -f "$(>)"
613 } }
614 if $(OS) = VMS { actions piecemeal together existing "[DELETE]" {
615 DELETE /NOCONF $(>:WJ=;*, );*
616 } }
617 if $(OS) = NT {
618 --chmod+w = "attrib -r " ;
619 }
620 if $(UNIX) = true {
621 --chmod+w = "chmod +w " ;
622 }
623 if $(OS) = VMS {
624 --chmod+w = "SET FILE/PROT=(W:RWED) " ;
625 }
626
627 rule .mkdir
628 {
629 NOUPDATE $(<) ;
630 if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
631 if ! $(md<$(<)>) { "[MKDIR]" $(<) ; md<$(<)> = - ; }
632 }
633 if $(OS) = NT { actions "[MKDIR]" {
634 md "$(<)"
635 } }
636 if $(UNIX) = true { actions "[MKDIR]" {
637 mkdir "$(<)"
638 } }
639 if $(OS) = VMS { actions "[MKDIR]" {
640 CREATE/DIR $(<:WJ=, )
641 } }
642
643 rule .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) ;
666 "[COMPILE]" $(o) : $(s) ;
667 .clean $(o) ;
668 }
669 DEPENDS $(exe) : $(objs) ;
670 DEPENDS $(exe) : $(locate-target) ;
671 "[COMPILE.LINK]" $(exe) : $(objs) ;
672 .clean $(exe) ;
673 }
674 else
675 {
676 DEPENDS $(exe) : $(>) ;
677 DEPENDS $(exe) : $(locate-target) ;
678 "[COMPILE]" $(exe) : $(>) ;
679 .clean $(exe) ;
680 }
681 return $(exe) ;
682 }
683
684 if $(OS) = VMS { actions "[COMPILE]" {
685 $(--cc) $(--bin)$(<:WD=) $(--dir)$(<:D)$(./) $(--out)$(<:W) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) $(>:W) $(--libs)
686 } }
687 else if ! $(--def[2]) { actions "[COMPILE]" {
688 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def)$(--defs)" "$(--flags)" "$(>)" "$(--libs)"
689 } }
690 else { actions "[COMPILE]" {
691 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def[1])$(--defs:J=$(--def[2]))$(--def[3])" "$(--flags)" "$(>)" "$(--libs)"
692 } }
693
694 if $(OS) = VMS { actions "[COMPILE.LINK]" {
695 $(--link) $(--link-bin)$(<:WD=) $(--link-dir)$(<:WD)$(./) $(--link-out)$(<:W) $(--link-def)$(--link-defs) $(--link-flags) $(--link-libs) $(>:WJ=, )
696 } }
697 else { actions "[COMPILE.LINK]" {
698 "$(--link)" "$(--link-bin)$(<:D=)" "$(--link-dir)$(<:D)$(./)" "$(--link-out)$(<)" "$(--link-def)$(--link-defs)" "$(--link-flags)" "$(>)" "$(--link-libs)"
699 } }
700
701 rule .link
702 {
703 DEPENDS all : $(<) ;
704 DEPENDS $(<) : $(>) ;
705 "[LINK]" $(<) : $(>) ;
706 .clean $(<) ;
707 }
708 if $(OS) = NT { actions "[LINK]" {
709 copy "$(>)" "$(<)"
710 } }
711 if $(UNIX) = true { actions "[LINK]" {
712 ln -fs "$(>)" "$(<)"
713 } }
714 if $(OS) = VMS { actions "[LINK]" {
715 COPY/REPLACE $(>:W) $(<:W)
716 } }
717
718 rule .copy
719 {
720 DEPENDS all : $(<) ;
721 DEPENDS $(<) : $(>) ;
722 "[COPY]" $(<) : $(>) ;
723 .clean $(<) ;
724 }
725
726 # Will be redefined later.
727 if $(OS) = VMS { actions "[COPY]" {
728 COPY/REPLACE $(>:W) $(<:W)
729 } }
730 else { actions "[COPY]" {
731 } }
732
733
734 rule .move
735 {
736 DEPENDS $(<) : $(>) ;
737 "[MOVE]" $(<) : $(>) ;
738 }
739 if $(OS) = NT { actions "[MOVE]" {
740 del /f "$(<)"
741 rename "$(>)" "$(<)"
742 } }
743 if $(UNIX) = true { actions "[MOVE]" {
744 mv -f "$(>)" "$(<)"
745 } }
746 if $(OS) = VMS { actions "[MOVE]" {
747 RENAME /NOCONF $(>:W) $(<:W)
748 } }
749
750 # Generate the grammar tokens table, and the real yacc grammar.
751 rule .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)) ;
758 "[YYACC]" $(<) : $(>) ;
759 }
760 actions "[YYACC]" {
761 $(--chmod+w)$(<[1])
762 $(--chmod+w)$(<[2])
763 "$(yyacc.exe)" "$(<)" "$(>)"
764 }
765 if $(grammar)
766 {
767 .yyacc jamgram.y jamgramtab.h : jamgram.yy ;
768 }
769 else if $(debug)
770 {
771 .exe yyacc : yyacc.c ;
772 }
773
774 # How to build the grammar.
775 if $(OS) = NT
776 {
777 SUFEXE = .exe ;
778 # try some other likely spellings...
779 PATH ?= $(Path) ;
780 PATH ?= $(path) ;
781 }
782 SUFEXE ?= "" ;
783
784 yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ;
785 yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ;
786 yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin"
787 "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ;
788 yacc = $(yacc[1]) ;
789 switch $(yacc:D=:S=)
790 {
791 case bison : yacc += -d --yacc ;
792 case yacc : yacc += -d ;
793 }
794 if $(debug) && $(yacc)
795 {
796 yacc += -t -v ;
797 }
798 yacc += $(YACCFLAGS) ;
799
800 rule .yacc
801 {
802 DEPENDS $(<) : $(>) ;
803 LEAVES $(<) ;
804 "[YACC]" $(<) : $(>) ;
805 }
806 if $(OS) = NT { actions "[YACC]" {
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 } }
815 if $(UNIX) = true { actions "[YACC]" {
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 } }
823 if $(OS) = VMS { actions "[YACC]" {
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 } }
830 if $(grammar) && ! $(yacc)
831 {
832 EXIT Could not find the 'yacc' tool, and therefore can not build the
833 grammar. ;
834 }
835 if $(grammar) && $(yacc)
836 {
837 .yacc jamgram.c jamgram.h : jamgram.y ;
838 }
839
840 # How to build the compiled in jambase.
841 rule .mkjambase
842 {
843 local exe = [ .exe mkjambase : mkjambase.c ] ;
844 DEPENDS $(<) : $(exe) $(>) ;
845 LEAVES $(<) ;
846 mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
847 "[MKJAMBASE]" $(<) : $(>) ;
848 }
849 actions "[MKJAMBASE]" {
850 $(--chmod+w)$(<)
851 $(mkjambase.exe) "$(<)" "$(>)"
852 }
853 if $(debug)
854 {
855 .mkjambase jambase.c : Jambase ;
856 }
857
858 # How to build Jam.
859 rule .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.
878 rule .scan ( targets + )
879 {
880 HDRRULE on $(targets) = .hdr.scan ;
881 HDRSCAN on $(targets) = "^[ \t]*#[ \t]*include[ \t]*\"([^\"]*)\".*$" ;
882 }
883 rule .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.
901 dist.license =
902 [ GLOB . : $(LICENSE).txt ]
903 ;
904 dist.license = $(dist.license:D=)
905 [ GLOB [ .path .. .. .. ] : $(LICENSE).txt ]
906 [ GLOB [ .path .. boost ] : $(LICENSE).txt ] ;
907 dist.docs =
908 [ GLOB . : *.png *.css *.html ]
909 ;
910 dist.docs = $(dist.docs:D=)
911 [ GLOB [ .path images ] : *.png ]
912 [ GLOB [ .path jam ] : *.html ]
913 ;
914 dist.source =
915 [ GLOB . : *.c *.h ]
916 ;
917 dist.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 ;
937 dist.bin =
938 bjam
939 ;
940 dist.bin =
941 $(dist.license[1])
942 $(dist.bin:S=$(bjam.exe:S))
943 ;
944
945 if $(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 }
957 actions piecemeal "[PACK]" {
958 "$(zip)" "$(<)" "$(>)"
959 }
960 actions piecemeal "[ZIP]" {
961 "$(zip)" "$(<)" "$(>)"
962 }
963 actions piecemeal "[COPY]" {
964 copy /Y "$(>)" "$(<)" >NUL:
965 }
966 }
967 if $(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 }
976 actions "[PACK]" {
977 "$(tar)" "$(>)" | gzip -c9 > "$(<)"
978 }
979 #~ actions "[PACK]" {
980 #~ tar cf "$(<:S=.tar)" "$(>)"
981 #~ }
982 actions "[ZIP]" {
983 gzip -c9 "$(>)" > "$(<)"
984 }
985 actions "[COPY]" {
986 cp -Rpf "$(>)" "$(<)"
987 }
988 }
989
990 # The single binary, compressed.
991 rule .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) ;
1000 if $(OS) = NT { "[ZIP]" $(zip) : $($(<).exe) ; }
1001 if $(UNIX) = true { "[PACK]" $(zip) : $($(<).exe) ; }
1002 .clean $(zip) ;
1003 }
1004
1005 # Package some file.
1006 rule .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
1041 "[COPY]" $(dst-file) : $(src-path) ;
1042 .clean $(dst-file) ;
1043 }
1044
1045 "[PACK]" $(pack) : $(dst-files) ;
1046 .clean $(pack) ;
1047 }
1048
1049 # RPM distro file.
1050 rpm-tool = [ GLOB $(PATH) : "rpmbuild" ] ;
1051 rpm-tool ?= [ GLOB $(PATH) : "rpm" ] ;
1052 rpm-tool = $(rpm-tool[1]) ;
1053 rule .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 " ; }
1077 "[RPM]" $(target) : $(source) ;
1078 .clean $(name).$(rpm-arch).rpm $(name).src.rpm ;
1079 }
1080 actions "[RPM]" {
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.
1090 if 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 }