1 | #~ Copyright 2002-2005 Rene Rivera. |
---|
2 | #~ Distributed under the Boost Software License, Version 1.0. |
---|
3 | #~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) |
---|
4 | |
---|
5 | # Platform related specifics. |
---|
6 | if $(NT) { rule .path { return "$(<:J=\\)" ; } } |
---|
7 | else if $(OS2) { rule .path { return "$(<:J=\\)" ; } } |
---|
8 | else if $(VMS) { rule .path { return "[.$(<:J=/)]" ; } } |
---|
9 | else if $(MAC) { rule .path { return ":$(<:J=\:)" ; } } |
---|
10 | else { rule .path { return "$(<:J=/)" ; } } |
---|
11 | if $(VMS) { . = "_" ; } |
---|
12 | else { . = "." ; } |
---|
13 | |
---|
14 | # Info about what we are building. |
---|
15 | NAME = boost-jam ; |
---|
16 | VERSION = 3$(.)1$(.)11 ; |
---|
17 | RELEASE = 1 ; |
---|
18 | LICENSE = 1_0 ; |
---|
19 | |
---|
20 | HAVE_PYTHON = 0 ; |
---|
21 | PYTHON_INCUDES = /usr/include/python2.3 ; |
---|
22 | PYTHON_LIB = -lpython2.3 ; |
---|
23 | |
---|
24 | |
---|
25 | # Generate development debug binaries? |
---|
26 | if --debug in $(ARGV) |
---|
27 | { |
---|
28 | debug = true ; |
---|
29 | } |
---|
30 | |
---|
31 | # Attempt to generate and/or build the grammar? |
---|
32 | if --grammar in $(ARGV) |
---|
33 | { |
---|
34 | grammar = true ; |
---|
35 | } |
---|
36 | |
---|
37 | # Do we need to add a default build type argument? |
---|
38 | if ! ( --release in $(ARGV) ) && |
---|
39 | ! ( --debug in $(ARGV) ) |
---|
40 | { |
---|
41 | ARGV += --release ; |
---|
42 | } |
---|
43 | |
---|
44 | # An explicit root for the toolset? (trim spaces) |
---|
45 | toolset-root = [ MATCH --toolset-root=(.*) : $(ARGV) ] ; |
---|
46 | { |
---|
47 | local t = [ MATCH "[ ]*(.*)" : $(toolset-root:J=" ") ] ; |
---|
48 | toolset-root = ; |
---|
49 | while $(t) |
---|
50 | { |
---|
51 | t = [ MATCH "([^ ]+)([ ]*)(.*)" : $(t) ] ; |
---|
52 | toolset-root += $(t[1]) ; |
---|
53 | if $(t[3]) { toolset-root += $(t[2]) ; } |
---|
54 | t = $(t[3]) ; |
---|
55 | } |
---|
56 | toolset-root = $(toolset-root:J="") ; |
---|
57 | } |
---|
58 | |
---|
59 | # Configure the implemented toolsets. These are minimal |
---|
60 | # commands and options to compile the full Jam. When |
---|
61 | # adding new toolsets make sure to add them to the |
---|
62 | # "known" list also. |
---|
63 | rule toolset ( name command .type ? : opt.out + : opt.define * : flags * : linklibs * ) |
---|
64 | { |
---|
65 | .type ?= "" ; |
---|
66 | tool.$(name)$(.type).cc ?= $(command) ; |
---|
67 | tool.$(name)$(.type).opt.out ?= $(opt.out) ; |
---|
68 | tool.$(name)$(.type).opt.define ?= $(opt.define) ; |
---|
69 | tool.$(name)$(.type).flags ?= $(flags) ; |
---|
70 | tool.$(name)$(.type).linklibs ?= $(linklibs) ; |
---|
71 | if ! $(name) in $(toolsets) { toolsets += $(name) ; } |
---|
72 | } |
---|
73 | rule opt ( type : yes-opt * : no-opt * ) { if $(type) in $(ARGV) { return $(yes-opt) ; } else { return $(no-opt) ; } } |
---|
74 | ## HP-UX aCC compiler |
---|
75 | toolset acc cc : "-o " : -D |
---|
76 | : -Ae |
---|
77 | [ opt --release : -s -O3 ] |
---|
78 | [ opt --debug : -g -pg ] ; |
---|
79 | ## Borland C++ 5.5.x |
---|
80 | toolset borland bcc32 : -e -n : /D |
---|
81 | : -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib" |
---|
82 | [ opt --release : -O2 -vi -w-inl ] |
---|
83 | [ opt --debug : -v -Od -vi- ] ; |
---|
84 | ## Generic Unix cc |
---|
85 | if ! $(CC) { CC = cc ; } |
---|
86 | toolset cc $(CC) : "-o " : -D |
---|
87 | : $(CFLAGS) |
---|
88 | [ opt --release : -s -O ] |
---|
89 | [ opt --debug : -g ] |
---|
90 | : $(LIBS) ; |
---|
91 | ## Comeau C/C++ 4.x |
---|
92 | toolset como como : "-o " : -D |
---|
93 | : --c |
---|
94 | [ opt --release : --inlining ] |
---|
95 | [ opt --debug : --no_inlining ] ; |
---|
96 | ## MacOSX Darwin, using GCC 2.9.x, 3.x |
---|
97 | toolset darwin cc : "-o " : -D |
---|
98 | : |
---|
99 | [ opt --release : -Wl,-x -O3 -finline-functions ] |
---|
100 | [ opt --debug : -g -O0 -fno-inline -pg ] ; |
---|
101 | ## GCC 2.x, 3.x |
---|
102 | toolset gcc gcc : "-o " : -D |
---|
103 | : -pedantic |
---|
104 | [ opt --release : [ opt --symbols : -g : -s ] -O3 -finline-functions ] |
---|
105 | [ opt --debug : -g -O0 -fno-inline ] ; |
---|
106 | ## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll |
---|
107 | toolset gcc-nocygwin gcc : "-o " : -D |
---|
108 | : -s -O3 -mno-cygwin |
---|
109 | [ opt --release : -finline-functions ] |
---|
110 | [ opt --debug : -s -O3 -fno-inline -pg ] ; |
---|
111 | ## Intel C/C++ for Linux |
---|
112 | toolset intel-linux icc : "-o " : -D |
---|
113 | : |
---|
114 | [ opt --release : -Xlinker -s -O3 ] |
---|
115 | [ opt --debug : -g -O0 -p ] ; |
---|
116 | ## Intel C/C++ for Win32 |
---|
117 | toolset intel-win32 icl : /Fe : -D |
---|
118 | : /nologo |
---|
119 | [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ] |
---|
120 | [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] ; |
---|
121 | ## KCC ? |
---|
122 | toolset kcc KCC : "-o " : -D |
---|
123 | : |
---|
124 | [ opt --release : -s +K2 ] |
---|
125 | [ opt --debug : -g +K0 ] ; |
---|
126 | ## Borland Kylix |
---|
127 | toolset kylix bc++ : -o : -D |
---|
128 | : -tC -q |
---|
129 | [ opt --release : -O2 -vi -w-inl ] |
---|
130 | [ opt --debug : -v -Od -vi- ] ; |
---|
131 | ## Metrowerks CodeWarrior 8.x |
---|
132 | { |
---|
133 | # Even though CW can compile all files at once, it crashes if it tries in the bjam case. |
---|
134 | local mwcc = ; if $(NT) { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; } |
---|
135 | mwcc ?= mwcc ; |
---|
136 | toolset metrowerks $(mwcc) : "-o " : -D |
---|
137 | : -c -lang c -subsystem console -cwd include |
---|
138 | [ opt --release : -runtime ss -opt full -inline all ] |
---|
139 | [ opt --debug : -runtime ssd -opt none -inline off ] ; |
---|
140 | toolset metrowerks $(mwcc) .link : "-o " : |
---|
141 | : -subsystem console -ladvapi32.lib |
---|
142 | [ opt --release : -runtime ss ] |
---|
143 | [ opt --debug : -runtime ssd ] ; |
---|
144 | } |
---|
145 | ## MINGW GCC |
---|
146 | toolset mingw gcc : "-o " : -D |
---|
147 | : |
---|
148 | [ opt --release : -s -O3 -finline-functions ] |
---|
149 | [ opt --debug : -g -O0 -fno-inline -pg ] ; |
---|
150 | ## MIPS Pro |
---|
151 | toolset mipspro cc : "-o " : -D |
---|
152 | : |
---|
153 | [ opt --release : -s -O3 -g0 -INLINE:none ] |
---|
154 | [ opt --debug : -g -O0 -INLINE ] ; |
---|
155 | ## Microsoft Visual Studio C++ 6.x |
---|
156 | toolset msvc cl : /Fe : -D |
---|
157 | : /nologo |
---|
158 | [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ] |
---|
159 | [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] |
---|
160 | : kernel32.lib advapi32.lib ; |
---|
161 | ## QNX 6.x GCC 3.x/2.95.3 |
---|
162 | toolset qcc qcc : "-o " : -D |
---|
163 | : -pedantic |
---|
164 | [ opt --release : [ opt --symbols : -g : -s ] -O3 -finline-functions ] |
---|
165 | [ opt --debug : -g -O0 -fno-inline ] ; |
---|
166 | ## Sun Workshop 6 C++ |
---|
167 | toolset sunpro cc : "-o " : -D |
---|
168 | : |
---|
169 | [ opt --release : -s -fast -xO4 ] |
---|
170 | [ opt --debug : -g ] ; |
---|
171 | ## Compaq Alpha CXX |
---|
172 | toolset tru64cxx cc : "-o " : -D |
---|
173 | : |
---|
174 | [ opt --release : -s -O5 -inline speed ] |
---|
175 | [ opt --debug : -g -O0 -pg ] ; |
---|
176 | ## IBM VisualAge C++ |
---|
177 | toolset vacpp xlc : "-o " : -D |
---|
178 | : |
---|
179 | [ opt --release : -s -O3 -qstrict -qinline ] |
---|
180 | [ opt --debug : -g -qNOOPTimize -qnoinline -pg ] ; |
---|
181 | ## Microsoft Visual C++ .NET 7.x |
---|
182 | toolset vc7 cl : /Fe : -D |
---|
183 | : /nologo |
---|
184 | [ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ] |
---|
185 | [ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ] |
---|
186 | : kernel32.lib advapi32.lib ; |
---|
187 | ## VMS/OpenVMS DEC C |
---|
188 | toolset vmsdecc cc : /OBJECT= : "/DEFINES=(" "," ")" |
---|
189 | : /STANDARD=VAXC /PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES |
---|
190 | [ opt --release : /OPTIMIZE /NODEBUG ] |
---|
191 | [ opt --debug : /NOOPTIMIZE /DEBUG ] |
---|
192 | ; |
---|
193 | toolset vmsdecc link .link : /EXECUTABLE= : |
---|
194 | : /NOMAP |
---|
195 | [ opt --release : /NODEBUG ] |
---|
196 | [ opt --debug : /DEBUG ] |
---|
197 | ; |
---|
198 | |
---|
199 | # First set the build commands and options according to the |
---|
200 | # preset toolset. |
---|
201 | toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ; |
---|
202 | if ! $(toolset) |
---|
203 | { |
---|
204 | # For some reason, the following test does not catch |
---|
205 | # empty toolset. |
---|
206 | ECHO "###" ; |
---|
207 | ECHO "###" No toolset specified. Please use --toolset option. ; |
---|
208 | ECHO "###" ; |
---|
209 | ECHO "###" Known toolsets are: $(toolsets:J=", ") ; |
---|
210 | EXIT "###" ; |
---|
211 | } |
---|
212 | if ! $(toolset) in $(toolsets) |
---|
213 | { |
---|
214 | ECHO "###" ; |
---|
215 | ECHO "###" Unknown toolset: $(toolset) ; |
---|
216 | ECHO "###" ; |
---|
217 | ECHO "###" Known toolsets are: $(toolsets:J=", ") ; |
---|
218 | EXIT "###" ; |
---|
219 | } |
---|
220 | --cc = $(tool.$(toolset).cc) ; |
---|
221 | if $(tool.$(toolset).opt.out[2]) |
---|
222 | { |
---|
223 | --bin = $(tool.$(toolset).opt.out[1]) ; |
---|
224 | --dir = $(tool.$(toolset).opt.out[2]) ; |
---|
225 | } |
---|
226 | else |
---|
227 | { |
---|
228 | --out = $(tool.$(toolset).opt.out) ; |
---|
229 | } |
---|
230 | --def = $(tool.$(toolset).opt.define) ; |
---|
231 | --flags = $(tool.$(toolset).flags) ; |
---|
232 | --defs = $(tool.$(toolset).defines) ; |
---|
233 | --libs = $(tool.$(toolset).linklibs) ; |
---|
234 | if $(tool.$(toolset).link.cc) |
---|
235 | { |
---|
236 | --link = $(tool.$(toolset).link.cc) ; |
---|
237 | if $(tool.$(toolset).link.opt.out[2]) |
---|
238 | { |
---|
239 | --link-bin = $(tool.$(toolset).link.opt.out[1]) ; |
---|
240 | --link-dir = $(tool.$(toolset).link.opt.out[2]) ; |
---|
241 | } |
---|
242 | else |
---|
243 | { |
---|
244 | --link-out = $(tool.$(toolset).link.opt.out) ; |
---|
245 | } |
---|
246 | --link-def = $(tool.$(toolset).link.opt.define) ; |
---|
247 | --link-flags = $(tool.$(toolset).link.flags) ; |
---|
248 | --link-defs = $(tool.$(toolset).link.defines) ; |
---|
249 | --link-libs = $(tool.$(toolset).link.linklibs) ; |
---|
250 | } |
---|
251 | |
---|
252 | # Put executables in platform-specific subdirectory. |
---|
253 | locate-target = $(LOCATE_TARGET) ; |
---|
254 | if $(VMS) |
---|
255 | { |
---|
256 | locate-target ?= bin$(.)vms ; |
---|
257 | platform = vms ; |
---|
258 | } |
---|
259 | else if $(MAC) |
---|
260 | { |
---|
261 | locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ; |
---|
262 | platform = $(OS:L)$(OSPLAT:L) ; |
---|
263 | } |
---|
264 | else if $(OSPLAT) |
---|
265 | { |
---|
266 | locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ; |
---|
267 | platform = $(OS:L)$(OSPLAT:L) ; |
---|
268 | } |
---|
269 | else |
---|
270 | { |
---|
271 | locate-target ?= bin$(.)$(OS:L) ; |
---|
272 | platform = $(OS:L) ; |
---|
273 | } |
---|
274 | if $(debug) |
---|
275 | { |
---|
276 | locate-target = [ .path $(locate-target)$(.)debug ] ; |
---|
277 | } |
---|
278 | else |
---|
279 | { |
---|
280 | locate-target = [ .path $(locate-target) ] ; |
---|
281 | } |
---|
282 | |
---|
283 | if --show-locate-target in $(ARGV) |
---|
284 | { |
---|
285 | ECHO $(locate-target) ; |
---|
286 | } |
---|
287 | |
---|
288 | # We have some different files for UNIX, VMS, and NT. |
---|
289 | jam.source = |
---|
290 | command.c compile.c expand.c glob.c |
---|
291 | hash.c hcache.c headers.c hdrmacro.c |
---|
292 | jam.c jambase.c jamgram.c |
---|
293 | lists.c make.c make1.c newstr.c |
---|
294 | option.c parse.c regexp.c rules.c |
---|
295 | scan.c search.c subst.c |
---|
296 | timestamp.c variable.c modules.c strings.c filesys.c |
---|
297 | builtins.c pwd.c class.c native.c modules/set.c |
---|
298 | modules/path.c modules/regex.c modules/property-set.c |
---|
299 | modules/sequence.c modules/order.c |
---|
300 | ; |
---|
301 | if $(NT) |
---|
302 | { |
---|
303 | jam.source += execnt.c filent.c pathunix.c w32_getreg.c ; |
---|
304 | } |
---|
305 | else if $(OS2) |
---|
306 | { |
---|
307 | jam.source += execunix.c fileos2.c pathunix.c ; |
---|
308 | } |
---|
309 | else if $(VMS) |
---|
310 | { |
---|
311 | jam.source += execvms.c filevms.c pathvms.c ; |
---|
312 | } |
---|
313 | else if $(MAC) |
---|
314 | { |
---|
315 | jam.source += execmac.c filemac.c pathmac.c ; |
---|
316 | } |
---|
317 | else |
---|
318 | { |
---|
319 | jam.source += execunix.c fileunix.c pathunix.c ; |
---|
320 | } |
---|
321 | |
---|
322 | # Debug assertions, or not. |
---|
323 | if ! $(debug) || --noassert in $(ARGV) |
---|
324 | { |
---|
325 | --defs += NDEBUG ; |
---|
326 | } |
---|
327 | |
---|
328 | # Enable some optional features. |
---|
329 | --defs += OPT_HEADER_CACHE_EXT ; |
---|
330 | --defs += OPT_GRAPH_DEBUG_EXT ; |
---|
331 | --defs += OPT_SEMAPHORE ; |
---|
332 | |
---|
333 | # Bug fixes |
---|
334 | --defs += OPT_FIX_TARGET_VARIABLES_EXT ; |
---|
335 | #~ --defs += OPT_NO_EXTERNAL_VARIABLE_SPLIT ; |
---|
336 | |
---|
337 | # Improvements |
---|
338 | --defs += OPT_IMPROVED_PATIENCE_EXT ; |
---|
339 | |
---|
340 | if ( $(OS) = NT || $(NT) ) && ! NT in $(--defs) |
---|
341 | { |
---|
342 | --defs += NT ; |
---|
343 | } |
---|
344 | if $(VMS) |
---|
345 | { |
---|
346 | --defs += VMS ; |
---|
347 | } |
---|
348 | --defs += YYSTACKSIZE=5000 ; |
---|
349 | |
---|
350 | if $(HAVE_PYTHON) = 1 |
---|
351 | { |
---|
352 | --defs += HAVE_PYTHON ; |
---|
353 | --flags += -I$(PYTHON_INCUDES) ; |
---|
354 | --flags += -Wno-long-long ; |
---|
355 | --libs += $(PYTHON_LIB) ; |
---|
356 | } |
---|
357 | |
---|
358 | |
---|
359 | |
---|
360 | # The basic symbolic targets... |
---|
361 | NOTFILE all clean dist ; |
---|
362 | ALWAYS clean ; |
---|
363 | |
---|
364 | # Utility rules and actions... |
---|
365 | rule .clean |
---|
366 | { |
---|
367 | [DELETE] clean : $(<) ; |
---|
368 | } |
---|
369 | if $(NT) { actions piecemeal together existing [DELETE] { |
---|
370 | del /F /Q $(>) |
---|
371 | } } |
---|
372 | if $(UNIX) { actions piecemeal together existing [DELETE] { |
---|
373 | rm -f $(>) |
---|
374 | } } |
---|
375 | if $(VMS) { actions piecemeal together existing [DELETE] { |
---|
376 | DELETE $(>[--2]:J=";*, ") $(>[-1]);* |
---|
377 | } } |
---|
378 | if $(NT) { |
---|
379 | --chmod+w = "attrib -r " ; |
---|
380 | } |
---|
381 | if $(UNIX) { |
---|
382 | --chmod+w = "chmod +w " ; |
---|
383 | } |
---|
384 | if $(VMS) { |
---|
385 | --chmod+w = "SET FILE/PROT=(S:RWED) " ; |
---|
386 | } |
---|
387 | |
---|
388 | rule .mkdir |
---|
389 | { |
---|
390 | NOUPDATE $(<) ; |
---|
391 | if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; } |
---|
392 | if ! $(md<$(<)>) { [MKDIR] $(<) ; md<$(<)> = - ; } |
---|
393 | } |
---|
394 | if $(NT) { actions [MKDIR] { |
---|
395 | md $(<) |
---|
396 | } } |
---|
397 | if $(UNIX) { actions [MKDIR] { |
---|
398 | mkdir $(<) |
---|
399 | } } |
---|
400 | if $(VMS) { actions [MKDIR] { |
---|
401 | CREATE/DIR $(<J=", ") |
---|
402 | } } |
---|
403 | |
---|
404 | rule .exe |
---|
405 | { |
---|
406 | local exe = $(<) ; |
---|
407 | if $(NT) || ( $(UNIX) && $(OS) = CYGWIN ) || $(VMS) { exe = $(exe:S=.exe) ; } |
---|
408 | LOCATE on $(exe) = $(locate-target) ; |
---|
409 | DEPENDS all : $(exe) ; |
---|
410 | .mkdir $(locate-target) ; |
---|
411 | if $(--link) |
---|
412 | { |
---|
413 | local objs = ; |
---|
414 | for local s in $(>) |
---|
415 | { |
---|
416 | # Translate any subdir elements into a simple file name. |
---|
417 | local o = [ MATCH "([^/]+)[/]?(.+)" : $(s) ] ; |
---|
418 | o = $(o:J=_) ; |
---|
419 | o = $(o:S=.o) ; |
---|
420 | objs += $(o) ; |
---|
421 | LOCATE on $(o) = $(locate-target) ; |
---|
422 | DEPENDS $(exe) : $(o) ; |
---|
423 | DEPENDS $(o) : $(s) ; |
---|
424 | DEPENDS $(o) : $(locate-target) ; |
---|
425 | [COMPILE] $(o) : $(s) ; |
---|
426 | .clean $(o) ; |
---|
427 | } |
---|
428 | DEPENDS $(exe) : $(objs) ; |
---|
429 | DEPENDS $(exe) : $(locate-target) ; |
---|
430 | [COMPILE.LINK] $(exe) : $(objs) ; |
---|
431 | .clean $(exe) ; |
---|
432 | } |
---|
433 | else |
---|
434 | { |
---|
435 | DEPENDS $(exe) : $(>) ; |
---|
436 | DEPENDS $(exe) : $(locate-target) ; |
---|
437 | [COMPILE] $(exe) : $(>) ; |
---|
438 | .clean $(exe) ; |
---|
439 | } |
---|
440 | return $(exe) ; |
---|
441 | } |
---|
442 | if ! $(--def[2]) { actions [COMPILE] { |
---|
443 | "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def)$(--defs) $(--flags) "$(--libs)" $(>) |
---|
444 | } } |
---|
445 | else { actions [COMPILE] { |
---|
446 | "$(--cc)" $(--bin)$(<:D=) $(--dir)$(<:D) $(--out)$(<) $(--def[1])$(--defs:J=$(--def[2]))$(--def[3]) $(--flags) "$(--libs)" $(>) |
---|
447 | } } |
---|
448 | if $(VMS) { actions [COMPILE.LINK] { |
---|
449 | "$(--link)" $(--link-bin)$(<:D=) $(--link-dir)$(<:D) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>J=", ") |
---|
450 | } } |
---|
451 | else { actions [COMPILE.LINK] { |
---|
452 | "$(--link)" $(--link-bin)$(<:D=) $(--link-dir)$(<:D) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>) |
---|
453 | } } |
---|
454 | |
---|
455 | rule .link |
---|
456 | { |
---|
457 | DEPENDS all : $(<) ; |
---|
458 | DEPENDS $(<) : $(>) ; |
---|
459 | [LINK] $(<) : $(>) ; |
---|
460 | .clean $(<) ; |
---|
461 | } |
---|
462 | if $(NT) { actions [LINK] { |
---|
463 | copy $(>) $(<) |
---|
464 | } } |
---|
465 | if $(UNIX) { actions [LINK] { |
---|
466 | ln -fs $(>) $(<) |
---|
467 | } } |
---|
468 | if $(VMS) { actions [LINK] { |
---|
469 | COPY/REPLACE $(>) $(<) |
---|
470 | } } |
---|
471 | |
---|
472 | rule .move |
---|
473 | { |
---|
474 | DEPENDS $(<) : $(>) ; |
---|
475 | [MOVE] $(<) : $(>) ; |
---|
476 | } |
---|
477 | if $(NT) { actions [MOVE] { |
---|
478 | del /f $(<) |
---|
479 | rename $(>) $(<) |
---|
480 | } } |
---|
481 | if $(UNIX) { actions [MOVE] { |
---|
482 | mv -f $(>) $(<) |
---|
483 | } } |
---|
484 | if $(VMS) { actions [MOVE] { |
---|
485 | RENAME $(>) $(<) |
---|
486 | } } |
---|
487 | |
---|
488 | # Generate the grammar tokens table, and the real yacc grammar. |
---|
489 | rule .yyacc |
---|
490 | { |
---|
491 | local exe = [ .exe yyacc : yyacc.c ] ; |
---|
492 | NOUPDATE $(exe) ; |
---|
493 | DEPENDS $(<) : $(exe) $(>) ; |
---|
494 | LEAVES $(<) ; |
---|
495 | yyacc.exe on $(<) = $(exe:R=$(locate-target)) ; |
---|
496 | [YYACC] $(<) : $(>) ; |
---|
497 | } |
---|
498 | actions [YYACC] { |
---|
499 | $(--chmod+w)$(<[1]) |
---|
500 | $(--chmod+w)$(<[2]) |
---|
501 | "$(yyacc.exe)" $(<) $(>) |
---|
502 | } |
---|
503 | if $(grammar) |
---|
504 | { |
---|
505 | .yyacc jamgram.y jamgramtab.h : jamgram.yy ; |
---|
506 | } |
---|
507 | else if $(debug) |
---|
508 | { |
---|
509 | .exe yyacc : yyacc.c ; |
---|
510 | } |
---|
511 | |
---|
512 | # How to build the grammar. |
---|
513 | if $(NT) |
---|
514 | { |
---|
515 | SUFEXE = .exe ; |
---|
516 | # try some other likely spellings... |
---|
517 | PATH ?= $(Path) ; |
---|
518 | PATH ?= $(path) ; |
---|
519 | } |
---|
520 | SUFEXE ?= "" ; |
---|
521 | |
---|
522 | yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ; |
---|
523 | yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ; |
---|
524 | yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin" "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ; |
---|
525 | yacc = $(yacc[1]) ; |
---|
526 | switch $(yacc:D=:S=) |
---|
527 | { |
---|
528 | case bison : yacc += -d --yacc ; |
---|
529 | case yacc : yacc += -d ; |
---|
530 | } |
---|
531 | if $(debug) && $(yacc) |
---|
532 | { |
---|
533 | yacc += -t -v ; |
---|
534 | } |
---|
535 | yacc += $(YACCFLAGS) ; |
---|
536 | |
---|
537 | rule .yacc |
---|
538 | { |
---|
539 | DEPENDS $(<) : $(>) ; |
---|
540 | LEAVES $(<) ; |
---|
541 | [YACC] $(<) : $(>) ; |
---|
542 | } |
---|
543 | if $(NT) { actions [YACC] { |
---|
544 | "$(yacc)" $(>) |
---|
545 | if not errorlevel 1 ( |
---|
546 | del /f $(<[1]) |
---|
547 | rename y.tab$(<[1]:S) $(<[1]) |
---|
548 | del /f $(<[2]) |
---|
549 | rename y.tab$(<[2]:S) $(<[2]) |
---|
550 | ) else set _error_ = |
---|
551 | } } |
---|
552 | if $(UNIX) { actions [YACC] { |
---|
553 | if ` "$(yacc)" $(>) ` ; then |
---|
554 | mv -f y.tab$(<[1]:S) $(<[1]) |
---|
555 | mv -f y.tab$(<[2]:S) $(<[2]) |
---|
556 | else |
---|
557 | exit 1 |
---|
558 | fi |
---|
559 | } } |
---|
560 | if $(VMS) { actions [YACC] { |
---|
561 | IF "$(yacc)" $(>) |
---|
562 | THEN |
---|
563 | RENAME y_tab$(<[1]:S) $(<[1]) |
---|
564 | RENAME y_tab$(<[2]:S) $(<[2]) |
---|
565 | ENDIF |
---|
566 | } } |
---|
567 | if $(grammar) && ! $(yacc) |
---|
568 | { |
---|
569 | EXIT "Could not find the 'yacc' tool, and therefore can not build the grammar." ; |
---|
570 | } |
---|
571 | if $(grammar) && $(yacc) |
---|
572 | { |
---|
573 | .yacc jamgram.c jamgram.h : jamgram.y ; |
---|
574 | } |
---|
575 | |
---|
576 | # How to build the compiled in jambase. |
---|
577 | rule .mkjambase |
---|
578 | { |
---|
579 | local exe = [ .exe mkjambase : mkjambase.c ] ; |
---|
580 | DEPENDS $(<) : $(exe) $(>) ; |
---|
581 | LEAVES $(<) ; |
---|
582 | mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ; |
---|
583 | [MKJAMBASE] $(<) : $(>) ; |
---|
584 | } |
---|
585 | actions [MKJAMBASE] { |
---|
586 | $(--chmod+w)$(<) |
---|
587 | $(mkjambase.exe) $(<) $(>) |
---|
588 | } |
---|
589 | if $(debug) |
---|
590 | { |
---|
591 | .mkjambase jambase.c : Jambase ; |
---|
592 | } |
---|
593 | |
---|
594 | # How to build Jam. |
---|
595 | rule .jam |
---|
596 | { |
---|
597 | $(>).exe = [ .exe $(>) : $(jam.source) ] ; |
---|
598 | DEPENDS all : $($(>).exe) ; |
---|
599 | |
---|
600 | if $(debug) |
---|
601 | { |
---|
602 | $(<).exe = $(<:S=$($(>).exe:S)) ; |
---|
603 | LOCATE on $($(<).exe) = $(locate-target) ; |
---|
604 | .link $($(<).exe) : $($(>).exe) ; |
---|
605 | DEPENDS all : $($(<).exe) ; |
---|
606 | } |
---|
607 | } |
---|
608 | .jam jam : bjam ; |
---|
609 | |
---|
610 | # Scan sources for header dependencies. |
---|
611 | # WARNING: Yes those are *REAL TABS* below. DO NOT CHANGE, |
---|
612 | # under any circumstances, to spaces!! And the tabs |
---|
613 | # indenting this are so that if someone is in the mood to |
---|
614 | # replace tabs they hit this comment, and hopefully notice |
---|
615 | # their error. |
---|
616 | rule .scan |
---|
617 | { |
---|
618 | HDRRULE on $(<:D=) = .hdr.scan ; |
---|
619 | HDRSCAN on $(<:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ; |
---|
620 | } |
---|
621 | rule .hdr.scan |
---|
622 | { |
---|
623 | local hdrs = [ GLOB . : $(>:D=) ] ; |
---|
624 | INCLUDES $(<:D=) : $(hdrs:D=) ; |
---|
625 | HDRRULE on $(>:D=) = .hdr.scan ; |
---|
626 | HDRSCAN on $(>:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ; |
---|
627 | } |
---|
628 | .scan [ GLOB . : *.c ] ; |
---|
629 | |
---|
630 | # Distribution making from here on out. |
---|
631 | dist.license = |
---|
632 | #~ [ GLOB . : LICENSE_$(LICENSE).txt ] [ GLOB [ .path .. .. .. ] : LICENSE_$(LICENSE).txt ] ; |
---|
633 | [ GLOB . : LICENSE_$(LICENSE).txt ] |
---|
634 | [ GLOB [ .path .. .. .. ] : LICENSE_$(LICENSE).txt ] |
---|
635 | [ GLOB [ .path .. boost ] : LICENSE_$(LICENSE).txt ] ; |
---|
636 | dist.docs = |
---|
637 | $(dist.license[1]) |
---|
638 | index.html |
---|
639 | Porting |
---|
640 | Jam.html |
---|
641 | ; |
---|
642 | dist.source = |
---|
643 | [ GLOB . : *.c *.h ] |
---|
644 | ; |
---|
645 | dist.source = $(dist.source:D=) |
---|
646 | $(dist.docs) |
---|
647 | build.jam build.bat build.sh build_vms.com |
---|
648 | Jambase |
---|
649 | jamgram.y jamgram.yy |
---|
650 | [ .path debian changelog ] |
---|
651 | [ .path debian control ] |
---|
652 | [ .path debian copyright ] |
---|
653 | [ .path debian jam.man.sgml ] |
---|
654 | [ .path debian rules ] |
---|
655 | [ .path modules set.c ] |
---|
656 | [ .path modules path.c ] |
---|
657 | [ .path modules regex.c ] |
---|
658 | [ .path modules property-set.c ] |
---|
659 | [ .path modules sequence.c ] |
---|
660 | [ .path modules order.c ] |
---|
661 | boost-jam.spec |
---|
662 | ; |
---|
663 | dist.bin = |
---|
664 | bjam |
---|
665 | ; |
---|
666 | dist.bin = |
---|
667 | $(dist.license[1]) |
---|
668 | $(dist.bin:S=$(bjam.exe:S)) |
---|
669 | ; |
---|
670 | |
---|
671 | if $(NT) |
---|
672 | { |
---|
673 | zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7z.exe" "7zn.exe" ] ; |
---|
674 | zip ?= [ GLOB $(PATH) : zip.exe ] ; |
---|
675 | zip ?= zip ; |
---|
676 | zip = $(zip[1]) ; |
---|
677 | switch $(zip:D=:S=) |
---|
678 | { |
---|
679 | case 7z* : zip += a -r -tzip -mx=9 ; |
---|
680 | case zip : zip += -9r ; |
---|
681 | } |
---|
682 | actions piecemeal [PACK] { |
---|
683 | "$(zip)" "$(<)" "$(>)" |
---|
684 | } |
---|
685 | actions piecemeal [ZIP] { |
---|
686 | "$(zip)" "$(<)" "$(>)" |
---|
687 | } |
---|
688 | actions piecemeal [COPY] { |
---|
689 | copy /Y "$(>)" "$(<)" >NUL: |
---|
690 | } |
---|
691 | } |
---|
692 | if $(UNIX) |
---|
693 | { |
---|
694 | actions [PACK] { |
---|
695 | tar zcf "$(<)" "$(>)" |
---|
696 | } |
---|
697 | actions [ZIP] { |
---|
698 | gzip -c9 "$(>)" > "$(<)" |
---|
699 | } |
---|
700 | actions [COPY] { |
---|
701 | cp -Rpf "$(>)" "$(<)" |
---|
702 | } |
---|
703 | } |
---|
704 | |
---|
705 | # The single binary, compressed. |
---|
706 | rule .binary |
---|
707 | { |
---|
708 | local zip = ; |
---|
709 | if $(NT) { zip = $($(<).exe:S=.zip) ; } |
---|
710 | if $(UNIX) { zip = $($(<).exe:S=.tgz) ; } |
---|
711 | zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ; |
---|
712 | DEPENDS $(zip) : $($(<).exe) ; |
---|
713 | DEPENDS dist : $(zip) ; |
---|
714 | #~ LOCATE on $(zip) = $(locate-target) ; |
---|
715 | if $(NT) { [ZIP] $(zip) : $($(<).exe) ; } |
---|
716 | if $(UNIX) { [PACK] $(zip) : $($(<).exe) ; } |
---|
717 | .clean $(zip) ; |
---|
718 | } |
---|
719 | |
---|
720 | # Package some file. |
---|
721 | rule .package ( dst-dir : src-files + ) |
---|
722 | { |
---|
723 | local dst-files ; |
---|
724 | for local src-path in $(src-files) |
---|
725 | { |
---|
726 | local src-subdir = $(src-path:D) ; |
---|
727 | local src-file = $(src-path) ; |
---|
728 | while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; } |
---|
729 | if $(src-subdir) = ".." |
---|
730 | { |
---|
731 | src-file = $(src-file:D=) ; |
---|
732 | } |
---|
733 | dst-files += $(src-file:R=$(dst-dir)) ; |
---|
734 | } |
---|
735 | |
---|
736 | local pack = ; |
---|
737 | if $(NT) { pack = $(dst-dir).zip ; } |
---|
738 | if $(UNIX) { pack = $(dst-dir).tgz ; } |
---|
739 | |
---|
740 | DEPENDS dist : $(pack) ; |
---|
741 | DEPENDS $(pack) : $(dst-files) ; |
---|
742 | |
---|
743 | local dst-files-queue = $(dst-files) ; |
---|
744 | for local src-path in $(src-files) |
---|
745 | { |
---|
746 | local dst-file = $(dst-files-queue[1]) ; |
---|
747 | dst-files-queue = $(dst-files-queue[2-]) ; |
---|
748 | DEPENDS $(dst-file) : $(src-path) $(dst-file:D) ; |
---|
749 | .mkdir $(dst-file:D) ; |
---|
750 | |
---|
751 | [COPY] $(dst-file) : $(src-path) ; |
---|
752 | .clean $(dst-file) ; |
---|
753 | } |
---|
754 | |
---|
755 | [PACK] $(pack) : $(dst-files) ; |
---|
756 | .clean $(pack) ; |
---|
757 | } |
---|
758 | |
---|
759 | # RPM distro file. |
---|
760 | rpm-tool = [ GLOB $(PATH) : "rpmbuild" "rpm" ] ; |
---|
761 | rule .rpm ( name : source ) |
---|
762 | { |
---|
763 | local rpm-arch = ; |
---|
764 | switch $(OSPLAT) |
---|
765 | { |
---|
766 | case X86 : rpm-arch ?= i386 ; |
---|
767 | case PPC : rpm-arch ?= ppc ; |
---|
768 | case AXP : rpm-arch ?= alpha ; |
---|
769 | # no guaranty for these: |
---|
770 | case IA64 : rpm-arch ?= ia64 ; |
---|
771 | case ARM : rpm-arch ?= arm ; |
---|
772 | case SPARC : rpm-arch ?= sparc ; |
---|
773 | case * : rpm-arch ?= other ; |
---|
774 | } |
---|
775 | local target = $(name)-rpm ; |
---|
776 | NOTFILE $(target) ; |
---|
777 | DEPENDS dist : $(target) ; |
---|
778 | DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ; |
---|
779 | DEPENDS $(name).$(rpm-arch).rpm : $(source) ; |
---|
780 | DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ; |
---|
781 | docs on $(target) = $(dist.docs:J=" ") ; |
---|
782 | arch on $(target) = $(rpm-arch) ; |
---|
783 | if $(rpm-arch) = ppc { target-opt on $(target) = --target= ; } |
---|
784 | else { target-opt on $(target) = "--target " ; } |
---|
785 | [RPM] $(target) : $(source) ; |
---|
786 | .clean $(name).$(rpm-arch).rpm $(name).src.rpm ; |
---|
787 | } |
---|
788 | actions [RPM] { |
---|
789 | export BOOST_JAM_TOOLSET="$(toolset)" |
---|
790 | $(rpm-tool[1]) -ta $(target-opt)$(arch) $(>) | tee rpm.out |
---|
791 | cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` . |
---|
792 | rm -f rpm.out |
---|
793 | } |
---|
794 | |
---|
795 | # The distribution targets. Don't bother with the targets if |
---|
796 | # distribution build not requested. |
---|
797 | if dist in $(ARGV) |
---|
798 | { |
---|
799 | #~ .binary bjam ; |
---|
800 | .package $(NAME)-$(VERSION) : $(dist.source) ; |
---|
801 | .package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ; |
---|
802 | if $(rpm-tool) |
---|
803 | { |
---|
804 | .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ; |
---|
805 | } |
---|
806 | } |
---|