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)
6 # Clean env vars of any "extra" empty values.
7 for local v in ARGV CC CFLAGS LIBS
10 for local x in $($(v))
20 # Platform related specifics.
21 if $(OS) = NT { rule .path { return "$(<:J=\\)" ; } ./ = "/" ; }
22 else { rule .path { return "$(<:J=/)" ; } }
24 if $(OS) = VMS { . = "_" ; }
28 # Info about what we are building.
31 VERSION = $(_VERSION_:J=$(.)) ;
33 LICENSE = LICENSE_1_0 ;
35 # Generate development debug binaries?
41 if --profile in $(ARGV)
46 # Attempt to generate and/or build the grammar?
47 if --grammar in $(ARGV)
52 # Do we need to add a default build type argument?
53 if ! ( --release in $(ARGV) ) &&
54 ! ( --debug in $(ARGV) ) &&
55 ! ( --profile in $(ARGV) )
60 # Enable, and configure, Python hooks.
62 python-location = [ MATCH --with-python=(.*) : $(ARGV) ] ;
71 --python-include = [ .path $(python-location) include ] ;
73 for local v in 27 26 25 24 23 22
76 [ GLOB [ .path $(python-location) libs ] : "python$(v).lib" ]
77 [ GLOB $(python-location) [ .path $(python-location) libs ]
78 $(Path) $(PATH) $(path) : "python$(v).dll" ]
80 if ! $(--python-lib[2])
85 --python-lib = $(--python-lib[1]) ;
87 else if $(OS) = MACOSX
89 --python-include = [ .path $(python-location) Headers ] ;
90 --python-lib = $(python-location) Python ;
96 for local v in 2.7 2.6 2.5 2.4 2.3 2.2
98 local inc = [ GLOB [ .path $(python-location) include ] : python$(v) ] ;
99 local lib = [ GLOB [ .path $(python-location) lib ] : libpython$(v)* ] ;
102 --python-include ?= $(inc) ;
103 --python-lib ?= $(lib[1]:D) python$(v) ;
109 if $(--python-include) || $(--python-lib)
111 ECHO "Python includes: $(--python-include:J=)" ;
112 ECHO "Python includes: $(--python-lib:J=)" ;
122 --extra-include += [ .path [ PWD ] "boehm_gc" "include" ] ;
132 --extra-include += [ .path [ PWD ] "duma" ] ;
135 # An explicit root for the toolset? (trim spaces)
136 toolset-root = [ MATCH --toolset-root=(.*) : $(ARGV) ] ;
138 local t = [ MATCH "[ ]*(.*)" : $(toolset-root:J=" ") ] ;
142 t = [ MATCH "([^ ]+)([ ]*)(.*)" : $(t) ] ;
143 toolset-root += $(t[1]) ;
144 if $(t[3]) { toolset-root += $(t[2]) ; }
147 toolset-root = $(toolset-root:J="") ;
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
154 rule toolset ( name command .type ? : opt.out + : opt.define * : flags * : linklibs * )
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) ; }
165 rule if-os ( os + : yes-opt * : no-opt * )
166 { if $(os) in $(OS) { return $(yes-opt) ; } else { return $(no-opt) ; } }
168 rule opt ( type : yes-opt * : no-opt * )
169 { if $(type) in $(ARGV) { return $(yes-opt) ; } else { return $(no-opt) ; } }
171 ## HP-UX aCC compiler
172 toolset acc cc : "-o " : -D
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]) ;
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]) ;
186 if ! $(CC) { CC = cc ; }
187 toolset cc $(CC) : "-o " : -D
189 [ opt --release : -s -O ]
191 -I$(--python-include) -I$(--extra-include)
192 : $(LIBS) -L$(--python-lib[1]) -l$(--python-lib[2]) ;
194 toolset como como : "-o " : -D
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]) ;
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
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]) ;
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
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
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
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
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]) ;
253 toolset kcc KCC : "-o " : -D
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]) ;
260 toolset kylix bc++ : -o : -D
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
268 # Even though CW can compile all files at once, it crashes if it tries in
270 local mwcc ; if $(OS) != NT { mwcc = mwc$(OSPLAT:L) ; }
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]) ;
284 toolset mipspro cc : "-o " : -D
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
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
307 [ opt --release : -s -O3 ]
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
314 [ opt --release : -s -O3 ]
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
321 [ opt --release : -s -xO3 ]
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
328 [ opt --release : -s -xO3 ]
330 -I$(--python-include) -I$(--extra-include)
331 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
333 toolset tru64cxx cc : "-o " : -D
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
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" ] ;
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]) ;
355 ## Microsoft Visual C++ .NET 7.x
356 toolset vc7 cl : /Fe /Fe /Fd /Fo : -D
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
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
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
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
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
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
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
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]) ;
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= :
418 [ opt --release : /NODEBUG ]
419 [ opt --debug : /DEBUG ] ;
421 # First set the build commands and options according to the
423 toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
426 # For some reason, the following test does not catch empty toolset.
428 ECHO "###" No toolset specified. Please use --toolset option. ;
430 ECHO "###" Known toolsets "are:" $(toolsets:J=", ") ;
433 if ! $(toolset) in $(toolsets)
436 ECHO "###" Unknown "toolset:" $(toolset) ;
438 ECHO "###" Known toolsets "are:" $(toolsets:J=", ") ;
441 --cc = $(tool.$(toolset).cc) ;
442 if $(tool.$(toolset).opt.out[2])
444 if $(tool.$(toolset).opt.out[1]) = $(tool.$(toolset).opt.out[2])
446 --out = $(tool.$(toolset).opt.out[1]) ;
447 --dir = $(tool.$(toolset).opt.out[3-]) ;
451 --bin = $(tool.$(toolset).opt.out[1]) ;
452 --dir = $(tool.$(toolset).opt.out[2-]) ;
457 --out = $(tool.$(toolset).opt.out) ;
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)
465 --link = $(tool.$(toolset).link.cc) ;
466 if $(tool.$(toolset).link.opt.out[2])
468 if $(tool.$(toolset).link.opt.out[1]) = $(tool.$(toolset).link.opt.out[2])
470 --link-out = $(tool.$(toolset).link.opt.out[1]) ;
471 --link-dir = $(tool.$(toolset).link.opt.out[3-]) ;
475 --link-bin = $(tool.$(toolset).link.opt.out[1]) ;
476 --link-dir = $(tool.$(toolset).link.opt.out[2-]) ;
481 --link-out = $(tool.$(toolset).link.opt.out) ;
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) ;
489 # Put executables in platform-specific subdirectory.
490 locate-target = $(LOCATE_TARGET) ;
493 locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
494 platform = $(OS:L)$(OSPLAT:L) ;
498 locate-target ?= bin$(.)$(OS:L) ;
503 locate-target = [ .path $(locate-target)$(.)debug ] ;
507 locate-target = [ .path $(locate-target)$(.)profile ] ;
511 locate-target = [ .path $(locate-target) ] ;
514 if --show-locate-target in $(ARGV)
516 ECHO $(locate-target) ;
519 # We have some different files for UNIX, VMS, and NT.
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 ] ;
530 jam.source += execnt.c filent.c pathnt.c ;
534 jam.source += execvms.c filevms.c pathvms.c ;
535 --flags += /INCLUDE=(\""./modules"\") ;
539 jam.source += execunix.c fileunix.c pathunix.c ;
542 # Debug assertions, or not.
543 if ! $(debug) || --noassert in $(ARGV)
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 ;
557 --defs += OPT_FIX_TARGET_VARIABLES_EXT ;
558 #~ --defs += OPT_NO_EXTERNAL_VARIABLE_SPLIT ;
561 --defs += OPT_IMPROVED_PATIENCE_EXT ;
563 # Use Boehm GC memory allocator?
566 --defs += OPT_BOEHM_GC ;
578 if ( $(OS) = NT ) && ! NT in $(--defs)
586 --defs += YYSTACKSIZE=5000 ;
590 --defs += HAVE_PYTHON ;
595 --defs += BJAM_NEWSTR_NO_ALLOCATE ;
599 # The basic symbolic targets...
600 NOTFILE all clean dist ;
603 # Utility rules and actions...
606 "[DELETE]" clean : $(<) ;
608 if $(OS) = NT { actions piecemeal together existing "[DELETE]" {
611 if $(UNIX) = true { actions piecemeal together existing "[DELETE]" {
614 if $(OS) = VMS { actions piecemeal together existing "[DELETE]" {
615 DELETE /NOCONF $(>:WJ=;*, );*
618 --chmod+w = "attrib -r " ;
621 --chmod+w = "chmod +w " ;
624 --chmod+w = "SET FILE/PROT=(W:RWED) " ;
630 if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
631 if ! $(md<$(<)>) { "[MKDIR]" $(<) ; md<$(<)> = - ; }
633 if $(OS) = NT { actions "[MKDIR]" {
636 if $(UNIX) = true { actions "[MKDIR]" {
639 if $(OS) = VMS { actions "[MKDIR]" {
640 CREATE/DIR $(<:WJ=, )
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) ;
655 # Translate any subdir elements into a simple file name.
656 local o = [ MATCH "([^/]+)[/]?(.+)" : $(s) ] ;
660 if $(OS) = VMS { o = $(o:S=.obj) ; }
662 LOCATE on $(o) = $(locate-target) ;
663 DEPENDS $(exe) : $(o) ;
664 DEPENDS $(o) : $(s) ;
665 DEPENDS $(o) : $(locate-target) ;
666 "[COMPILE]" $(o) : $(s) ;
669 DEPENDS $(exe) : $(objs) ;
670 DEPENDS $(exe) : $(locate-target) ;
671 "[COMPILE.LINK]" $(exe) : $(objs) ;
676 DEPENDS $(exe) : $(>) ;
677 DEPENDS $(exe) : $(locate-target) ;
678 "[COMPILE]" $(exe) : $(>) ;
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)
687 else if ! $(--def[2]) { actions "[COMPILE]" {
688 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def)$(--defs)" "$(--flags)" "$(>)" "$(--libs)"
690 else { actions "[COMPILE]" {
691 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def[1])$(--defs:J=$(--def[2]))$(--def[3])" "$(--flags)" "$(>)" "$(--libs)"
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=, )
697 else { actions "[COMPILE.LINK]" {
698 "$(--link)" "$(--link-bin)$(<:D=)" "$(--link-dir)$(<:D)$(./)" "$(--link-out)$(<)" "$(--link-def)$(--link-defs)" "$(--link-flags)" "$(>)" "$(--link-libs)"
704 DEPENDS $(<) : $(>) ;
705 "[LINK]" $(<) : $(>) ;
708 if $(OS) = NT { actions "[LINK]" {
711 if $(UNIX) = true { actions "[LINK]" {
714 if $(OS) = VMS { actions "[LINK]" {
715 COPY/REPLACE $(>:W) $(<:W)
721 DEPENDS $(<) : $(>) ;
722 "[COPY]" $(<) : $(>) ;
726 # Will be redefined later.
727 if $(OS) = VMS { actions "[COPY]" {
728 COPY/REPLACE $(>:W) $(<:W)
730 else { actions "[COPY]" {
736 DEPENDS $(<) : $(>) ;
737 "[MOVE]" $(<) : $(>) ;
739 if $(OS) = NT { actions "[MOVE]" {
743 if $(UNIX) = true { actions "[MOVE]" {
746 if $(OS) = VMS { actions "[MOVE]" {
747 RENAME /NOCONF $(>:W) $(<:W)
750 # Generate the grammar tokens table, and the real yacc grammar.
753 local exe = [ .exe yyacc : yyacc.c ] ;
755 DEPENDS $(<) : $(exe) $(>) ;
757 yyacc.exe on $(<) = $(exe:R=$(locate-target)) ;
758 "[YYACC]" $(<) : $(>) ;
763 "$(yyacc.exe)" "$(<)" "$(>)"
767 .yyacc jamgram.y jamgramtab.h : jamgram.yy ;
771 .exe yyacc : yyacc.c ;
774 # How to build the grammar.
778 # try some other likely spellings...
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) ] ;
791 case bison : yacc += -d --yacc ;
792 case yacc : yacc += -d ;
794 if $(debug) && $(yacc)
798 yacc += $(YACCFLAGS) ;
802 DEPENDS $(<) : $(>) ;
804 "[YACC]" $(<) : $(>) ;
806 if $(OS) = NT { actions "[YACC]" {
808 if not errorlevel 1 (
810 rename y.tab$(<[1]:S) "$(<[1])"
812 rename y.tab$(<[2]:S) "$(<[2])"
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])"
823 if $(OS) = VMS { actions "[YACC]" {
826 RENAME /NOCONF y_tab$(<[1]:S) $(<[1]:W)
827 RENAME /NOCONF y_tab$(<[2]:S) $(<[2]:W)
830 if $(grammar) && ! $(yacc)
832 EXIT Could not find the 'yacc' tool, and therefore can not build the
835 if $(grammar) && $(yacc)
837 .yacc jamgram.c jamgram.h : jamgram.y ;
840 # How to build the compiled in jambase.
843 local exe = [ .exe mkjambase : mkjambase.c ] ;
844 DEPENDS $(<) : $(exe) $(>) ;
846 mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
847 "[MKJAMBASE]" $(<) : $(>) ;
849 actions "[MKJAMBASE]" {
851 $(mkjambase.exe) "$(<)" "$(>)"
855 .mkjambase jambase.c : Jambase ;
861 $(>).exe = [ .exe $(>) : $(jam.source) ] ;
862 DEPENDS all : $($(>).exe) ;
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) ;
873 # Scan sources for header dependencies.
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 + )
880 HDRRULE on $(targets) = .hdr.scan ;
881 HDRSCAN on $(targets) = "^[ \t]*#[ \t]*include[ \t]*\"([^\"]*)\".*$" ;
883 rule .hdr.scan ( target : includes * : binding )
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) ;
895 .scan $(jam.source) ;
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.
902 [ GLOB . : $(LICENSE).txt ]
904 dist.license = $(dist.license:D=)
905 [ GLOB [ .path .. .. .. ] : $(LICENSE).txt ]
906 [ GLOB [ .path .. boost ] : $(LICENSE).txt ] ;
908 [ GLOB . : *.png *.css *.html ]
910 dist.docs = $(dist.docs:D=)
911 [ GLOB [ .path images ] : *.png ]
912 [ GLOB [ .path jam ] : *.html ]
917 dist.source = $(dist.source:D=)
920 build.jam build.bat build.sh build_vms.com
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 ] : * ]
942 $(dist.bin:S=$(bjam.exe:S))
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 ] ;
954 case 7z* : zip += a -r -tzip -mx=9 ;
955 case zip : zip += -9r ;
957 actions piecemeal "[PACK]" {
958 "$(zip)" "$(<)" "$(>)"
960 actions piecemeal "[ZIP]" {
961 "$(zip)" "$(<)" "$(>)"
963 actions piecemeal "[COPY]" {
964 copy /Y "$(>)" "$(<)" >NUL:
969 tar ?= [ GLOB $(PATH) : star bsdtar tar ] ;
973 case star : tar += -c artype=pax -D -d -to-stdout ;
974 case * : tar += -c -f - ;
977 "$(tar)" "$(>)" | gzip -c9 > "$(<)"
979 #~ actions "[PACK]" {
980 #~ tar cf "$(<:S=.tar)" "$(>)"
983 gzip -c9 "$(>)" > "$(<)"
986 cp -Rpf "$(>)" "$(<)"
990 # The single binary, compressed.
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) ; }
1005 # Package some file.
1006 rule .package ( dst-dir : src-files + )
1009 local src-files-actual ;
1010 for local src-path in $(src-files)
1012 if ! [ GLOB $(src-path:P) : $(src-path:B) ] || [ CHECK_IF_FILE $(src-path) ]
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) = ".."
1019 src-file = $(src-file:D=) ;
1021 dst-files += $(src-file:R=$(dst-dir)) ;
1022 src-files-actual += $(src-path) ;
1027 if $(OS) = NT { pack = $(dst-dir).zip ; }
1028 if $(UNIX) = true { pack = $(dst-dir).tgz ; }
1030 DEPENDS dist : $(pack) ;
1031 DEPENDS $(pack) : $(dst-files) ;
1033 local dst-files-queue = $(dst-files) ;
1034 for local src-path in $(src-files-actual)
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) ;
1041 "[COPY]" $(dst-file) : $(src-path) ;
1042 .clean $(dst-file) ;
1045 "[PACK]" $(pack) : $(dst-files) ;
1050 rpm-tool = [ GLOB $(PATH) : "rpmbuild" ] ;
1051 rpm-tool ?= [ GLOB $(PATH) : "rpm" ] ;
1052 rpm-tool = $(rpm-tool[1]) ;
1053 rule .rpm ( name : source )
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 ;
1067 local target = $(name)-rpm ;
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 ;
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: //'` .
1088 # The distribution targets. Do not bother with them unless this is a
1089 # distribution build.
1093 .package $(NAME)-$(VERSION) : $(dist.source) ;
1094 .package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ;
1097 #~ .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ;