-
Notifications
You must be signed in to change notification settings - Fork 0
/
Jambase
2245 lines (1890 loc) · 48.5 KB
/
Jambase
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
#
# /+\
# +\ Copyright 1993, 2000 Christopher Seiwald.
# \+/
#
# This file is part of Jam - see jam.c for Copyright information.
#
#
# JAMBASE - jam 2.3 ruleset providing make(1)-like functionality
#
# Supports UNIX, NT, and VMS.
#
# 12/27/93 (seiwald) - purturb library sources with SOURCE_GRIST
# 04/18/94 (seiwald) - use '?=' when setting OS specific vars
# 04/21/94 (seiwald) - do RmTemps together
# 05/05/94 (seiwald) - all supported C compilers support -o: relegate
# RELOCATE as an option; set Ranlib to "" to disable it
# 06/01/94 (seiwald) - new 'actions existing' to do existing sources
# 08/25/94 (seiwald) - new ObjectCcFlags rule to append to per-target CCFLAGS
# 08/29/94 (seiwald) - new ObjectHdrs rule to append to per-target HDRS
# 09/19/94 (seiwald) - LinkLibraries and Undefs now append
# - Rule names downshifted.
# 10/06/94 (seiwald) - Dumb yyacc stuff moved into Jamfile.
# 10/14/94 (seiwald) - (Crude) support for .s, .C, .cc, .cpp, and .f files.
# 01/08/95 (seiwald) - Shell now handled with awk, not sed
# 01/09/95 (seiwald) - Install* now take dest directory as target
# 01/10/95 (seiwald) - All entries sorted.
# 01/10/95 (seiwald) - NT support moved in, with LauraW's help.
# 01/10/95 (seiwald) - VMS support moved in.
# 02/06/95 (seiwald) - ObjectC++Flags and SubDirC++Flags added.
# 02/07/95 (seiwald) - Iron out when HDRSEARCH uses "" or SEARCH_SOURCE.
# 02/08/95 (seiwald) - SubDir works on VMS.
# 02/14/95 (seiwald) - MkDir and entourage.
# 04/30/95 (seiwald) - Use install -c flag so that it copies, not moves.
# 07/10/95 (taylor) - Support for Microsoft C++.
# 11/21/96 (peterk) - Support for BeOS
# 07/19/99 (sickel) - Support for Mac OS X Server (and maybe client)
# 02/18/00 (belmonte)- Support for Cygwin.
# 11/05/04 (st.clair)- Modified MinGW variables and actions
# Special targets defined in this file:
#
# all - parent of first, shell, files, lib, exe
# first - first dependent of 'all', for potential initialization
# shell - parent of all Shell targets
# files - parent of all File targets
# lib - parent of all Library targets
# exe - parent of all Main targets
# dirs - parent of all MkDir targets
# clean - removes all Shell, File, Library, and Main targets
# uninstall - removes all Install targets
#
# Rules defined by this file:
#
# as obj.o : source.s ; .s -> .o
# Bulk dir : files ; populate directory with many files
# Cc obj.o : source.c ; .c -> .o
# C++ obj.o : source.cc ; .cc -> .o
# Clean clean : sources ; remove sources with 'jam clean'
# File dest : source ; copy file
# Fortran obj.o : source.f ; .f -> .o
# GenFile source.c : program args ; make custom file
# Hardlink target : source ; make link from source to target
# HdrRule source : headers ; handle #includes
# InstallInto dir : sources ; install any files
# InstallBin dir : sources ; install binaries
# InstallLib dir : sources ; install files
# InstallFile dir : sources ; install files
# InstallMan dir : sources ; install man pages
# InstallShell dir : sources ; install shell scripts
# Lex source.c : source.l ; .l -> .c
# Library lib : source ; archive library from compiled sources
# LibraryFromObjects lib : objects ; archive library from objects
# LinkLibraries images : libraries ; bag libraries onto Mains
# Main image : source ; link executable from compiled sources
# MainFromObjects image : objects ; link executable from objects
# MkDir dir ; make a directory, if not there
# Object object : source ; compile object from source
# ObjectCcFlags source : flags ; add compiler flags for object
# ObjectC++Flags source : flags ; add compiler flags for object
# ObjectHdrs source : dirs ; add include directories for object
# Objects sources ; compile sources
# RmTemps target : sources ; remove temp sources after target made
# Setuid images ; mark executables Setuid
# SubDir TOP d1 d2 ... ; start a subdirectory Jamfile
# SubDirCcFlags flags ; add compiler flags until next SubDir
# SubDirC++Flags flags ; add compiler flags until next SubDir
# SubDirHdrs dirs ; add include dirs until next SubDir
# SubInclude TOP d1 d2 ... ; include a subdirectory Jamfile
# Shell exe : source ; make a shell executable
# Undefines images : symbols ; save undef's for linking
# UserObject object : source ; handle unknown suffixes for Object
# Yacc source.c : source.y ; .y -> .c
#
# Utility rules that have no side effects (not supported):
#
# FAppendSuffix f1 f2 ... : $(SUF) ; return $(<) with suffixes
# FConcat value ... ; return contatenated values
# FDirName d1 d2 ... ; return path from root to dir
# FGrist d1 d2 ... ; return d1!d2!...
# FGristFiles value ; return $(value:G=$(SOURCE_GRIST))
# FGristSourceFiles value ; return $(value:G=$(SOURCE_GRIST))
# FRelPath d1 : d2 ; return rel path from d1 to d2
# FSubDir d1 d2 ... ; return path to root
#
# Brief review of the jam language:
#
# Statements:
# rule RULE - statements to process a rule
# actions RULE - system commands to carry out target update
#
# Modifiers on actions:
# together - multiple instances of same rule on target get executed
# once with their sources ($(>)) concatenated
# updated - refers to updated sources ($(>)) only
# ignore - ignore return status of command
# quietly - don't trace its execution unless verbose
# piecemeal - iterate command each time with a small subset of $(>)
# existing - refers to currently existing sources ($(>)) only
# bind vars - subject to binding before expanding in actions
#
# Special rules:
# ALWAYS - always build a target
# DEPENDS - builds the dependency graph
# ECHO - blurt out targets on stdout
# EXIT - blurt out targets and exit
# INCLUDES - marks sources as headers for target (a codependency)
# NOCARE - don't panic if the target can't be built
# NOUPDATE - create the target if needed but never update it
# NOTFILE - ignore the timestamp of the target (it's not a file)
# TEMPORARY - target need not be present if sources haven't changed
#
# Special variables set by jam:
# $(<) - targets of a rule (to the left of the :)
# $(>) - sources of a rule (to the right of the :)
# $(xxx) - true on xxx (UNIX, VMS, NT, OS2, MAC)
# $(OS) - name of OS - varies wildly
# $(JAMVERSION) - version number (2.3)
#
# Special variables used by jam:
# SEARCH - where to find something (used during binding and actions)
# LOCATE - where to plop something not found with SEARCH
# HDRRULE - rule to call to handle include files
# HDRSCAN - egrep regex to extract include files
#
# Special targets:
# all - default if none given on command line
#
# Initialize variables
#
#
# OS specific variable settings
#
if $(NT)
{
# the list of supported toolsets on Windows NT and Windows 95/98
#
local SUPPORTED_TOOLSETS =
"BORLANDC"
"VISUALC"
"VISUALC16"
"INTELC"
"WATCOM"
"MINGW"
"LCC"
;
# this variable holds the current toolset
#
TOOLSET = "" ;
# if the JAM_TOOLSET environment variable is defined, check that it is
# one of our supported values
#
if $(JAM_TOOLSET)
{
local t ;
for t in $(SUPPORTED_TOOLSETS)
{
if $(t) = $(JAM_TOOLSET) { TOOLSET = $(t) ; }
}
if ! $(TOOLSET)
{
ECHO "The JAM_TOOLSET environment variable is defined but its value" ;
ECHO "is invalid, please use one of the following:" ;
ECHO ;
for t in $(SUPPORTED_TOOLSETS) { ECHO " " $(t) ; }
EXIT ;
}
}
# if TOOLSET is empty, we'll try to detect the toolset from other
# environment variables to remain backwards compatible with Jam 2.3
#
if ! $(TOOLSET)
{
if $(BCCROOT)
{
TOOLSET = BORLANDC ;
BORLANDC = $(BCCROOT) ;
}
else if $(MSVC)
{
TOOLSET = VISUALC16 ;
VISUALC16 = $(MSVC) ;
}
else if $(MSVCNT)
{
TOOLSET = VISUALC ;
VISUALC = $(MSVCNT) ;
}
else if $(MINGW)
{
TOOLSET = MINGW ;
}
else
{
ECHO "Jam cannot be run because you didn't indicate which compilation toolset" ;
ECHO "to use. To do so, follow these simple instructions:" ;
ECHO ;
ECHO " - define one of the following environment variable, with the" ;
ECHO " appropriate value according to this list:" ;
ECHO ;
ECHO " Variable Toolset Description" ;
ECHO ;
ECHO " BORLANDC Borland C++ BC++ install path" ;
ECHO " VISUALC Microsoft Visual C++ VC++ install path" ;
ECHO " VISUALC16 Microsoft Visual C++ 16 bit VC++ 16 bit install" ;
ECHO " INTELC Intel C/C++ IC++ install path" ;
ECHO " WATCOM Watcom C/C++ Watcom install path" ;
ECHO " MINGW MinGW (gcc) MinGW install path" ;
ECHO " LCC Win32-LCC LCC-Win32 install path" ;
ECHO ;
ECHO " - define the JAM_TOOLSET environment variable with the *name*" ;
ECHO " of the toolset variable you want to use." ;
ECHO ;
ECHO " e.g.: set VISUALC=C:\Visual6" ;
ECHO " set JAM_TOOLSET=VISUALC" ;
ECHO ;
EXIT ;
}
}
CP ?= copy ;
RM ?= del ;
MV ?= move /Y ;
SLASH ?= \\ ;
SUFLIB ?= .lib ;
SUFOBJ ?= .obj ;
SUFEXE ?= .exe ;
if $(TOOLSET) = BORLANDC
{
ECHO "Compiler is Borland C++" ;
AR ?= tlib /C /P64 ;
CC ?= bcc32 ;
CCFLAGS ?= -q -y -d -v -w-par -w-ccc -w-rch -w-pro -w-aus ;
C++ ?= bcc32 ;
C++FLAGS ?= -q -y -d -v -w-par -w-ccc -w-rch -w-pro -w-aus -P ;
STDLIBPATH ?= $(BORLANDC)\\lib ;
STDHDRS ?= $(BORLANDC)\\include ;
LINK ?= $(CC) ;
LINKFLAGS ?= $(CCFLAGS) -L$(STDLIBPATH) ;
NOARSCAN ?= true ;
}
else if $(TOOLSET) = VISUALC16
{
ECHO "Compiler is Microsoft Visual C++ 16 bit" ;
AR ?= lib /nologo ;
CC ?= cl /nologo ;
CCFLAGS ?= /D \"WIN\" ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
LINK ?= $(CC) ;
LINKFLAGS ?= $(CCFLAGS) ;
LINKLIBS ?=
#$(VISUALC16)\\lib\\advapi32.lib
#$(VISUALC16)\\lib\\libcmt.lib
$(VISUALC16)\\lib\\mlibce.lib
#$(VISUALC16)\\lib\\slibce.lib
$(VISUALC16)\\lib\\oldnames.lib
#$(VISUALC16)\\lib\\kernel32.lib
;
LINKLIBS ?= ;
NOARSCAN ?= true ;
OPTIM ?= "" ;
STDHDRS ?= $(VISUALC16)\\include ;
UNDEFFLAG ?= "/u _" ;
}
else if $(TOOLSET) = VISUALC
{
ECHO "Compiler is Microsoft Visual C++" ;
AR ?= lib ;
AS ?= masm386 ;
CC ?= cl /nologo ;
CCFLAGS ?= "" ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
LINK ?= link /nologo ;
LINKFLAGS ?= "" ;
LINKLIBS ?= /LIBPATH:$(VISUALC)\\lib
/LIBPATH:$(VISUALC)\\PlatformSDK\\lib
advapi32.lib
libc.lib
oldnames.lib
gdi32.lib
user32.lib
kernel32.lib ;
OPTIM ?= "" ;
STDHDRS ?= $(VISUALC)\\include $(VISUALC)\\PlatformSDK\\include ;
UNDEFFLAG ?= "/u _" ;
}
else if $(TOOLSET) = INTELC
{
ECHO "Compiler is Intel C/C++" ;
if ! $(VISUALC)
{
ECHO "As a special exception, when using the Intel C++ compiler, you need" ;
ECHO "to define the VISUALC environment variable to indicate the location" ;
ECHO "of your Visual C++ installation. Aborting.." ;
EXIT ;
}
AR ?= lib ;
AS ?= masm386 ;
CC ?= icl /nologo ;
CCFLAGS ?= "" ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
LINK ?= link /nologo ;
LINKFLAGS ?= "" ;
LINKLIBS ?= $(VISUALC)\\lib\\advapi32.lib
$(VISUALC)\\lib\\libc.lib
$(VISUALC)\\lib\\oldnames.lib
$(VISUALC)\\lib\\kernel32.lib ;
OPTIM ?= "" ;
STDHDRS ?= $(INTELC)\include $(VISUALC)\\include ;
UNDEFFLAG ?= "/u _" ;
}
else if $(TOOLSET) = WATCOM
{
ECHO "Compiler is Watcom C/C++" ;
AR ?= wlib ;
CC ?= wcc386 ;
CCFLAGS ?= /zq /DWIN32 /I$(WATCOM)\\h ; # zq=quiet
C++ ?= wpp386 ;
C++FLAGS ?= $(CCFLAGS) ;
DOT ?= . ;
DOTDOT ?= .. ;
FORTRAN ?= wfc386 ;
LINK ?= wcl386 ;
LINKFLAGS ?= /zq ; # zq=quiet
LINKLIBS ?= ;
NOARSCAN ?= true ;
OPTIM ?= ;
STDHDRS ?= $(WATCOM)\\h $(WATCOM)\\h\\nt ;
UNDEFFLAG ?= "/u _" ;
}
else if $(TOOLSET) = MINGW
{
ECHO "Compiler is GCC with Mingw" ;
AR ?= ar -ru ;
CC ?= gcc ;
CCFLAGS ?= "" ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
FORTRAN ?= g77 ;
LINK ?= $(CC) ;
LINKFLAGS ?= "" ;
LINKLIBS ?= "" ;
OPTIM ?= ;
SUFOBJ = .o ;
SUFLIB = .a ;
# NOARSCAN ?= true ;
}
else if $(TOOLSET) = LCC
{
ECHO "Compiler is Win32-LCC" ;
AR ?= lcclib ;
CC ?= lcc ;
CCFLAGS ?= "" ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
LINK ?= lcclnk ;
LINKFLAGS ?= "" ;
LINKLIBS ?= "" ;
OPTIM ?= ;
NOARSCAN = true ;
}
else
{
EXIT On NT, did not recognize compiler type. ;
}
}
else if $(OS2)
{
# the list of supported toolsets on Windows NT and Windows 95/98
#
local SUPPORTED_TOOLSETS = "EMX" "WATCOM" ;
# this variable holds the current toolset
#
TOOLSET = "" ;
# if the JAM_TOOLSET environment variable is defined, check that it is
# one of our supported values
#
if $(JAM_TOOLSET)
{
local t ;
for t in $(SUPPORTED_TOOLSETS)
{
if $(t) = $(JAM_TOOLSET) { TOOLSET = $(t) ; }
}
if ! $(TOOLSET)
{
ECHO "The JAM_TOOLSET environment variable is defined but its value" ;
ECHO "is invalid, please use one of the following:" ;
ECHO ;
for t in $(SUPPORTED_TOOLSETS) { ECHO " " $(t) ; }
EXIT ;
}
}
# if TOOLSET is empty, we'll try to detect the toolset from other
# environment variables to remain backwards compatible with Jam 2.3
#
if ! $(TOOLSET)
{
if $(watcom)
{
WATCOM = $(watcom) ;
TOOLSET = WATCOM ;
}
else
{
ECHO "Jam cannot be run because you didn't indicate which compilation toolset" ;
ECHO "to use. To do so, follow these simple instructions:" ;
ECHO ;
ECHO " - define one of the following environment variable, with the" ;
ECHO " appropriate value according to this list:" ;
ECHO ;
ECHO " Variable Toolset Description" ;
ECHO ;
ECHO " WATCOM Watcom C/C++ Watcom install path" ;
ECHO " EMX EMX (gcc) EMX install path" ;
ECHO " VISUALAGE IBM Visual Age C/C++ VisualAge install path" ;
ECHO ;
ECHO " - define the JAM_TOOLSET environment variable with the *name*" ;
ECHO " of the toolset variable you want to use." ;
ECHO ;
ECHO " e.g.: set WATCOM=C:\WATCOM" ;
ECHO " set JAM_TOOLSET=WATCOM" ;
ECHO ;
EXIT ;
}
}
RM = del /f ;
CP = copy ;
MV ?= move ;
DOT ?= . ;
DOTDOT ?= .. ;
SUFLIB ?= .lib ;
SUFOBJ ?= .obj ;
SUFEXE ?= .exe ;
if $(TOOLSET) = WATCOM
{
AR ?= wlib ;
BINDIR ?= \\os2\\apps ;
CC ?= wcc386 ;
CCFLAGS ?= /zq /DOS2 /I$(WATCOM)\\h ; # zq=quiet
C++ ?= wpp386 ;
C++FLAGS ?= $(CCFLAGS) ;
LINK ?= wcl386 ;
LINKFLAGS ?= /zq ; # zq=quiet
LINKLIBS ?= ;
NOARSCAN ?= true ;
OPTIM ?= ;
SLASH ?= \\ ;
STDHDRS ?= $(WATCOM)\\h ;
UNDEFFLAG ?= "/u _" ;
}
else if $(TOOLSET) = EMX
{
ECHO "Compiler is GCC-EMX" ;
AR ?= ar -ru ;
CC ?= gcc ;
CCFLAGS ?= "" ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
LINK ?= $(CC) ;
LINKFLAGS ?= "" ;
LINKLIBS ?= "" ;
OPTIM ?= ;
SUFOBJ = .o ;
SUFLIB = .a ;
UNDEFFLAG ?= "-U" ;
SLASH = / ;
# NOARSCAN ?= true ;
}
else
{
# should never happen
EXIT "Sorry, but the $(JAM_TOOLSET) toolset isn't supported for now" ;
}
}
else if $(VMS)
{
C++ ?= cxx ;
C++FLAGS ?= ;
CC ?= cc ;
CCFLAGS ?= ;
CHMOD ?= set file/prot= ;
CP ?= copy/replace ;
CRELIB ?= true ;
DOT ?= [] ;
DOTDOT ?= [-] ;
EXEMODE ?= (w:e) ;
FILEMODE ?= (w:r) ;
HDRS ?= ;
LINK ?= link ;
LINKFLAGS ?= "" ;
LINKLIBS ?= ;
MKDIR ?= create/dir ;
MV ?= rename ;
OPTIM ?= "" ;
RM ?= delete ;
RUNVMS ?= mcr ;
SHELLMODE ?= (w:er) ;
SLASH ?= . ;
STDHDRS ?= decc$library_include ;
SUFEXE ?= .exe ;
SUFLIB ?= .olb ;
SUFOBJ ?= .obj ;
switch $(OS)
{
case OPENVMS : CCFLAGS ?= /stand=vaxc ;
case VMS : LINKLIBS ?= sys$library:vaxcrtl.olb/lib ;
}
}
else if $(MAC)
{
local OPT ;
CW ?= "{CW}" ;
MACHDRS ?=
"$(UMACHDRS):Universal:Interfaces:CIncludes"
"$(CW):MSL:MSL_C:MSL_Common:Include"
"$(CW):MSL:MSL_C:MSL_MacOS:Include" ;
MACLIBS ?=
"$(CW):MacOS Support:Universal:Libraries:StubLibraries:Interfacelib"
"$(CW):MacOS Support:Universal:Libraries:StubLibraries:Mathlib" ;
MPWLIBS ?=
"$(CW):MacOS Support:Libraries:Runtime:Runtime PPC:MSL MPWCRuntime.lib"
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL C.PPC MPW.Lib" ;
MPWNLLIBS ?=
"$(CW):MacOS Support:Libraries:Runtime:Runtime PPC:MSL MPWCRuntime.lib"
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL C.PPC MPW(NL).Lib" ;
SIOUXHDRS ?= ;
SIOUXLIBS ?=
"$(CW):MacOS Support:Libraries:Runtime:Runtime PPC:MSL RuntimePPC.lib"
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL SIOUX.PPC.Lib"
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL C.PPC.Lib" ;
C++ ?= mwcppc ;
C++FLAGS ?= -w off -nomapcr ;
CC ?= mwcppc ;
CCFLAGS ?= -w off -nomapcr ;
CP ?= duplicate -y ;
DOT ?= ":" ;
DOTDOT ?= "::" ;
HDRS ?= $(MACHDRS) $(MPWHDRS) ;
LINK ?= mwlinkppc ;
LINKFLAGS ?= -mpwtool -warn ;
LINKLIBS ?= $(MACLIBS) $(MPWLIBS) ;
MKDIR ?= newfolder ;
MV ?= rename -y ;
NOARSCAN ?= true ;
OPTIM ?= ;
RM ?= delete -y ;
SLASH ?= ":" ;
STDHDRS ?= ;
SUFLIB ?= .lib ;
SUFOBJ ?= .o ;
}
else if $(OS) = BEOS && $(METROWERKS)
{
AR ?= mwld -xml -o ;
BINDIR ?= /boot/apps ;
CC ?= mwcc ;
CCFLAGS ?= -nosyspath ;
C++ ?= $(CC) ;
C++FLAGS ?= -nosyspath ;
FORTRAN ?= "" ;
LIBDIR ?= /boot/develop/libraries ;
LINK ?= mwld ;
LINKFLAGS ?= "" ;
MANDIR ?= /boot/documentation/"Shell Tools"/HTML ;
NOARSCAN ?= true ;
STDHDRS ?= /boot/develop/headers/posix ;
}
else if $(OS) = BEOS
{
BINDIR ?= /boot/apps ;
CC ?= gcc ;
C++ ?= $(CC) ;
FORTRAN ?= "" ;
LIBDIR ?= /boot/develop/libraries ;
LINK ?= gcc ;
LINKLIBS ?= -lnet ;
NOARSCAN ?= true ;
STDHDRS ?= /boot/develop/headers/posix ;
}
else if $(UNIX)
{
switch $(OS)
{
case AIX :
LINKLIBS ?= -lbsd ;
case AMIGA :
CC ?= gcc ;
YACC ?= bison ;
case CYGWIN :
CC ?= gcc ;
CCFLAGS += -D__cygwin__ ;
LEX ?= flex ;
JAMSHELL ?= sh -c ;
RANLIB ?= "" ;
SUFEXE ?= .exe ;
YACC ?= bison ;
case DGUX :
RANLIB ?= "" ;
RELOCATE ?= true ;
case HPUX :
RANLIB ?= "" ;
case INTERIX :
CC ?= gcc ;
JAMSHELL ?= sh -c ;
RANLIB ?= "" ;
case IRIX :
RANLIB ?= "" ;
case MPEIX :
CC ?= gcc ;
C++ ?= gcc ;
CCFLAGS += -D_POSIX_SOURCE ;
HDRS += /usr/include ;
RANLIB ?= "" ;
NOARSCAN ?= true ;
NOARUPDATE ?= true ;
case MVS :
RANLIB ?= "" ;
case NEXT :
AR ?= libtool -o ;
RANLIB ?= "" ;
case MACOSX :
AR ?= libtool -o ;
C++ ?= c++ ;
MANDIR ?= /usr/local/share/man ;
RANLIB ?= "" ;
case NCR :
RANLIB ?= "" ;
case PTX :
RANLIB ?= "" ;
case QNX :
AR ?= wlib ;
CC ?= cc ;
CCFLAGS ?= -Q ; # quiet
C++ ?= $(CC) ;
C++FLAGS ?= -Q ; # quiet
LINK ?= $(CC) ;
LINKFLAGS ?= -Q ; # quiet
NOARSCAN ?= true ;
RANLIB ?= "" ;
case SCO :
RANLIB ?= "" ;
RELOCATE ?= true ;
case SINIX :
RANLIB ?= "" ;
case SOLARIS :
RANLIB ?= "" ;
AR ?= "/usr/ccs/bin/ar ru" ;
case UNICOS :
NOARSCAN ?= true ;
OPTIM ?= -O0 ;
case UNIXWARE :
RANLIB ?= "" ;
RELOCATE ?= true ;
}
# UNIX defaults
CCFLAGS ?= ;
C++FLAGS ?= $(CCFLAGS) ;
CHMOD ?= chmod ;
LEX ?= lex ;
LINKFLAGS ?= $(CCFLAGS) ;
LINKLIBS ?= ;
OPTIM ?= -O ;
RANLIB ?= ranlib ;
YACC ?= yacc ;
YACCFILES ?= y.tab ;
YACCFLAGS ?= -d ;
}
#
# General defaults; a lot like UNIX
#
AR ?= ar ru ;
AS ?= as ;
ASFLAGS ?= ;
AWK ?= awk ;
BINDIR ?= /usr/local/bin ;
C++ ?= gcc ;
C++FLAGS ?= ;
CC ?= gcc ;
CCFLAGS ?= ;
CP ?= cp -f ;
CRELIB ?= ;
DOT ?= . ;
DOTDOT ?= .. ;
EXEMODE ?= 711 ;
FILEMODE ?= 644 ;
FORTRAN ?= g77 ;
FORTRANFLAGS ?= ;
HDRS ?= ;
JAMFILE ?= Jamfile ;
JAMRULES ?= Jamrules ;
LEX ?= lex ;
LIBDIR ?= /usr/local/lib ;
LINK ?= $(CC) ;
LINKFLAGS ?= ;
LINKLIBS ?= ;
LN ?= ln ;
MANDIR ?= /usr/local/man ;
MKDIR ?= mkdir ;
MV ?= mv -f ;
OPTIM ?= ;
RCP ?= rcp ;
RM ?= rm -f ;
RSH ?= rsh ;
SED ?= sed ;
SHELLHEADER ?= "#!/bin/sh" ;
SHELLMODE ?= 755 ;
SLASH ?= / ;
STDHDRS ?= /usr/include ;
SUFEXE ?= "" ;
SUFLIB ?= .a ;
SUFOBJ ?= .o ;
UNDEFFLAG ?= "-u _" ;
YACC ?= ;
YACCFILES ?= ;
YACCFLAGS ?= ;
HDRPATTERN =
"^[ ]*#[ ]*include[ ]*[<\"]([^\">]*)[\">].*$" ;
OSFULL = $(OS)$(OSVER)$(OSPLAT) $(OS)$(OSPLAT) $(OS)$(OSVER) $(OS) ;
#
# Base dependencies - first for "bootstrap" kinds of rules
#
DEPENDS all : shell files lib exe obj ;
DEPENDS all shell files lib exe obj : first ;
NOTFILE all first shell files lib exe obj dirs clean uninstall ;
ALWAYS clean uninstall ;
#
# Rules
#
rule As
{
DEPENDS $(<) : $(>) ;
ASFLAGS on $(<) += $(ASFLAGS) $(SUBDIRASFLAGS) ;
}
rule Bulk
{
local i ;
for i in $(>)
{
File $(i:D=$(<)) : $(i) ;
}
}
rule Cc
{
local _h ;
DEPENDS $(<) : $(>) ;
# Just to clarify here: this sets the per-target CCFLAGS to
# be the current value of (global) CCFLAGS and SUBDIRCCFLAGS.
CCFLAGS on $(<) += $(CCFLAGS) $(SUBDIRCCFLAGS) ;
# If the compiler's -o flag doesn't work, relocate the .o
if $(RELOCATE)
{
CcMv $(<) : $(>) ;
}
_h = $(SEARCH_SOURCE) $(HDRS) $(SUBDIRHDRS) ;
if $(VMS) && $(_h)
{
SLASHINC on $(<) = "/inc=(" $(_h[1]) ,$(_h[2-]) ")" ;
}
else if $(MAC) && $(_h)
{
local _i _j ;
_j = $(_h[1]) ;
for _i in $(_h[2-])
{
_j = $(_j),$(_i) ;
}
MACINC on $(<) = \"$(_j)\" ;
}
}
rule C++
{
local _h ;
DEPENDS $(<) : $(>) ;
C++FLAGS on $(<) += $(C++FLAGS) $(SUBDIRC++FLAGS) ;
if $(RELOCATE)
{
CcMv $(<) : $(>) ;
}
_h = $(SEARCH_SOURCE) $(HDRS) $(SUBDIRHDRS) ;
if $(VMS) && $(_h)
{
SLASHINC on $(<) = "/inc=(" $(_h[1]) ,$(_h[2-]) ")" ;
}
else if $(MAC) && $(_h)
{
local _i _j ;
_j = $(_h[1]) ;
for _i in $(_h[2-])
{
_j = $(_j),$(_i) ;
}
MACINC on $(<) = \"$(_j)\" ;
}
}
rule Chmod
{
if $(CHMOD) { Chmod1 $(<) ; }
}
rule File
{
DEPENDS files : $(<) ;
DEPENDS $(<) : $(>) ;
SEARCH on $(>) = $(SEARCH_SOURCE) ;
MODE on $(<) = $(FILEMODE) ;
Chmod $(<) ;
}
rule Fortran
{
DEPENDS $(<) : $(>) ;
}
rule GenFile
{
local _t = [ FGristSourceFiles $(<) ] ;
local _s = [ FAppendSuffix $(>[1]) : $(SUFEXE) ] ;
Depends $(_t) : $(_s) $(>[2-]) ;
GenFile1 $(_t) : $(_s) $(>[2-]) ;
Clean clean : $(_t) ;
}
rule GenFile1
{
MakeLocate $(<) : $(LOCATE_SOURCE) ;
SEARCH on $(>) = $(SEARCH_SOURCE) ;
}
rule HardLink
{
DEPENDS files : $(<) ;
DEPENDS $(<) : $(>) ;
SEARCH on $(>) = $(SEARCH_SOURCE) ;
}
rule HdrMacroFile
{
# HdrMacroFile file ;
#
# this rule is used to indicate that a given file contains definitions
# for filename macros (e.g. "#define MYFILE_H <myfile.h>") that can
# later be used in #include statements in the rest of the source
#
# theses files must be parsed before any make is tried..
#
HDRMACRO $(<) ;
}
rule HdrRule
{
# HdrRule source : headers ;
# N.B. This rule is called during binding, potentially after
# the fate of many targets has been determined, and must be
# used with caution: don't add dependencies to unrelated
# targets, and don't set variables on $(<).
# Tell Jam that anything depending on $(<) also depends on $(>),
# set SEARCH so Jam can find the headers, but then say we don't
# care if we can't actually find the headers (they may have been
# within ifdefs),
local s ;
if $(HDRGRIST)
{
s = $(>:G=$(HDRGRIST)) ;
} else {
s = $(>) ;
}
INCLUDES $(<) : $(s) ;
SEARCH on $(s) = $(HDRSEARCH) ;
NOCARE $(s) ;
# Propagate on $(<) to $(>)
HDRSEARCH on $(s) = $(HDRSEARCH) ;
HDRSCAN on $(s) = $(HDRSCAN) ;
HDRRULE on $(s) = $(HDRRULE) ;
HDRGRIST on $(s) = $(HDRGRIST) ;
}
rule InstallInto
{
local i t ;
t = $(>:G=installed) ;
DEPENDS install : $(t) ;
DEPENDS $(t) : $(>) ;