1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
|
#~ Copyright 2002-2007 Rene Rivera.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# Clean env vars of any "extra" empty values.
for local v in ARGV CC CFLAGS LIBS
{
local values ;
for local x in $($(v))
{
if $(x) != ""
{
values += $(x) ;
}
}
$(v) = $(values) ;
}
# Platform related specifics.
if $(OS) = NT { rule .path { return "$(<:J=\\)" ; } ./ = "/" ; }
else if $(OS) = OS2 { rule .path { return "$(<:J=\\)" ; } ./ = "/" ; }
else if $(OS) = VMS { rule .path { return "[.$(<:J=/)]" ; } }
else if $(OS) = MAC { rule .path { return ":$(<:J=\:)" ; } }
else { rule .path { return "$(<:J=/)" ; } }
if $(OS) = VMS { . = "_" ; }
else { . = "." ; }
./ ?= "" ;
# Info about what we are building.
_VERSION_ = 3 1 19 ;
NAME = boost-jam ;
VERSION = $(_VERSION_:J=$(.)) ;
RELEASE = 1 ;
LICENSE = LICENSE_1_0 ;
# Generate development debug binaries?
if --debug in $(ARGV)
{
debug = true ;
}
if --profile in $(ARGV)
{
profile = true ;
}
# Attempt to generate and/or build the grammar?
if --grammar in $(ARGV)
{
grammar = true ;
}
# Do we need to add a default build type argument?
if ! ( --release in $(ARGV) ) &&
! ( --debug in $(ARGV) ) &&
! ( --profile in $(ARGV) )
{
ARGV += --release ;
}
# Enable, and configure, Python hooks.
with-python = ;
python-location = [ MATCH --with-python=(.*) : $(ARGV) ] ;
if $(python-location)
{
with-python = true ;
}
if $(with-python)
{
if $(OS) = NT
{
--python-include = [ .path $(python-location) include ] ;
--python-lib = ;
for local v in 26 25 24 23 22
{
--python-lib ?=
[ GLOB [ .path $(python-location) libs ] : "python$(v).lib" ]
[ GLOB $(python-location) [ .path $(python-location) libs ]
$(Path) $(PATH) $(path) : "python$(v).dll" ]
;
if ! $(--python-lib[2])
{
--python-lib = ;
}
}
--python-lib = $(--python-lib[1]) ;
}
else if $(OS) = MACOSX
{
--python-include = [ .path $(python-location) Headers ] ;
--python-lib = $(python-location) Python ;
}
else
{
--python-include = ;
--python-lib = ;
for local v in 2.6 2.5 2.4 2.3 2.2
{
local inc = [ GLOB [ .path $(python-location) include ] : python$(v) ] ;
local lib = [ GLOB [ .path $(python-location) lib ] : libpython$(v)* ] ;
if $(inc) && $(lib)
{
--python-include ?= $(inc) ;
--python-lib ?= $(lib[1]:D) python$(v) ;
}
}
}
}
# Boehm GC?
if --gc in $(ARGV)
{
--boehm-gc = true ;
}
if $(--boehm-gc)
{
--extra-include += [ .path [ PWD ] "boehm_gc" "include" ] ;
}
# Duma?
if --duma in $(ARGV)
{
--duma = true ;
}
if $(--duma)
{
--extra-include += [ .path [ PWD ] "duma" ] ;
}
# An explicit root for the toolset? (trim spaces)
toolset-root = [ MATCH --toolset-root=(.*) : $(ARGV) ] ;
{
local t = [ MATCH "[ ]*(.*)" : $(toolset-root:J=" ") ] ;
toolset-root = ;
while $(t)
{
t = [ MATCH "([^ ]+)([ ]*)(.*)" : $(t) ] ;
toolset-root += $(t[1]) ;
if $(t[3]) { toolset-root += $(t[2]) ; }
t = $(t[3]) ;
}
toolset-root = $(toolset-root:J="") ;
}
# Configure the implemented toolsets. These are minimal
# commands and options to compile the full Jam. When
# adding new toolsets make sure to add them to the
# "known" list also.
rule toolset ( name command .type ? : opt.out + : opt.define * : flags * : linklibs * )
{
.type ?= "" ;
tool.$(name)$(.type).cc ?= $(command) ;
tool.$(name)$(.type).opt.out ?= $(opt.out) ;
tool.$(name)$(.type).opt.define ?= $(opt.define) ;
tool.$(name)$(.type).flags ?= $(flags) ;
tool.$(name)$(.type).linklibs ?= $(linklibs) ;
if ! $(name) in $(toolsets) { toolsets += $(name) ; }
}
rule if-os ( os + : yes-opt * : no-opt * )
{ if $(os) in $(OS) { return $(yes-opt) ; } else { return $(no-opt) ; } }
rule opt ( type : yes-opt * : no-opt * )
{ if $(type) in $(ARGV) { return $(yes-opt) ; } else { return $(no-opt) ; } }
## HP-UX aCC compiler
toolset acc cc : "-o " : -D
: -Ae
[ opt --release : -s -O3 ]
[ opt --debug : -g -pg ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Borland C++ 5.5.x
toolset borland bcc32 : -e -n : /D
: -WC -w- -q "-I$(toolset-root)Include" "-L$(toolset-root)Lib"
[ opt --release : -O2 -vi -w-inl ]
[ opt --debug : -v -Od -vi- ]
-I$(--python-include) -I$(--extra-include)
: $(--python-lib[1]) ;
## Generic Unix cc
if ! $(CC) { CC = cc ; }
toolset cc $(CC) : "-o " : -D
: $(CFLAGS)
[ opt --release : -s -O ]
[ opt --debug : -g ]
-I$(--python-include) -I$(--extra-include)
: $(LIBS) -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Comeau C/C++ 4.x
toolset como como : "-o " : -D
: --c
[ opt --release : --inlining ]
[ opt --debug : --no_inlining ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Clang Linux 2.8+
toolset clang clang : "-o " : -D
: -Wno-unused -Wno-format
[ opt --release : -Os ]
[ opt --debug : -g -O0 -fno-inline ]
[ opt --profile : -finline-functions -g ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## MacOSX Darwin, using GCC 2.9.x, 3.x
toolset darwin cc : "-o " : -D
:
[ opt --release : -Wl,-x -O3 -finline-functions ]
[ opt --debug : -g -O0 -fno-inline -pg ]
[ opt --profile : -Wl,-x -O3 -finline-functions -g -pg ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## GCC 2.x, 3.x, 4.x
toolset gcc gcc : "-o " : -D
: -pedantic -fno-strict-aliasing
[ opt --release : [ opt --symbols : -g : -s ] -O3 ]
[ opt --debug : -g -O0 -fno-inline ]
-I$(--python-include) -I$(--extra-include) -Wno-long-long
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## GCC 2.x, 3.x on CYGWIN but without cygwin1.dll
toolset gcc-nocygwin gcc : "-o " : -D
: -s -O3 -mno-cygwin
[ opt --release : -finline-functions ]
[ opt --debug : -s -O3 -fno-inline -pg ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Intel C/C++ for Darwin
toolset intel-darwin icc : "-o " : -D
:
[ opt --release : -O3 ]
[ opt --debug : -g -O0 -p ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Intel C/C++ for Linux
toolset intel-linux icc : "-o " : -D
:
[ opt --release : -Xlinker -s -O3 ]
[ opt --debug : -g -O0 -p ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Intel C/C++ for Win32
toolset intel-win32 icl : /Fe : -D
: /nologo
[ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /GB ]
[ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 ]
-I$(--python-include) -I$(--extra-include)
: kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
## KCC ?
toolset kcc KCC : "-o " : -D
:
[ opt --release : -s +K2 ]
[ opt --debug : -g +K0 ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Borland Kylix
toolset kylix bc++ : -o : -D
: -tC -q
[ opt --release : -O2 -vi -w-inl ]
[ opt --debug : -v -Od -vi- ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Metrowerks CodeWarrior 8.x
{
# Even though CW can compile all files at once, it crashes if it tries in the bjam case.
local mwcc = ; if $(OS) = NT { mwcc = mwcc ; } else { mwcc = mwc$(OSPLAT:L) ; }
mwcc ?= mwcc ;
toolset metrowerks $(mwcc) : "-o " : -D
: -c -lang c -subsystem console -cwd include
[ opt --release : -runtime ss -opt full -inline all ]
[ opt --debug : -runtime ssd -opt none -inline off ]
-I$(--python-include) -I$(--extra-include) ;
toolset metrowerks $(mwcc) .link : "-o " :
: -subsystem console -lkernel32.lib -ladvapi32.lib -luser32.lib
[ opt --release : -runtime ss ]
[ opt --debug : -runtime ssd ]
: $(--python-lib[1]) ;
}
## MINGW GCC
toolset mingw gcc : "-o " : -D
:
[ opt --release : -s -O3 -finline-functions ]
[ opt --debug : -g -O0 -fno-inline -pg ]
-I$(--python-include) -I$(--extra-include)
: $(--python-lib[2]) ;
## MIPS Pro
toolset mipspro cc : "-o " : -D
:
[ opt --release : -s -O3 -g0 -INLINE:none ]
[ opt --debug : -g -O0 -INLINE ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Microsoft Visual Studio C++ 6.x
toolset msvc cl : /Fe /Fe /Fd /Fo : -D
: /nologo
[ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
[ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ]
-I$(--python-include) -I$(--extra-include)
: kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
## QNX 6.x GCC 3.x/2.95.3
toolset qcc qcc : "-o " : -D
: -Wc,-pedantic -Wc,-fno-strict-aliasing
[ opt --release : [ opt --symbols : -g ] -O3 -Wc,-finline-functions ]
[ opt --debug : -g -O0 -Wc,-fno-inline ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Qlogic Pathscale 2.4
toolset pathscale pathcc : "-o " : -D
:
[ opt --release : -s -Ofast -O3 ]
[ opt --debug : -g ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Portland Group Pgi 6.2
toolset pgi pgcc : "-o " : -D
:
[ opt --release : -s -O3 ]
[ opt --debug : -g ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Sun Workshop 6 C++
toolset sun cc : "-o " : -D
:
[ opt --release : -s -fast -xO4 ]
[ opt --debug : -g ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Sun Workshop 6 C++ (old alias)
toolset sunpro cc : "-o " : -D
:
[ opt --release : -s -fast -xO4 ]
[ opt --debug : -g ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## Compaq Alpha CXX
toolset tru64cxx cc : "-o " : -D
:
[ opt --release : -s -O5 -inline speed ]
[ opt --debug : -g -O0 -pg ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) ;
## IBM VisualAge C++
toolset vacpp xlc : "-o " : -D
:
[ opt --release : -s -O3 -qstrict -qinline ]
[ opt --debug : -g -qNOOPTimize -qnoinline -pg ]
-I$(--python-include) -I$(--extra-include)
: -L$(--python-lib[1]) -l$(--python-lib[2]) [ if-os AIX : -bmaxdata:0x40000000 ] ;
## Microsoft Visual C++ .NET 7.x
toolset vc7 cl : /Fe /Fe /Fd /Fo : -D
: /nologo
[ opt --release : /ML /O2 /Ob2 /Gy /GF /GA /GB ]
[ opt --debug : /MLd /DEBUG /Z7 /Od /Ob0 ]
-I$(--python-include) -I$(--extra-include)
: kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
## Microsoft Visual C++ 2005
toolset vc8 cl : /Fe /Fe /Fd /Fo : -D
: /nologo
[ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
[ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
-I$(--python-include) -I$(--extra-include)
: kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
## Microsoft Visual C++ 2008
toolset vc9 cl : /Fe /Fe /Fd /Fo : -D
: /nologo
[ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
[ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
-I$(--python-include) -I$(--extra-include)
: kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
## Microsoft Visual C++ 2010
toolset vc10 cl : /Fe /Fe /Fd /Fo : -D
: /nologo
[ opt --release : /MT /O2 /Ob2 /Gy /GF /GA /wd4996 ]
[ opt --debug : /MTd /DEBUG /Z7 /Od /Ob0 /wd4996 ]
-I$(--python-include) -I$(--extra-include)
: kernel32.lib advapi32.lib user32.lib $(--python-lib[1]) ;
## VMS/OpenVMS DEC C
toolset vmsdecc cc : /OBJECT= : "/DEFINES=(" "," ")"
: /STANDARD=VAXC /PREFIX_LIBRARY_ENTRIES=ALL_ENTRIES
[ opt --release : /OPTIMIZE /NODEBUG ]
[ opt --debug : /NOOPTIMIZE /DEBUG ]
;
toolset vmsdecc link .link : /EXECUTABLE= :
: /NOMAP
[ opt --release : /NODEBUG ]
[ opt --debug : /DEBUG ]
;
# First set the build commands and options according to the
# preset toolset.
toolset = [ MATCH --toolset=(.*) : $(ARGV) ] ;
if ! $(toolset)
{
# For some reason, the following test does not catch empty toolset.
ECHO "###" ;
ECHO "###" No toolset specified. Please use --toolset option. ;
ECHO "###" ;
ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
EXIT "###" ;
}
if ! $(toolset) in $(toolsets)
{
ECHO "###" ;
ECHO "###" Unknown toolset: $(toolset) ;
ECHO "###" ;
ECHO "###" Known toolsets are: $(toolsets:J=", ") ;
EXIT "###" ;
}
--cc = $(tool.$(toolset).cc) ;
if $(tool.$(toolset).opt.out[2])
{
if $(tool.$(toolset).opt.out[1]) = $(tool.$(toolset).opt.out[2])
{
--out = $(tool.$(toolset).opt.out[1]) ;
--dir = $(tool.$(toolset).opt.out[3-]) ;
}
else
{
--bin = $(tool.$(toolset).opt.out[1]) ;
--dir = $(tool.$(toolset).opt.out[2-]) ;
}
}
else
{
--out = $(tool.$(toolset).opt.out) ;
}
--def = $(tool.$(toolset).opt.define) ;
--flags = $(tool.$(toolset).flags) ;
--defs = $(tool.$(toolset).defines) ;
--libs = $(tool.$(toolset).linklibs) ;
if $(tool.$(toolset).link.cc)
{
--link = $(tool.$(toolset).link.cc) ;
if $(tool.$(toolset).link.opt.out[2])
{
if $(tool.$(toolset).link.opt.out[1]) = $(tool.$(toolset).link.opt.out[2])
{
--link-out = $(tool.$(toolset).link.opt.out[1]) ;
--link-dir = $(tool.$(toolset).link.opt.out[3-]) ;
}
else
{
--link-bin = $(tool.$(toolset).link.opt.out[1]) ;
--link-dir = $(tool.$(toolset).link.opt.out[2-]) ;
}
}
else
{
--link-out = $(tool.$(toolset).link.opt.out) ;
}
--link-def = $(tool.$(toolset).link.opt.define) ;
--link-flags = $(tool.$(toolset).link.flags) ;
--link-defs = $(tool.$(toolset).link.defines) ;
--link-libs = $(tool.$(toolset).link.linklibs) ;
}
# Put executables in platform-specific subdirectory.
locate-target = $(LOCATE_TARGET) ;
if $(OS) = VMS
{
locate-target ?= bin$(.)vms ;
platform = vms ;
}
else if $(OS) = MAC
{
locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
platform = $(OS:L)$(OSPLAT:L) ;
}
else if $(OSPLAT)
{
locate-target ?= bin$(.)$(OS:L)$(OSPLAT:L) ;
platform = $(OS:L)$(OSPLAT:L) ;
}
else
{
locate-target ?= bin$(.)$(OS:L) ;
platform = $(OS:L) ;
}
if $(debug)
{
locate-target = [ .path $(locate-target)$(.)debug ] ;
}
if $(profile)
{
locate-target = [ .path $(locate-target)$(.)profile ] ;
}
else
{
locate-target = [ .path $(locate-target) ] ;
}
if --show-locate-target in $(ARGV)
{
ECHO $(locate-target) ;
}
# We have some different files for UNIX, VMS, and NT.
jam.source =
command.c compile.c debug.c expand.c glob.c
hash.c hcache.c headers.c hdrmacro.c
jam.c jambase.c jamgram.c
lists.c make.c make1.c mem.c newstr.c
option.c output.c parse.c regexp.c rules.c
scan.c search.c subst.c w32_getreg.c
timestamp.c variable.c modules.c strings.c filesys.c
builtins.c pwd.c class.c native.c md5.c modules/set.c
modules/path.c modules/regex.c modules/property-set.c
modules/sequence.c modules/order.c
;
if $(OS) = NT
{
jam.source += execnt.c filent.c pathunix.c ;
}
else if $(OS) = OS2
{
jam.source += execunix.c fileos2.c pathunix.c ;
}
else if $(OS) = VMS
{
jam.source += execvms.c filevms.c pathvms.c ;
}
else if $(OS) = MAC
{
jam.source += execmac.c filemac.c pathmac.c ;
}
else
{
jam.source += execunix.c fileunix.c pathunix.c ;
}
# Debug assertions, or not.
if ! $(debug) || --noassert in $(ARGV)
{
--defs += NDEBUG ;
}
# Enable some optional features.
--defs += OPT_HEADER_CACHE_EXT ;
--defs += OPT_GRAPH_DEBUG_EXT ;
--defs += OPT_SEMAPHORE ;
--defs += OPT_AT_FILES ;
--defs += OPT_DEBUG_PROFILE ;
# Bug fixes
--defs += OPT_FIX_TARGET_VARIABLES_EXT ;
#~ --defs += OPT_NO_EXTERNAL_VARIABLE_SPLIT ;
# Improvements
--defs += OPT_IMPROVED_PATIENCE_EXT ;
# Use Boehm GC memory allocator?
if $(--boehm-gc)
{
--defs += OPT_BOEHM_GC ;
if $(debug)
{
--defs += GC_DEBUG ;
}
}
if $(--duma)
{
--defs += OPT_DUMA ;
}
if ( $(OS) = NT ) && ! NT in $(--defs)
{
--defs += NT ;
}
if $(OS) = VMS
{
--defs += VMS ;
}
--defs += YYSTACKSIZE=5000 ;
if $(with-python)
{
--defs += HAVE_PYTHON ;
}
if $(debug)
{
--defs += BJAM_NEWSTR_NO_ALLOCATE ;
}
# The basic symbolic targets...
NOTFILE all clean dist ;
ALWAYS clean ;
# Utility rules and actions...
rule .clean
{
[DELETE] clean : $(<) ;
}
if $(OS) = NT { actions piecemeal together existing [DELETE] {
del /F /Q "$(>)"
} }
if $(UNIX) = true { actions piecemeal together existing [DELETE] {
rm -f "$(>)"
} }
if $(OS) = VMS { actions piecemeal together existing [DELETE] {
DELETE $(>[--2]:J=";*, ") $(>[-1]);*
} }
if $(OS) = NT {
--chmod+w = "attrib -r " ;
}
if $(UNIX) = true {
--chmod+w = "chmod +w " ;
}
if $(OS) = VMS {
--chmod+w = "SET FILE/PROT=(S:RWED) " ;
}
rule .mkdir
{
NOUPDATE $(<) ;
if $(<:P) { DEPENDS $(<) : $(<:P) ; .mkdir $(<:P) ; }
if ! $(md<$(<)>) { [MKDIR] $(<) ; md<$(<)> = - ; }
}
if $(OS) = NT { actions [MKDIR] {
md "$(<)"
} }
if $(UNIX) = true { actions [MKDIR] {
mkdir "$(<)"
} }
if $(OS) = VMS { actions [MKDIR] {
CREATE/DIR $(<J=", ")
} }
rule .exe
{
local exe = $(<) ;
if $(OS) = NT || ( $(UNIX) = true && $(OS) = CYGWIN ) || $(OS) = VMS { exe = $(exe:S=.exe) ; }
LOCATE on $(exe) = $(locate-target) ;
DEPENDS all : $(exe) ;
.mkdir $(locate-target) ;
if $(--link)
{
local objs = ;
for local s in $(>)
{
# Translate any subdir elements into a simple file name.
local o = [ MATCH "([^/]+)[/]?(.+)" : $(s) ] ;
o = $(o:J=_) ;
o = $(o:S=.o) ;
objs += $(o) ;
LOCATE on $(o) = $(locate-target) ;
DEPENDS $(exe) : $(o) ;
DEPENDS $(o) : $(s) ;
DEPENDS $(o) : $(locate-target) ;
[COMPILE] $(o) : $(s) ;
.clean $(o) ;
}
DEPENDS $(exe) : $(objs) ;
DEPENDS $(exe) : $(locate-target) ;
[COMPILE.LINK] $(exe) : $(objs) ;
.clean $(exe) ;
}
else
{
DEPENDS $(exe) : $(>) ;
DEPENDS $(exe) : $(locate-target) ;
[COMPILE] $(exe) : $(>) ;
.clean $(exe) ;
}
return $(exe) ;
}
if ! $(--def[2]) { actions [COMPILE] {
"$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def)$(--defs)" "$(--flags)" "$(--libs)" "$(>)"
} }
else { actions [COMPILE] {
"$(--cc)" "$(--bin)$(<:D=)" "$(--dir)$(<:D)$(./)" $(--out)$(<) "$(--def[1])$(--defs:J=$(--def[2]))$(--def[3])" "$(--flags)" "$(--libs)" "$(>)"
} }
if $(OS) = VMS { actions [COMPILE.LINK] {
"$(--link)" $(--link-bin)$(<:D=) $(--link-dir)$(<:D)$(./) $(--link-out)$(<) $(--link-def)$(--link-defs) $(--link-flags) "$(--link-libs)" $(>J=", ")
} }
else { actions [COMPILE.LINK] {
"$(--link)" "$(--link-bin)$(<:D=)" "$(--link-dir)$(<:D)$(./)" "$(--link-out)$(<)" "$(--link-def)$(--link-defs)" "$(--link-flags)" "$(--link-libs)" "$(>)"
} }
rule .link
{
DEPENDS all : $(<) ;
DEPENDS $(<) : $(>) ;
[LINK] $(<) : $(>) ;
.clean $(<) ;
}
if $(OS) = NT { actions [LINK] {
copy "$(>)" "$(<)"
} }
if $(UNIX) = true { actions [LINK] {
ln -fs "$(>)" "$(<)"
} }
if $(OS) = VMS { actions [LINK] {
COPY/REPLACE $(>) $(<)
} }
rule .copy
{
DEPENDS all : $(<) ;
DEPENDS $(<) : $(>) ;
[COPY] $(<) : $(>) ;
.clean $(<) ;
}
# Will be redefined later.
actions [COPY]
{
}
rule .move
{
DEPENDS $(<) : $(>) ;
[MOVE] $(<) : $(>) ;
}
if $(OS) = NT { actions [MOVE] {
del /f "$(<)"
rename "$(>)" "$(<)"
} }
if $(UNIX) = true { actions [MOVE] {
mv -f "$(>)" "$(<)"
} }
if $(OS) = VMS { actions [MOVE] {
RENAME "$(>)" "$(<)"
} }
# Generate the grammar tokens table, and the real yacc grammar.
rule .yyacc
{
local exe = [ .exe yyacc : yyacc.c ] ;
NOUPDATE $(exe) ;
DEPENDS $(<) : $(exe) $(>) ;
LEAVES $(<) ;
yyacc.exe on $(<) = $(exe:R=$(locate-target)) ;
[YYACC] $(<) : $(>) ;
}
actions [YYACC] {
$(--chmod+w)$(<[1])
$(--chmod+w)$(<[2])
"$(yyacc.exe)" "$(<)" "$(>)"
}
if $(grammar)
{
.yyacc jamgram.y jamgramtab.h : jamgram.yy ;
}
else if $(debug)
{
.exe yyacc : yyacc.c ;
}
# How to build the grammar.
if $(OS) = NT
{
SUFEXE = .exe ;
# try some other likely spellings...
PATH ?= $(Path) ;
PATH ?= $(path) ;
}
SUFEXE ?= "" ;
yacc ?= [ GLOB $(PATH) : yacc$(SUFEXE) ] ;
yacc ?= [ GLOB $(PATH) : bison$(SUFEXE) ] ;
yacc ?= [ GLOB "$(ProgramFiles:J= )\\GnuWin32\\bin" "C:\\Program Files\\GnuWin32\\bin" : bison$(SUFEXE) ] ;
yacc = $(yacc[1]) ;
switch $(yacc:D=:S=)
{
case bison : yacc += -d --yacc ;
case yacc : yacc += -d ;
}
if $(debug) && $(yacc)
{
yacc += -t -v ;
}
yacc += $(YACCFLAGS) ;
rule .yacc
{
DEPENDS $(<) : $(>) ;
LEAVES $(<) ;
[YACC] $(<) : $(>) ;
}
if $(OS) = NT { actions [YACC] {
"$(yacc)" "$(>)"
if not errorlevel 1 (
del /f "$(<[1])"
rename y.tab$(<[1]:S) "$(<[1])"
del /f $(<[2])
rename y.tab$(<[2]:S) "$(<[2])"
) else set _error_ =
} }
if $(UNIX) = true { actions [YACC] {
if ` "$(yacc)" "$(>)" ` ; then
mv -f y.tab$(<[1]:S) "$(<[1])"
mv -f y.tab$(<[2]:S) "$(<[2])"
else
exit 1
fi
} }
if $(OS) = VMS { actions [YACC] {
IF "$(yacc)" $(>)
THEN
RENAME y_tab$(<[1]:S) $(<[1])
RENAME y_tab$(<[2]:S) $(<[2])
ENDIF
} }
if $(grammar) && ! $(yacc)
{
EXIT "Could not find the 'yacc' tool, and therefore can not build the grammar." ;
}
if $(grammar) && $(yacc)
{
.yacc jamgram.c jamgram.h : jamgram.y ;
}
# How to build the compiled in jambase.
rule .mkjambase
{
local exe = [ .exe mkjambase : mkjambase.c ] ;
DEPENDS $(<) : $(exe) $(>) ;
LEAVES $(<) ;
mkjambase.exe on $(<) = $(exe:R=$(locate-target)) ;
[MKJAMBASE] $(<) : $(>) ;
}
actions [MKJAMBASE] {
$(--chmod+w)$(<)
$(mkjambase.exe) "$(<)" "$(>)"
}
if $(debug)
{
.mkjambase jambase.c : Jambase ;
}
# How to build Jam.
rule .jam
{
$(>).exe = [ .exe $(>) : $(jam.source) ] ;
DEPENDS all : $($(>).exe) ;
# Make a copy under the old name.
$(<).exe = $(<:S=$($(>).exe:S)) ;
LOCATE on $($(<).exe) = $(locate-target) ;
.copy $($(<).exe) : $($(>).exe) ;
DEPENDS all : $($(<).exe) ;
}
.jam bjam : b2 ;
# Scan sources for header dependencies.
# WARNING: Yes those are *REAL TABS* below. DO NOT CHANGE,
# under any circumstances, to spaces!! And the tabs
# indenting this are so that if someone is in the mood to
# replace tabs they hit this comment, and hopefully notice
# their error.
rule .scan
{
HDRRULE on $(<:D=) = .hdr.scan ;
HDRSCAN on $(<:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ;
}
rule .hdr.scan
{
local hdrs = [ GLOB . : $(>:D=) ] ;
INCLUDES $(<:D=) : $(hdrs:D=) ;
HDRRULE on $(>:D=) = .hdr.scan ;
HDRSCAN on $(>:D=) = "^[ ]*#[ ]*include[ ]*([<\"][^\">]*[\">]).*$" ;
}
.scan [ GLOB . : *.c ] ;
# Distribution making from here on out. Assumes that
# the docs are already built as html at ../doc/html. If
# they aren't, then the docs are not included in the dist
# archive.
dist.license =
[ GLOB . : $(LICENSE).txt ]
;
dist.license = $(dist.license:D=)
[ GLOB [ .path .. .. .. ] : $(LICENSE).txt ]
[ GLOB [ .path .. boost ] : $(LICENSE).txt ] ;
dist.docs =
[ GLOB . : *.png *.css *.html ]
;
dist.docs = $(dist.docs:D=)
[ GLOB [ .path images ] : *.png ]
[ GLOB [ .path jam ] : *.html ]
;
dist.source =
[ GLOB . : *.c *.h ]
;
dist.source = $(dist.source:D=)
$(dist.license[1])
$(dist.docs)
build.jam build.bat build.sh build_vms.com
Jambase
jamgram.y jamgram.yy
[ .path modules set.c ]
[ .path modules path.c ]
[ .path modules regex.c ]
[ .path modules property-set.c ]
[ .path modules sequence.c ]
[ .path modules order.c ]
[ GLOB [ .path boehm_gc ] : * ]
[ GLOB [ .path boehm_gc include ] : * ]
[ GLOB [ .path boehm_gc include private ] : * ]
[ GLOB [ .path boehm_gc cord ] : * ]
[ GLOB [ .path boehm_gc Mac_files ] : * ]
[ GLOB [ .path boehm_gc tests ] : * ]
[ GLOB [ .path boehm_gc doc ] : * ]
;
dist.bin =
bjam
;
dist.bin =
$(dist.license[1])
$(dist.bin:S=$(bjam.exe:S))
;
if $(OS) = NT
{
zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7z.exe" ] ;
zip ?= [ GLOB "$(ProgramFiles:J= )\\7-ZIP" "C:\\Program Files\\7-ZIP" : "7zn.exe" ] ;
zip ?= [ GLOB $(PATH) : zip.exe ] ;
zip ?= zip ;
zip = $(zip[1]) ;
switch $(zip:D=:S=)
{
case 7z* : zip += a -r -tzip -mx=9 ;
case zip : zip += -9r ;
}
actions piecemeal [PACK] {
"$(zip)" "$(<)" "$(>)"
}
actions piecemeal [ZIP] {
"$(zip)" "$(<)" "$(>)"
}
actions piecemeal [COPY] {
copy /Y "$(>)" "$(<)" >NUL:
}
}
if $(UNIX) = true
{
tar ?= [ GLOB $(PATH) : star bsdtar tar ] ;
tar = $(tar[1]) ;
switch $(tar:D=:S=)
{
case star : tar += -c artype=pax -D -d -to-stdout ;
case * : tar += -c -f - ;
}
actions [PACK] {
"$(tar)" "$(>)" | gzip -c9 > "$(<)"
}
#~ actions [PACK] {
#~ tar cf "$(<:S=.tar)" "$(>)"
#~ }
actions [ZIP] {
gzip -c9 "$(>)" > "$(<)"
}
actions [COPY] {
cp -Rpf "$(>)" "$(<)"
}
}
# The single binary, compressed.
rule .binary
{
local zip = ;
if $(OS) = NT { zip = $($(<).exe:S=.zip) ; }
if $(UNIX) = true { zip = $($(<).exe:S=.tgz) ; }
zip = $(zip:S=)-$(VERSION)-$(RELEASE)-$(platform)$(zip:S) ;
DEPENDS $(zip) : $($(<).exe) ;
DEPENDS dist : $(zip) ;
#~ LOCATE on $(zip) = $(locate-target) ;
if $(OS) = NT { [ZIP] $(zip) : $($(<).exe) ; }
if $(UNIX) = true { [PACK] $(zip) : $($(<).exe) ; }
.clean $(zip) ;
}
# Package some file.
rule .package ( dst-dir : src-files + )
{
local dst-files ;
local src-files-actual ;
for local src-path in $(src-files)
{
if ! [ GLOB $(src-path:P) : $(src-path:B) ] || [ CHECK_IF_FILE $(src-path) ]
{
local src-subdir = $(src-path:D) ;
local src-file = $(src-path) ;
while $(src-subdir:D) { src-subdir = $(src-subdir:D) ; }
if $(src-subdir) = ".."
{
src-file = $(src-file:D=) ;
}
dst-files += $(src-file:R=$(dst-dir)) ;
src-files-actual += $(src-path) ;
}
}
local pack = ;
if $(OS) = NT { pack = $(dst-dir).zip ; }
if $(UNIX) = true { pack = $(dst-dir).tgz ; }
DEPENDS dist : $(pack) ;
DEPENDS $(pack) : $(dst-files) ;
local dst-files-queue = $(dst-files) ;
for local src-path in $(src-files-actual)
{
local dst-file = $(dst-files-queue[1]) ;
dst-files-queue = $(dst-files-queue[2-]) ;
DEPENDS $(dst-file) : $(src-path) $(dst-file:D) ;
.mkdir $(dst-file:D) ;
[COPY] $(dst-file) : $(src-path) ;
.clean $(dst-file) ;
}
[PACK] $(pack) : $(dst-files) ;
.clean $(pack) ;
}
# RPM distro file.
rpm-tool = [ GLOB $(PATH) : "rpmbuild" ] ;
rpm-tool ?= [ GLOB $(PATH) : "rpm" ] ;
rpm-tool = $(rpm-tool[1]) ;
rule .rpm ( name : source )
{
local rpm-arch = ;
switch $(OSPLAT)
{
case X86 : rpm-arch ?= i386 ;
case PPC : rpm-arch ?= ppc ;
case AXP : rpm-arch ?= alpha ;
# no guaranty for these:
case IA64 : rpm-arch ?= ia64 ;
case ARM : rpm-arch ?= arm ;
case SPARC : rpm-arch ?= sparc ;
case * : rpm-arch ?= other ;
}
local target = $(name)-rpm ;
NOTFILE $(target) ;
DEPENDS dist : $(target) ;
DEPENDS $(target) : $(name).$(rpm-arch).rpm $(name).src.rpm ;
DEPENDS $(name).$(rpm-arch).rpm : $(source) ;
DEPENDS $(name).src.rpm : $(name).$(rpm-arch).rpm ;
docs on $(target) = $(dist.docs:J=" ") ;
arch on $(target) = $(rpm-arch) ;
if $(rpm-arch) = ppc { target-opt on $(target) = --target= ; }
else { target-opt on $(target) = "--target " ; }
[RPM] $(target) : $(source) ;
.clean $(name).$(rpm-arch).rpm $(name).src.rpm ;
}
actions [RPM] {
set -e
export BOOST_JAM_TOOLSET="$(toolset)"
$(rpm-tool) -ta $(target-opt)$(arch) $(>) | tee rpm.out
cp `grep -e '^Wrote:' rpm.out | sed 's/^Wrote: //'` .
rm -f rpm.out
}
# The distribution targets. Don't bother with the targets if
# distribution build not requested.
if dist in $(ARGV)
{
#~ .binary bjam ;
.package $(NAME)-$(VERSION) : $(dist.source) ;
.package $(NAME)-$(VERSION)-$(RELEASE)-$(platform) : $(dist.bin) ;
if $(rpm-tool)
{
#~ .rpm $(NAME)-$(VERSION)-$(RELEASE) : $(NAME)-$(VERSION).tgz ;
}
}
|