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=/)" ; } }
27 # Info about what we are building.
30 VERSION = $(_VERSION_:J=$(.)) ;
32 LICENSE = LICENSE_1_0 ;
34 # Generate development debug binaries?
40 if --profile in $(ARGV)
45 # Attempt to generate and/or build the grammar?
46 if --grammar in $(ARGV)
51 # Do we need to add a default build type argument?
52 if ! ( --release in $(ARGV) ) &&
53 ! ( --debug in $(ARGV) ) &&
54 ! ( --profile in $(ARGV) )
59 # Enable, and configure, Python hooks.
61 python-location = [ MATCH --with-python=(.*) : $(ARGV) ] ;
70 --python-include = [ .path $(python-location) include ] ;
72 for local v in 27 26 25 24 23 22
75 [ GLOB [ .path $(python-location) libs ] : "python$(v).lib" ]
76 [ GLOB $(python-location) [ .path $(python-location) libs ]
77 $(Path) $(PATH) $(path) : "python$(v).dll" ]
79 if ! $(--python-lib[2])
84 --python-lib = $(--python-lib[1]) ;
86 else if $(OS) = MACOSX
88 --python-include = [ .path $(python-location) Headers ] ;
89 --python-lib = $(python-location) Python ;
95 for local v in 2.7 2.6 2.5 2.4 2.3 2.2
97 local inc = [ GLOB [ .path $(python-location) include ] : python$(v) ] ;
98 local lib = [ GLOB [ .path $(python-location) lib ] : libpython$(v)* ] ;
101 --python-include ?= $(inc) ;
102 --python-lib ?= $(lib[1]:D) python$(v) ;
115 --extra-include += [ .path [ PWD ] "boehm_gc" "include" ] ;
125 --extra-include += [ .path [ PWD ] "duma" ] ;
128 # An explicit root for the toolset? (trim spaces)
129 toolset-root = [ MATCH --toolset-root=(.*) : $(ARGV) ] ;
131 local t = [ MATCH "[ ]*(.*)" : $(toolset-root:J=" ") ] ;
135 t = [ MATCH "([^ ]+)([ ]*)(.*)" : $(t) ] ;
136 toolset-root += $(t[1]) ;
137 if $(t[3]) { toolset-root += $(t[2]) ; }
140 toolset-root = $(toolset-root:J="") ;
143 # Configure the implemented toolsets. These are minimal commands and options to
144 # compile the full Jam. When adding new toolsets make sure to add them to the
147 rule toolset ( name command .type ? : opt.out + : opt.define * : flags * : linklibs * )
150 tool.$(name)$(.type).cc ?= $(command) ;
151 tool.$(name)$(.type).opt.out ?= $(opt.out) ;
152 tool.$(name)$(.type).opt.define ?= $(opt.define) ;
153 tool.$(name)$(.type).flags ?= $(flags) ;
154 tool.$(name)$(.type).linklibs ?= $(linklibs) ;
155 if ! $(name) in $(toolsets) { toolsets += $(name) ; }
158 rule if-os ( os + : yes-opt * : no-opt * )
159 { if $(os) in $(OS) { return $(yes-opt) ; } else { return $(no-opt) ; } }
161 rule opt ( type : yes-opt * : no-opt * )
162 { if $(type) in $(ARGV) { return $(yes-opt) ; } else { return $(no-opt) ; } }
164 ## HP-UX aCC compiler
165 toolset acc cc : "-o " : -D
167 [ opt --release : -s -O3 ]
168 [ opt --debug : -g -pg ]
169 -I$(--python-include) -I$(--extra-include)
170 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
172 toolset borland bcc32 : -e -n : /D
173 : -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib"
174 [ opt --release : -O2 -vi -w-inl ]
175 [ opt --debug : -v -Od -vi- ]
176 -I$(--python-include) -I$(--extra-include)
177 : $(--python-lib[1]) ;
179 if ! $(CC) { CC = cc ; }
180 toolset cc $(CC) : "-o " : -D
182 [ opt --release : -s -O ]
184 -I$(--python-include) -I$(--extra-include)
185 : $(LIBS) -L$(--python-lib[1]) -l$(--python-lib[2]) ;
187 toolset como como : "-o " : -D
189 [ opt --release : --inlining ]
190 [ opt --debug : --no_inlining ]
191 -I$(--python-include) -I$(--extra-include)
192 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
194 toolset clang clang : "-o " : -D
195 : -Wno-unused -Wno-format
196 [ opt --release : -Os ]
197 [ opt --debug : -g -O0 -fno-inline ]
198 [ opt --profile : -finline-functions -g ]
199 -I$(--python-include) -I$(--extra-include)
200 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
201 ## MacOSX Darwin, using GCC 2.9.x, 3.x
202 toolset darwin cc : "-o " : -D
204 [ opt --release : -Wl,-x -O3 -finline-functions ]
205 [ opt --debug : -g -O0 -fno-inline -pg ]
206 [ opt --profile : -Wl,-x -O3 -finline-functions -g -pg ]
207 -I$(--python-include) -I$(--extra-include)
208 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
210 toolset gcc gcc : "-o " : -D
211 : -pedantic -fno-strict-aliasing
212 [ opt --release : [ opt --symbols : -g : -s ] -O3 ]
213 [ opt --debug : -g -O0 -fno-inline ]
214 [ opt --profile : -O3 -g -pg ]
215 -I$(--python-include) -I$(--extra-include) -Wno-long-long
216 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
217 ## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll
218 toolset gcc-nocygwin gcc : "-o " : -D
220 [ opt --release : -finline-functions ]
221 [ opt --debug : -s -O3 -fno-inline -pg ]
222 -I$(--python-include) -I$(--extra-include)
223 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
224 ## Intel C/C++ for Darwin
225 toolset intel-darwin icc : "-o " : -D
227 [ opt --release : -O3 ]
228 [ opt --debug : -g -O0 -p ]
229 -I$(--python-include) -I$(--extra-include)
230 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
231 ## Intel C/C++ for Linux
232 toolset intel-linux icc : "-o " : -D
234 [ opt --release : -Xlinker -s -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 Win32
239 toolset intel-win32 icl : /Fe : -D
241 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /GB ]
242 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 ]
243 -I$(--python-include) -I$(--extra-include)
244 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
246 toolset kcc KCC : "-o " : -D
248 [ opt --release : -s +K2 ]
249 [ opt --debug : -g +K0 ]
250 -I$(--python-include) -I$(--extra-include)
251 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
253 toolset kylix bc++ : -o : -D
255 [ opt --release : -O2 -vi -w-inl ]
256 [ opt --debug : -v -Od -vi- ]
257 -I$(--python-include) -I$(--extra-include)
258 : -L$(--python-lib[1]) -l$(--python-lib[2]) ;
259 ## Metrowerks CodeWarrior 8.x
261 # Even though CW can compile all files at once, it crashes if it tries in
263 local mwcc ; if $(OS) != NT { mwcc = mwc$(OSPLAT:L) ; }
265 toolset metrowerks $(mwcc) : "-o " : -D
266 : -c -lang c -subsystem console -cwd include
267 [ opt --release : -runtime ss -opt full -inline all ]
268 [ opt --debug : -runtime ssd -opt none -inline off ]
269 -I$(--python-include) -I$(--extra-include) ;
270 toolset metrowerks $(mwcc) .link : "-o " :
271 : -subsystem console -lkernel32.lib -ladvapi32.lib -luser32.lib
272 [ opt --release : -runtime ss ]
273 [ opt --debug : -runtime ssd ]
274 : $(--python-lib[1]) ;
277 toolset mingw gcc : "-o " : -D
279 [ opt --release : -s -O3 -finline-functions ]
280 [ opt --debug : -g -O0 -fno-inline -pg ]
281 -I$(--python-include) -I$(--extra-include)
282 : $(--python-lib[2]) ;
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 -Ofast -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]) ;
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 ] ;
346 ## Microsoft Visual C++ .NET 7.x
347 toolset vc7 cl : /Fe /Fe /Fd /Fo : -D
349 [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
350 [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ]
351 -I$(--python-include) -I$(--extra-include)
352 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
353 ## Microsoft Visual C++ 2005
354 toolset vc8 cl : /Fe /Fe /Fd /Fo : -D
356 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
357 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
358 -I$(--python-include) -I$(--extra-include)
359 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
360 ## Microsoft Visual C++ 2008
361 toolset vc9 cl : /Fe /Fe /Fd /Fo : -D
363 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
364 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
365 -I$(--python-include) -I$(--extra-include)
366 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
367 ## Microsoft Visual C++ 2010
368 toolset vc10 cl : /Fe /Fe /Fd /Fo : -D
370 [ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
371 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
372 -I$(--python-include) -I$(--extra-include)
373 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
374 ## Microsoft Visual C++ 2012
375 toolset vc11 cl : /Fe /Fe /Fd /Fo : -D
377 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
378 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
379 -I$(--python-include) -I$(--extra-include)
380 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
381 ## Microsoft Visual C++ 2013
382 toolset vc12 cl : /Fe /Fe /Fd /Fo : -D
384 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
385 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
386 -I$(--python-include) -I$(--extra-include)
387 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
388 toolset vc14 cl : /Fe /Fe /Fd /Fo : -D
390 [ opt --release : /GL /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
391 [ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
392 -I$(--python-include) -I$(--extra-include)
393 : kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
395 # First set the build commands and options according to the
397 toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
400 # For some reason, the following test does not catch empty toolset.
402 ECHO "###" No toolset specified. Please use --toolset option. ;
404 ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
407 if ! $(toolset) in $(toolsets)
410 ECHO "###" Unknown toolset: $(toolset) ;
412 ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
415 --cc = $(tool.$(toolset).cc) ;
416 if $(tool.$(toolset).opt.out[2])
418 if $(tool.$(toolset).opt.out[1]) = $(tool.$(toolset).opt.out[2])
420 --out = $(tool.$(toolset).opt.out[1]) ;
421 --dir = $(tool.$(toolset).opt.out[3-]) ;
425 --bin = $(tool.$(toolset).opt.out[1]) ;
426 --dir = $(tool.$(toolset).opt.out[2-]) ;
431 --out = $(tool.$(toolset).opt.out) ;
433 --def = $(tool.$(toolset).opt.define) ;
434 --flags = $(tool.$(toolset).flags) ;
435 --defs = $(tool.$(toolset).defines) ;
436 --libs = $(tool.$(toolset).linklibs) ;
437 if $(tool.$(toolset).link.cc)
439 --link = $(tool.$(toolset).link.cc) ;
440 if $(tool.$(toolset).link.opt.out[2])
442 if $(tool.$(toolset).link.opt.out[1]) = $(tool.$(toolset).link.opt.out[2])
444 --link-out = $(tool.$(toolset).link.opt.out[1]) ;
445 --link-dir = $(tool.$(toolset).link.opt.out[3-]) ;
449 --link-bin = $(tool.$(toolset).link.opt.out[1]) ;
450 --link-dir = $(tool.$(toolset).link.opt.out[2-]) ;
455 --link-out = $(tool.$(toolset).link.opt.out) ;
457 --link-def = $(tool.$(toolset).link.opt.define) ;
458 --link-flags = $(tool.$(toolset).link.flags) ;
459 --link-defs = $(tool.$(toolset).link.defines) ;
460 --link-libs = $(tool.$(toolset).link.linklibs) ;
463 # Put executables in platform-specific subdirectory.
464 locate-target = $(LOCATE_TARGET) ;
467 locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
468 platform = $(OS:L)$(OSPLAT:L) ;
472 locate-target ?= bin$(.)$(OS:L) ;
477 locate-target = [ .path $(locate-target)$(.)debug ] ;
481 locate-target = [ .path $(locate-target)$(.)profile ] ;
485 locate-target = [ .path $(locate-target) ] ;
488 if --show-locate-target in $(ARGV)
490 ECHO $(locate-target) ;
493 # We have some different files for UNIX, and NT.
495 command.c compile.c constants.c debug.c execcmd.c frames.c function.c glob.c
496 hash.c hcache.c headers.c hdrmacro.c jam.c jambase.c jamgram.c lists.c
497 make.c make1.c mem.c object.c option.c output.c parse.c pathsys.c regexp.c
498 rules.c scan.c search.c subst.c w32_getreg.c timestamp.c variable.c
499 modules.c strings.c filesys.c builtins.c class.c cwd.c native.c md5.c
500 [ .path modules set.c ] [ .path modules path.c ] [ .path modules regex.c ]
501 [ .path modules property-set.c ] [ .path modules sequence.c ] [ .path modules order.c ] ;
504 jam.source += execnt.c filent.c pathnt.c ;
508 jam.source += execunix.c fileunix.c pathunix.c ;
511 # Debug assertions, or not.
512 if ! $(debug) || --noassert in $(ARGV)
517 # Enable some optional features.
518 --defs += OPT_HEADER_CACHE_EXT ;
519 --defs += OPT_GRAPH_DEBUG_EXT ;
520 --defs += OPT_SEMAPHORE ;
521 --defs += OPT_AT_FILES ;
522 --defs += OPT_DEBUG_PROFILE ;
525 --defs += OPT_FIX_TARGET_VARIABLES_EXT ;
526 #~ --defs += OPT_NO_EXTERNAL_VARIABLE_SPLIT ;
529 --defs += OPT_IMPROVED_PATIENCE_EXT ;
531 # Use Boehm GC memory allocator?
534 --defs += OPT_BOEHM_GC ;
546 if ( $(OS) = NT ) && ! NT in $(--defs)
550 --defs += YYSTACKSIZE=5000 ;
554 --defs += HAVE_PYTHON ;
559 --defs += BJAM_NEWSTR_NO_ALLOCATE ;
563 # The basic symbolic targets...
564 NOTFILE all clean dist ;
567 # Utility rules and actions...
570 [DELETE] clean : $(<) ;
572 if $(OS) = NT { actions piecemeal together existing [DELETE] {
575 if $(UNIX) = true { actions piecemeal together existing [DELETE] {
579 --chmod+w = "attrib -r " ;
582 --chmod+w = "chmod +w " ;
588 if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
589 if ! $(md<$(<)>) { [MKDIR] $(<) ; md<$(<)> = - ; }
591 if $(OS) = NT { actions [MKDIR] {
594 if $(UNIX) = true { actions [MKDIR] {
601 if $(OS) = NT || ( $(UNIX) = true && $(OS) = CYGWIN ) { exe = $(exe:S=.exe) ; }
602 LOCATE on $(exe) = $(locate-target) ;
603 DEPENDS all : $(exe) ;
604 .mkdir $(locate-target) ;
610 # Translate any subdir elements into a simple file name.
611 local o = [ MATCH "([^/]+)[/]?(.+)" : $(s) ] ;
615 LOCATE on $(o) = $(locate-target) ;
616 DEPENDS $(exe) : $(o) ;
617 DEPENDS $(o) : $(s) ;
618 DEPENDS $(o) : $(locate-target) ;
619 [COMPILE] $(o) : $(s) ;
622 DEPENDS $(exe) : $(objs) ;
623 DEPENDS $(exe) : $(locate-target) ;
624 [COMPILE.LINK] $(exe) : $(objs) ;
629 DEPENDS $(exe) : $(>) ;
630 DEPENDS $(exe) : $(locate-target) ;
631 [COMPILE] $(exe) : $(>) ;
636 if ! $(--def[2]) { actions [COMPILE] {
637 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def)$(--defs)" "$(--flags)" "$(>)" "$(--libs)"
639 else { actions [COMPILE] {
640 "$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def[1])$(--defs:J=$(--def[2]))$(--def[3])" "$(--flags)" "$(>)" "$(--libs)"
643 actions [COMPILE.LINK] {
644 "$(--link)" "$(--link-bin)$(<:D=)" "$(--link-dir)$(<:D)$(./)" "$(--link-out)$(<)" "$(--link-def)$(--link-defs)" "$(--link-flags)" "$(>)" "$(--link-libs)"
650 DEPENDS $(<) : $(>) ;
654 if $(OS) = NT { actions [LINK] {
657 if $(UNIX) = true { actions [LINK] {
664 DEPENDS $(<) : $(>) ;
669 # Will be redefined later.
677 DEPENDS $(<) : $(>) ;
680 if $(OS) = NT { actions [MOVE] {
684 if $(UNIX) = true { actions [MOVE] {
688 # Generate the grammar tokens table, and the real yacc grammar.
691 local exe = [ .exe yyacc : yyacc.c ] ;
693 DEPENDS $(<) : $(exe) $(>) ;
695 yyacc.exe on $(<) = $(exe:R=$(locate-target)) ;
696 [YYACC] $(<) : $(>) ;
701 "$(yyacc.exe)" "$(<)" "$(>)"
705 .yyacc jamgram.y jamgramtab.h : jamgram.yy ;
709 .exe yyacc : yyacc.c ;
712 # How to build the grammar.
716 # try some other likely spellings...
722 yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ;
723 yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ;
724 yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin"
725 "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ;
729 case bison : yacc += -d --yacc ;
730 case yacc : yacc += -d ;
732 if $(debug) && $(yacc)
736 yacc += $(YACCFLAGS) ;
740 DEPENDS $(<) : $(>) ;
744 if $(OS) = NT { actions [YACC] {
746 if not errorlevel 1 (
748 rename y.tab$(<[1]:S) "$(<[1])"
750 rename y.tab$(<[2]:S) "$(<[2])"
753 if $(UNIX) = true { actions [YACC] {
754 if ` "$(yacc)" "$(>)" ` ; then
755 mv -f y.tab$(<[1]:S) "$(<[1])"
756 mv -f y.tab$(<[2]:S) "$(<[2])"
761 if $(grammar) && ! $(yacc)
763 EXIT Could not find the 'yacc' tool, and therefore can not build the
766 if $(grammar) && $(yacc)
768 .yacc jamgram.c jamgram.h : jamgram.y ;
771 # How to build the compiled in jambase.
774 local exe = [ .exe mkjambase : mkjambase.c ] ;
775 DEPENDS $(<) : $(exe) $(>) ;
777 mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
778 [MKJAMBASE] $(<) : $(>) ;
780 actions [MKJAMBASE] {
782 $(mkjambase.exe) "$(<)" "$(>)"
786 .mkjambase jambase.c : Jambase ;
792 $(>).exe = [ .exe $(>) : $(jam.source) ] ;
793 DEPENDS all : $($(>).exe) ;
795 # Make a copy under the old name.
796 $(<).exe = $(<:S=$($(>).exe:S)) ;
797 LOCATE on $($(<).exe) = $(locate-target) ;
798 .copy $($(<).exe) : $($(>).exe) ;
799 DEPENDS all : $($(<).exe) ;
804 # Scan sources for header dependencies.
806 # In order to keep things simple, we made a slight compromise here - we only
807 # detect changes in headers included relative to the current folder as opposed
808 # to those included from somewhere on the include path.
809 rule .scan ( targets + )
811 HDRRULE on $(targets) = .hdr.scan ;
812 HDRSCAN on $(targets) = "^[ \t]*#[ \t]*include[ \t]*\"([^\"]*)\".*$" ;
814 rule .hdr.scan ( target : includes * : binding )
816 local target-path = [ NORMALIZE_PATH $(binding:D) ] ;
817 # Extra grist provides target name uniqueness when referencing same name
818 # header files from different folders.
819 local include-targets = <$(target-path)>$(includes) ;
820 NOCARE $(include-targets) ;
821 INCLUDES $(target) : $(include-targets) ;
822 SEARCH on $(include-targets) = $(target-path) ;
823 ISFILE $(include-targets) ;
824 .scan $(include-targets) ;
826 .scan $(jam.source) ;
829 # Distribution making from here on out. Assumes that the docs are already built
830 # as HTML at ../doc/html. Otherwise they will not be included in the built
831 # distribution archive.
833 [ GLOB . : $(LICENSE).txt ]
835 dist.license = $(dist.license:D=)
836 [ GLOB [ .path .. .. .. ] : $(LICENSE).txt ]
837 [ GLOB [ .path .. boost ] : $(LICENSE).txt ] ;
839 [ GLOB . : *.png *.css *.html ]
841 dist.docs = $(dist.docs:D=)
842 [ GLOB [ .path images ] : *.png ]
843 [ GLOB [ .path jam ] : *.html ]
848 dist.source = $(dist.source:D=)
851 build.jam build.bat build.sh
854 [ .path modules set.c ]
855 [ .path modules path.c ]
856 [ .path modules regex.c ]
857 [ .path modules property-set.c ]
858 [ .path modules sequence.c ]
859 [ .path modules order.c ]
860 [ GLOB [ .path boehm_gc ] : * ]
861 [ GLOB [ .path boehm_gc include ] : * ]
862 [ GLOB [ .path boehm_gc include private ] : * ]
863 [ GLOB [ .path boehm_gc cord ] : * ]
864 [ GLOB [ .path boehm_gc Mac_files ] : * ]
865 [ GLOB [ .path boehm_gc tests ] : * ]
866 [ GLOB [ .path boehm_gc doc ] : * ]
873 $(dist.bin:S=$(bjam.exe:S))
878 zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7z.exe" ] ;
879 zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7zn.exe" ] ;
880 zip ?= [ GLOB $(PATH) : zip.exe ] ;
885 case 7z* : zip += a -r -tzip -mx=9 ;
886 case zip : zip += -9r ;
888 actions piecemeal [PACK] {
889 "$(zip)" "$(<)" "$(>)"
891 actions piecemeal [ZIP] {
892 "$(zip)" "$(<)" "$(>)"
894 actions piecemeal [COPY] {
895 copy /Y "$(>)" "$(<)" >NUL:
900 tar ?= [ GLOB $(PATH) : star bsdtar tar ] ;
904 case star : tar += -c artype=pax -D -d -to-stdout ;
905 case * : tar += -c -f - ;
908 "$(tar)" "$(>)" | gzip -c9 > "$(<)"
911 #~ tar cf "$(<:S=.tar)" "$(>)"
914 gzip -c9 "$(>)" > "$(<)"
917 cp -Rpf "$(>)" "$(<)"
921 # The single binary, compressed.
925 if $(OS) = NT { zip = $($(<).exe:S=.zip) ; }
926 if $(UNIX) = true { zip = $($(<).exe:S=.tgz) ; }
927 zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ;
928 DEPENDS $(zip) : $($(<).exe) ;
929 DEPENDS dist : $(zip) ;
930 #~ LOCATE on $(zip) = $(locate-target) ;
931 if $(OS) = NT { [ZIP] $(zip) : $($(<).exe) ; }
932 if $(UNIX) = true { [PACK] $(zip) : $($(<).exe) ; }
937 rule .package ( dst-dir : src-files + )
940 local src-files-actual ;
941 for local src-path in $(src-files)
943 if ! [ GLOB $(src-path:P) : $(src-path:B) ] || [ CHECK_IF_FILE $(src-path) ]
945 local src-subdir = $(src-path:D) ;
946 local src-file = $(src-path) ;
947 while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; }
948 if $(src-subdir) = ".."
950 src-file = $(src-file:D=) ;
952 dst-files += $(src-file:R=$(dst-dir)) ;
953 src-files-actual += $(src-path) ;
958 if $(OS) = NT { pack = $(dst-dir).zip ; }
959 if $(UNIX) = true { pack = $(dst-dir).tgz ; }
961 DEPENDS dist : $(pack) ;
962 DEPENDS $(pack) : $(dst-files) ;
964 local dst-files-queue = $(dst-files) ;
965 for local src-path in $(src-files-actual)
967 local dst-file = $(dst-files-queue[1]) ;
968 dst-files-queue = $(dst-files-queue[2-]) ;
969 DEPENDS $(dst-file) : $(src-path) $(dst-file:D) ;
970 .mkdir $(dst-file:D) ;
972 [COPY] $(dst-file) : $(src-path) ;
976 [PACK] $(pack) : $(dst-files) ;
981 rpm-tool = [ GLOB $(PATH) : "rpmbuild" ] ;
982 rpm-tool ?= [ GLOB $(PATH) : "rpm" ] ;
983 rpm-tool = $(rpm-tool[1]) ;
984 rule .rpm ( name : source )
989 case X86 : rpm-arch ?= i386 ;
990 case PPC : rpm-arch ?= ppc ;
991 case AXP : rpm-arch ?= alpha ;
992 # no guaranty for these:
993 case IA64 : rpm-arch ?= ia64 ;
994 case ARM : rpm-arch ?= arm ;
995 case SPARC : rpm-arch ?= sparc ;
996 case * : rpm-arch ?= other ;
998 local target = $(name)-rpm ;
1000 DEPENDS dist : $(target) ;
1001 DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ;
1002 DEPENDS $(name).$(rpm-arch).rpm : $(source) ;
1003 DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ;
1004 docs on $(target) = $(dist.docs:J=" ") ;
1005 arch on $(target) = $(rpm-arch) ;
1006 if $(rpm-arch) = ppc { target-opt on $(target) = --target= ; }
1007 else { target-opt on $(target) = "--target " ; }
1008 [RPM] $(target) : $(source) ;
1009 .clean $(name).$(rpm-arch).rpm $(name).src.rpm ;
1013 export BOOST_JAM_TOOLSET="$(toolset)"
1014 $(rpm-tool) -ta $(target-opt)$(arch) $(>) | tee rpm.out
1015 cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` .
1019 # The distribution targets. Do not bother with them unless this is a
1020 # distribution build.
1024 .package $(NAME)-$(VERSION) : $(dist.source) ;
1025 .package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ;
1028 #~ .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ;