-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathJambase
executable file
·4686 lines (4035 loc) · 121 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-2002 Christopher Seiwald and Perforce Software, Inc.
# \+/
#
# This file is part of Jam - see jam.c for Copyright information.
#
# The Copyright information in jam.c reads:
#
#/*
# * /+\
# * +\ Copyright 1993-2002 Christopher Seiwald and Perforce Software, Inc.
# * \+/
# *
# * This file is part of jam.
# *
# * License is hereby granted to use this software and distribute it
# * freely, as long as this copyright notice is retained and modifications
# * are clearly marked.
# *
# * ALL WARRANTIES ARE HEREBY DISCLAIMED.
# */
# MODIFIDED version of jam 2.5 Jambase, for the ArgyllCMS project by Graeme W. Gill.
# These modifications are herebye licensed under the same conditions
# as as the rest of Jam, as detailed above.
# Moved to a "Normalized" scheme, where Jamfile UNIX style target paths
# are converted to platform specific, Jamfile relative, Gristed/SEARCH/LOCATE
# form internally. Creating the tree is simplified by eliminating the SubDir
# rule. Better support for MingW, OS X. More comprehensive ruleset.
# Renamed Jamrules to Jamtop.
#
# JAMBASE - jam 2.5 ruleset providing make(1)-like functionality
#
# Supports UNIX, NT, and VMS.
#
# 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
# install - parent of all Install targets
# clean - removes all Shell, File, Library, and Main targets
# uninstall - removes all Install targets
#
# Rules defined by this file:
#
# As obj : source.s ; .s -> .o
# Bulk dir : files ; populate directory with many files
# Cc obj : src.c : flags : defines : hdrpaths
# .c -> .o
# C++ obj : src.cc : flags : defines : hdrpaths
# .cc -> .o
# Clean clean : sources ; remove sources with 'jam clean'
# File dest : source ; copy file
# FileNoClean dest : source ; copy file, but don't delete dest during clean
# FakeFile dest : source ; Fudge to say dest is created with source
# Fortran obj.o : source.f ; .f -> .o
# GenFile target : program args ; make custom file
# GenFileND target : program args : extra_dependecies ;
# make custom file, program dependent & args not
# GenFileNND target : program args : extra_dependecies ;
# make custom file, program & args not dependent
# GenFileNNDnc target : program args : extra_dependecies ;
# Same as GenFileNND but don't clean the target.
# CatToFile dest : strings ; save the arguments to the file
# GuiBin image ; Mark executable as GUI applications
# (Needs to go before other declarations of image)
# 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
# InstallShLib 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 library : sources : flags : defines : hdrpaths : objects
# static library from compiled sources
# LibraryFromLibraries lib : libs ; static library from static libraries
# LibraryFromObjects lib : objects ; static library from objects
# LinkLibraries images : libraries ; add static libraries onto Mains
# LinkObjects images : objects ; add objects onto Mains
# LinkShLibraries images : shlibraries ; add shared libraries onto Mains
# Main image : sources : flags : defines : hdrpaths : objects : libs : shlibs ;
# create exe from compiled sources
# MainsFromSources sources ; create exes each from their source
# MainFromObjects image : objects : libs : shlibs ;
# create executable from objects
# MainVariant image : sources : flags : defines : hdrpaths : objects : libs : shlibs ;
# create exe from compiled sources with separate named objs
# MainLinkFlags mains : flags ; add linker flags for object
# MkDir dir ; make a directory, if not there
# Mod target : mode ; sets mode of file
# NDepends dest : source ; make Normalized dependency
# NNoUpdate targ ; create Normalized target if needed but never update it
# NIncludes dest : source ; make Normalized co-dependency
# Object object : sources : flags : defines : hdrpaths ; compile object from source
# ObjectCcFlags objects : flags ; add compiler flags for object
# ObjectPrefCcFlags objects : flags ; add preference compiler flags for object (overridable)
# ObjectC++Flags objects : flags ; add compiler flags for object
# ObjectPrefC++Flags objects : flags ; add preference compiler flags for object (overridable)
# ObjectDefines objects : defines ; add defines for object
# ObjectHdrs objects : dirs ; add include directories for object
# ObjectKeep objects ; mark objects to be kept after library build
# Objects sources : flags : defines : hdrpaths compile sources
# PeerInclude dir ; include peer Jamfile
# FindTop ; Set TOP by locating JAMTOP file above SUBDIR
# ProjTop d1 d2 .. ; Set project TOP
# RmTemps target : sources ; remove temp sources after target made
# Setuid images ; mark executables Setuid
# set SHLINKDEFFILE on for Windows to define exports using .def file.
# set SHLINKSEARCHEXEPATH true on UNIX/OSX to have applications search exeutable location for it
# ShLibrary shlib : source ; link shared library from compiled sources
# ShLibraryFromObjects shlib : objects ; link shared library from objects
# ShLibraryLibraries shlib : libraries ; add static libraries onto shared libraries link
# ShLibraryObjects shlib : objects ; add objects onto shared libraries link
# ShLibraryShLibraries shlib : shlibraries ; add shared libraries onto shared libraries link
# SoftLink target : source ; make symlink from source to target
# SubInclude dir ; include sub 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
# Aswig : source.i ; .i -> .h _i.c .hpp
#
# Utility rules
#
# val = geton var : varname ; return the value of varname on var
# paths = NormPaths paths [ : dir ] ; normalize a set of paths relative to SUBDIR or dir
# paths = NormSrcPaths paths [ : dir ] ; NormPaths with SRCDIR
# paths = NormDstPaths paths [ : dir ] ; NormPaths with DSTDIR
# paths = NormSrcTargets paths [ : dir ] ; normalize source targets, set Grist NOMLOC SEARCH
# paths = NormDstTargets paths [ : dir ] ; normalize destination targets, set Grist NOMLOC LOCATE
# paths = NormISrcTargets paths [ : dir ] ; Same as NormSrcTargets but ignore SRCDIR
# paths = NormIDstTargets paths [ : dir ] ; Same as NormDstTargets but ignore DSTDIR
#
# More utility rules that have no side effects :
#
# FAppendSuffix f1 f2 ... : $(SUF) ; return $(<) with suffixes if no current suffixes
# FStripCommon v1 : v2 ; strip common initial parts of v1 v2
# FReverse a1 a2 ... ; return ... a2 a1
# FDelEmpty a1 a2 ... ; return a1 a2 ... with any empty elements deleted
#
# Variables:
#
# Sub-Jamfile build variables, optionaly set in each Sub-Jamfile. They will
# be picked up by subsequent rules that set target relationships and
# creation rules. They are added to any Parent-Jamfile variables,
# and become the Parent-Jamfile variables of any SubIncludes.
# Relative file/path variables are anchored by the Jamfile location.
#
# ASFLAGS - Flags for the assembler.
# CCFLAGS - Flags for the C compiler.
# C++FLAGS - Flags for the C++ compiler.
# LINKFLAGS - Flags for the executable linker.
# SHLINKFLAGS - Flags for the shared library linker.
# HDRS - Complile header search directories
# DEFINES - Compile defines
# LINKOBJS - Link extra objects
# LINKLIBS - Link extra libraries
# LINKSHLIBS - Link extra shared libraries
# SHLINKOBJS - ShLibrary Linker extra objects
# SHLINKLIBS - ShLibrary Linker extra libraries
# SHLINKSHLIBS - ShLibrary Linker extra shared libraries
#
# Sub-directory preferred build flags, e.g. optimizations etc. These will only
# have effect if not set by a parent Jamfile (ie. involked from a leaf Jamfile).
#
# PREF_ASFLAGS
# PREF_CCFLAGS
# PREF_C++FLAGS
# PREF_LINKFLAGS
# PREF_SHLINKFLAGS
#
# Parent-Jamfile build variables. These are the accumulated
# values from any Parent Jamfiles, and will be added to any
# Sub-Jamfile variables when a rule picks them up.
# File/path variables will have been normalized.
#
# P_ASFLAGS - Flags for the assembler.
# P_CCFLAGS - Flags for the C compiler.
# P_C++FLAGS - Flags for the C++ compiler.
# P_LINKFLAGS - Flags for the executable linker.
# P_SHLINKFLAGS - Flags for the shared library linker.
# P_HDRS - Complile header search directories
# P_DEFINES - Compile defines
# P_LINKOBJS - Link extra objects
# P_LINKLIBS - Link extra libraries
# P_LINKSHLIBS - Link extra shared libraries
# P_SHLINKOBJS - ShLibrary Linker extra objects
# P_SHLINKLIBS - ShLibrary Linker extra libraries
# P_SHLINKSHLIBS - ShLibrary Linker extra shared libraries
#
# Pre-defined values
#
# Pre-packaged flags that conceal platform dependence,
# and are used to set CCFLAGS/C++FLAGS/LINKFLAGS/SHLINLFLAGS etc.
#
# CCOPTFLAG - CC/C++ flag for optimization
# CCDEBUGFLAG - CC/C++ flag for debug
# CCPROFFLAG - CC/C++ flag for performance profiling
# CCSHOBJFLAG - CC/C++ flag for compiling for a shared library (UNIX)
#
# LINKOPTFLAG - LINK flag for optimization of the binary/shared library
# LINKDEBUGFLAG - LINK flag to support debugging
# LINKPROFFLAG - LINK flag to support performance profiling
# LINKSTRIPFLAG - LINK flag to strip binary of any symbols
#
# Location variables:
#
# DSTDIR - puts all products in a subdirectory of their nominated location.
# Useful for storing variants in their own areas.
#
# SRCDIR - Looks for all sources and Jamfiles in an alternate top level source
# location. Useful for accessing a read only source repository, or
# building a variant without copying all the sources.
# Note that at least the project Jamtop must be in the location
# that is the target for the build, and will most likely be where
# SRCDIR is set. SRCDIR is the location of the sources relative
# to where it is declared.
# (Not currently useful for a shadow build repository where the source
# is spread between the SRCDIR and the build dir, because Jam 2.5 fails
# to look at SEARCH if LOCATE is set).
#
# =========================================================================
# ArgyllCMS Normalize mods:
#
# The main change is to locate and identify targets using their nominated location in the
# filesystem. This eliminates the need to create Grist, or manipulate SEARCH, LOCATE etc.
# when setting up a herachy of Jamfiles.
#
# Whenever a path is provided as an argument to one of the public rules, its path is assumed
# to be relative to the Jamfile that it is declared in. [ The NormPaths/NormTargets rules do this. ]
# Naturally absolute paths are not affected by this.
# During execution this means that all files are translated to paths that are
# in a normalized form, with either an absolute path or one that is relative to
# the directory that Jam was involked in. For simplicity it is assumed that
# the Jamfile contains UNIX style paths, and these are converted to the
# platform specific form on normalization.
#
# For a target, the normalized directory is then stripped from the name and
# set as the Grist (path elements separated by !), and also set in the NOMLOC,
# LOCATE and SEARCH variables "on" the target. This gives a target a unique
# identity for the whole of the build, determined by its nominated file system location.
# The NOMLOC variable is a way of recovering it's location without having the reverse
# the Grist strings. The actual location of the target can then be varied by
# augmenting it's LOCATE and/or SEARCH variables.
#
# Any include file discovered by header scanning is searched for using the
# search path that is expected to be used during compilation, and
# its nominated location resolved this way. Any headers that are not
# located this way or who's location isn't declared by another rule (the
# latter being typical when headers are being generated) will be marked as
# being in an __unknown__ directory and will not be scaned. Normally any
# header files located in the STDHDRS directories will not be scanned either.
#
# [ Typically headers will be __unknown__ if the STDHDRS directories do
# not reflect the default paths actually searched by the compiler, or if a
# header is not actually going to be #included because it is protected
# by an #ifdef. ]
# Argyll Jambase internal implementation rules:
# IDs = _TargetIDs targpaths ; return target ID's (gristed) from normalized paths
# path = DeNormTargs target ; return the original path
# CopyTarget dest : source ; duplicate a targets on NOMLOC LOCATE SEARCH variables.
# NotTargets vars ; ensure variables aren't treated as LOCATE etc targets
# d1 d2 ... file = _SepPath path ; separate a path into its components
# path = _DirName d1 d2 ... ; combine components into a path
# d1 d2 .. = _RatPath d1 d2 .. rationalize a path
# d1 d2 .. = _RootPath d1 d2 .. : p1 p2 ... re-root a path
# paths = RatPaths paths ; rationalize a set of paths
# paths = RootPaths dir : paths ; re-root a set of paths
# targs = CreateIDstTargets targs : dir ; create dest targets by locating targets in dir
# paths1/paths = CatPaths path1 : paths ; concatenate paths separated by a /
# found = FindToRoot starting_dir : file ; Try and locate file from directory up to root.
# FindTop ; # Look for a default project file
# DoInit ; Do subdir initialization (done by JAMBASE)
# public write/read Variables:
#
# TRACESTDHDRS # Normally false, set to true to trace system path #include file dependenicies
# public read only Variables:
#
# SUBDIR d1/d2/d3 # Current path from PWD to Jamfile
# TOP d1/d2/d3 # Current path from PWD to the project Jamtop
# internal variables
#
# _SUBDIR d1 d2 d3 ... # Current path from PWD to Jamfile
# _TOP d1 d2 d3 # Current path from PWD to the project Jamtop
# - - - - - - - - - - - - - - -
# NOTE: Cross compiling support :-
# To fix this to support cross compilation, the setup needs to be
# modularised into 3 parts, making them all rules that can be re-involked:
# 1) OS/Platform setup. System tools like copy, delete etc.
# 2) Compiler setup. Basic compiler syntax etc.
# 3) Target setup. Make this a rule, and allow switching
# target by involking the rule. This will be simpler to
# get working that per target 'on' variable (some
# things are currently broken for 'on' variables, such
# as library members, and it will be easier to do
# things such as switch compilers.
# - - - - - - - - - - - - - - -
# 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
# NOTE: can have only one $(<), or parallel builds stuff up!!
# Use FakeFile to work around the problem.
# 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.5)
#
# 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
#
# for perforce use -- jambase version
JAMBASEDATE = 2008.03.26 ;
# Initialize variables
#
# ===========================================================
#
# OS specific variable settings
#
if $(NT)
{
MV ?= move /y ;
CP ?= copy ;
RM ?= del /f/q ;
RMDIR ?= rmdir /s/q ;
SLASH ?= \\ ;
SUFLIB ?= .lib ;
SUFSHLIB ?= .dll ;
SUFIMPLIB ?= .lib ;
SUFOBJ ?= .obj ;
SUFEXE ?= .exe ;
SUFSH ?= .bat ;
CCSHOBJFLAG ?= ;
if $(BCCROOT)
{
AR ?= tlib /C /P64 ;
CC ?= bcc32 ;
CCFLAGS ?= -v -w- -q -DWIN -tWR -tWM -tWC ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) -P ;
LINK ?= $(CC) ;
LINKFLAGS ?= ;
STDLIBPATH ?= $(BCCROOT)\\lib ;
STDHDRS ?= $(BCCROOT)\\include ;
NOARSCAN ?= true ;
}
else if $(MingW) || $(MINGW)
{
# We need to do something about adding -Wl,-subsystem,windows
# if WinMain is being used ? (it defaults to console)
MINGW ?= $(MingW) ;
TPFX = "" ;
if [ GLOB $(MINGW)/bin : x86_64-w64-mingw32-gcc.exe ] {
MINGW64 = $(MINGW) ;
}
# This doesn't work on a 32 bit system because we're cross
# compiling and need to create build system exe's
# (tiff/mkversion.exe, imdi/imdi_make.exe
# Will using -m32 for local exe's fix this ?
# What is multi-lib option ???
if $(MINGW64) {
ECHO "Compiler is MingW for 64 bit target" ;
TARGET64 = true ;
TPFX = x86_64-w64-mingw32- ;
MINGW64_LIB32 = $(MINGW)/mingw/lib32 ;
} else {
ECHO "Compiler is MingW for 32 bit target" ;
}
# Basic C/C++ tools
AR ?= $(TPFX)ar rusc ;
AS ?= $(TPFX)as ;
CC ?= $(TPFX)gcc ;
CCFLAGS ?= -DNT -mwin32 -pipe ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
OLELIBS ?= -loleaut32 -luuid ;
BASELIBS ?= -lstdc++ -lgcc -lodbc32 -lwsock32 ;
# WINLIBS ?= -lwinspool -lwinmm -lshell32 -lcomctl32 -lctl3d32
# -lodbc32 -ladvapi32 -lodbc32 -lwsock32 -lopengl32
# -lglu32 -lshlwapi -lsetupapi ;
WINLIBS ?= -lshlwapi -lsetupapi -lole32 -lws2_32 -lpsapi -lversion ;
GUILIBS ?= -lgdi32 -lmscms ;
LINK ?= $(TPFX)g++ ; # In case we link to C++ files
LINKFLAGS ?= -static ;
SHLINKFLAGS ?= ;
STDLIBS ?= -lm $(OLELIBS) $(WINLIBS) $(GUILIBS) ;
SHSTDLIBS ?= $(STDLIBS) ;
STDHDRS ?= $(MINGW)\\include ;
# Not sure whether linker -mconsole or -mwindow are needed ??
# Allow setting of flags, independent of compiler
DEFFLAG ?= -D ;
UNDEFFLAG ?= -U ;
CCOPTFLAG ?= -O2 ;
if $(PROCESSOR_LEVEL) = 15
{ # -mtune seems faster than -march !!!
# CCOPTFLAG += -mtune=pentium4 ;
# CCOPTFLAG += -mtune=prescott ;
CCOPTFLAG += -mtune=nocona ; # portable code for Pentium4 640
# CCOPTFLAG += -march=nocona -mfpmath=sse -msse3 ; # non-portable
}
CCDEBUGFLAG ?= -g ; # default (TABS? DWARF2 ?) format
CCPROFFLAG ?= -pg ;
LINKDEBUGFLAG ?= -g ;
LINKPROFFLAG ?= -pg ;
LINKOPTFLAG ?= -s -O ; # Affects creating .so's ??
LINKSTRIPFLAG ?= -s ;
# Other tools
AWK ?= awk ;
SED ?= sed ;
# YACC ?= yacc ;
# YACCFLAGS ?= -d ;
# YACCFILES ?= y.tab ;
YACC ?= bison -y ;
YACCGEN ?= .c ;
YACCFILES ?= y.tab ;
YACCFLAGS ?= -d ;
# gcc assembler listing:
# -g -O -Wa,-aslh source.cpp > list.txt
# -save-temps
# -fdump-tree-all'
}
else if $(MSVC) #
{
ECHO "Compiler is VC++ 16 bit" ;
AR ?= lib /nologo ;
CC ?= cl /nologo ;
CCFLAGS ?= /D \"WIN\" ;
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) ;
LINK ?= $(CC) ;
LINKFLAGS ?= ;
STDLIBS ?=
$(MSVC)\\lib\\mlibce.lib
$(MSVC)\\lib\\oldnames.lib
;
NOARSCAN ?= true ;
STDHDRS ?= $(MSVC)\\include ;
DEFFLAG ?= /D ;
UNDEFFLAG ?= "/u _" ;
}
else if $(TARGET_ARCH)
{
# Intel C++ compiler (ICL)
# No IA64 dir
local I ; I = "" ;
AR ?= lib /NOLOGO ;
AS ?= masm386 ;
CC ?= icl /nologo ;
CCFLAGS ?= /DNT /MD ; # DLL compatible build by default
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) /GX ; # GX enables syncronous exception handling
LINK ?= xilink /nologo ;
LINKOUTFLAG ?= /out: ;
LINKFLAGS ?= ; # iclvars.bat [arch] sets this up
SHLINKFLAGS ?= ;
STDLIBS ?=
oldnames.lib
kernel32.lib
advapi32.lib
user32.lib
mscms.lib
gdi32.lib
shlwapi.lib
shell32.lib
setupapi.lib
ole32.lib
oleaut32.lib
ws2_32.lib
Wbemuuid.lib
;
SHSTDLIBS ?= $(STDLIBS) ;
LINKFLAG ?= ;
STDHDRS ?= $(ICPP_COMPILER14)\\Include ;
DEFFLAG ?= /D ;
UNDEFFLAG ?= /U ;
CCOPTFLAG ?= /O2 ;
if $(MSVCVER) = 6 {
CCDEBUGFLAG ?= /Od /Z7 ; # Include debugging into in each object
CCPROFFLAG ?= /Od /Z7 ;
LINKDEBUGFLAG ?= /DEBUGTYPE:BOTH /DEBUG /PDB:NONE ;
} else {
CCDEBUGFLAG ?= /Od /Zi ; # /Zi creates debugging database
CCPROFFLAG ?= /Od /Zi ;
LINKDEBUGFLAG ?= /DEBUG ;
}
LINKPROFFLAG ?= /PROFILE $(LINKDEBUGFLAG) ;
LINKOPTFLAG ?= /OPT:REF ;
LINKSTRIPFLAG ?= ;
YACC ?= bison -y ;
YACCGEN ?= .c ;
YACCFILES ?= y.tab ;
YACCFLAGS ?= -d ;
}
else if $(MSVCNT) || $(MSVCDIR) || $(MSVCDir) || $(VCINSTALLDIR)
{
# Visual C++ 8.0/9.0/10.0/11.0/12.0 uses VCINSTALLDIR
# We assume VC++ Express + XP32 SDK has been setup
if $(VCINSTALLDIR) {
MSVCNT ?= $(VCINSTALLDIR) ;
} else if $(MSVCDir) {
MSVCNT ?= $(MSVCDir) ;
} else { # Visual C++ 6.0 uses MSVCDIR
MSVCNT ?= $(MSVCDIR) ;
}
if [ MATCH 16\\.(.*) : $(VisualStudioVersion) ] {
ECHO "Compiler is VC++16 (AKA Community 2019)" ;
MSVCVER = 16 ;
} else if [ MATCH 15\\.(.*) : $(VisualStudioVersion) ] {
ECHO "Compiler is VC++15 (AKA Community 2017)" ;
MSVCVER = 15 ;
} else if [ MATCH 14\\.(.*) : $(VisualStudioVersion) ] {
ECHO "Compiler is VC++14 32 bit" ;
MSVCVER = 14 ;
} else if [ MATCH 13\\.(.*) : $(VisualStudioVersion) ] {
ECHO "Compiler is VC++13 32 bit" ;
MSVCVER = 13 ;
} else if [ MATCH 12\\.(.*) : $(VisualStudioVersion) ] {
ECHO "Compiler is VC++12 32 bit" ;
MSVCVER = 12 ;
} else if [ MATCH 11\\.(.*) : $(VisualStudioVersion) ] {
ECHO "Compiler is VC++11 32 bit" ;
MSVCVER = 11 ;
} else if $(VisualStudioVersion) {
ECHO "Compiler VC++, unknown version " ;
MSVCVER = 15 ;
} else if [ MATCH (.*)VC\\+\\+10(.*) : $(MSVCNT) ] {
ECHO "Compiler is VC++10 32 bit" ;
MSVCVER = 10 ;
} else if [ MATCH (.*)VC\\+\\+9(.*) : $(MSVCNT) ] {
ECHO "Compiler is VC++9 32 bit" ;
MSVCVER = 9 ;
} else if [ MATCH (.*)VC\\+\\+8(.*) : $(MSVCNT) ] {
ECHO "Compiler is VC++8 32 bit" ;
MSVCVER = 8 ;
} else {
ECHO "Compiler is VC++6 32 bit" ;
MSVCVER = 6 ;
}
# Add the SDK include and lib if it is present
if $(MSSdk) {
MSNTSDK ?= $(MSSdk) ;
} else if $(MSSDK) {
MSNTSDK ?= $(MSSDK) ;
} else if $(MSVCNT) {
MSNTSDK ?= $(MSVCNT) ;
}
# bury IA64 in the path for the SDK ???
# (but MSSDK already has this ?
# local I ; if $(CPU) = "IA64" { I = ia64\\ ; } else { I = "" ; }
local I ; I = "" ;
AR ?= lib /NOLOGO ;
AS ?= masm386 ;
CC ?= cl /nologo ;
CCFLAGS ?= /DNT /MD ; # DLL compatible build by default
if $(MSVCVER) >= 8 {
CCFLAGS += /D_CRT_SECURE_NO_DEPRECATE=1
/D_CRT_NONSTDC_NO_DEPRECATE=1 ;
}
C++ ?= $(CC) ;
C++FLAGS ?= $(CCFLAGS) /GX ; # GX enables syncronous exception handling
LINK ?= link /nologo ;
LINKOUTFLAG ?= /out: ;
LINKFLAGS ?= /STACK:16000000 /INCREMENTAL:NO /LIBPATH:$(MSNTSDK)\\lib\\$(I) ;
SHLINKFLAGS ?= ;
STDLIBS ?=
oldnames.lib
kernel32.lib
advapi32.lib
user32.lib
mscms.lib
gdi32.lib
shlwapi.lib
shell32.lib
setupapi.lib
ole32.lib
oleaut32.lib
ws2_32.lib
Wbemuuid.lib
Version.lib
# Winmm.lib
;
if $(MSVCVER) >= 8 {
STDLIBS += psapi.lib ;
}
SHSTDLIBS ?= $(STDLIBS) ;
LINKFLAG ?= ;
STDHDRS ?= $(MSNTSDK)\\Include ;
DEFFLAG ?= /D ;
UNDEFFLAG ?= /U ;
CCOPTFLAG ?= /O2 ; # MSVC9 doesn't understamd GB, G6 ?
if $(MSVCVER) = 6 {
CCDEBUGFLAG ?= /Od /Z7 ; # Include debugging into in each object
CCPROFFLAG ?= /Od /Z7 ;
LINKDEBUGFLAG ?= /DEBUGTYPE:BOTH /DEBUG /PDB:NONE ;
} else {
CCDEBUGFLAG ?= /Od /Zi ; # /Zi creates debugging database
CCPROFFLAG ?= /Od /Zi ;
LINKDEBUGFLAG ?= /DEBUG ;
}
LINKPROFFLAG ?= /PROFILE $(LINKDEBUGFLAG) ;
LINKOPTFLAG ?= /OPT:REF ;
LINKSTRIPFLAG ?= ;
YACC ?= bison -y ;
YACCGEN ?= .c ;
YACCFILES ?= y.tab ;
YACCFLAGS ?= -d ;
}
else
{
EXIT On NT, set BCCROOT, MINGW, MSVCDIR, MSVCNT, MSVC or VCINSTALLDIR to the root
of the Borland, GCC or Microsoft directories. ;
}
}
else if $(OS2)
{
WATCOM ?= $(watcom) ;
if ! $(WATCOM)
{
Exit On OS2, set WATCOM to the root of the Watcom directory. ;
}
AR ?= wlib ;
BINDIR ?= \\os2\\apps ;
CC ?= wcc386 ;
CCFLAGS ?= /zq /DOS2 /I$(WATCOM)\\h ; # zq=quiet
C++ ?= wpp386 ;
C++FLAGS ?= $(CCFLAGS) ;
CP ?= copy ;
DOT ?= . ;
DOTDOT ?= .. ;
LINK ?= wcl386 ;
LINKFLAGS ?= /zq ; # zq=quiet
STDLIBS ?= ;
MV ?= move ;
NOARSCAN ?= true ;
RM ?= del /f ;
SLASH ?= \\ ;
STDHDRS ?= $(WATCOM)\\h ;
SUFEXE ?= .exe ;
SUFSH ?= .bat ;
SUFLIB ?= .lib ;
SUFOBJ ?= .obj ;
DEFFLAG ?= /D ;
UNDEFFLAG ?= "/u _" ;
}
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 ?= "" ;
STDLIBS ?= ;
MKDIR ?= create/dir ;
MV ?= rename ;
RM ?= delete ;
RUNVMS ?= mcr ;
SHELLMODE ?= (w:er) ;
SLASH ?= . ;
STDHDRS ?= decc$library_include ;
SUFEXE ?= .exe ;
SUFSH ?= .bat ;
SUFLIB ?= .olb ;
SUFOBJ ?= .obj ;
switch $(OS)
{
case OPENVMS : CCFLAGS ?= /stand=vaxc ;
case VMS : STDLIBS ?= 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:Libs:MSL_MPWCRuntime_PPC.lib"
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC_MPW.Lib" ;
MPWNLLIBS ?=
"$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_MPWCRuntime_PPC.lib"
"$(CW):MSL:MSL_C:MSL_MacOS:Lib:PPC:MSL_C_PPC_MPW(NL).Lib" ;
SIOUXHDRS ?= ;
SIOUXLIBS ?=
"$(CW):MacOS Support:Libraries:Runtime:Libs:MSL_Runtime_PPC.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 ;
CC ?= mwcppc ;
CCFLAGS ?= -w off ;
CP ?= duplicate -y ;
DOT ?= ":" ;
DOTDOT ?= "::" ;
HDRS ?= $(MACHDRS) $(MPWHDRS) ;
LINK ?= mwlinkppc ;
LINKFLAGS ?= -mpwtool -warn ;
STDLIBS ?= $(MACLIBS) $(MPWLIBS) ;
SHSTDLIBS ?= $(STDLIBS) ;
MKDIR ?= newfolder ;
MV ?= rename -y ;
NOARSCAN ?= true ;
RM ?= delete -y ;
SLASH ?= ":" ;
STDHDRS ?= ;
SUFLIB ?= .lib ;
SUFOBJ ?= .o ;
}
else if $(OS) = BEOS && $(OSPLAT) = PPC
{
AR ?= mwld -xml -o ;
BINDIR ?= /boot/home/config/bin ;
CC ?= mwcc ;
CCFLAGS ?= -nosyspath ;
C++ ?= $(CC) ;
C++FLAGS ?= -nosyspath ;
CHMOD ?= chmod ;
CHGRP ?= chgrp ;
CHOWN ?= chown ;
FORTRAN ?= "" ;
LEX ?= flex ;
LIBDIR ?= /boot/home/config/lib ;
LINK ?= mwld ;
LINKFLAGS ?= "" ;
MANDIR ?= /boot/home/config/man ;
NOARSCAN ?= true ;
RANLIB ?= ranlib ;
STDHDRS ?= /boot/develop/headers/posix ;
YACC ?= bison -y ;
YACCGEN ?= .c ;
YACCFILES ?= y.tab ;
YACCFLAGS ?= -d ;
}
else if $(OS) = BEOS
{
BINDIR ?= /boot/home/config/bin ;
CC ?= gcc ;
C++ ?= $(CC) ;
CHMOD ?= chmod ;
CHGRP ?= chgrp ;
CHOWN ?= chown ;
FORTRAN ?= "" ;
LEX ?= flex ;
LIBDIR ?= /boot/home/config/lib ;
LINK ?= gcc ;
MANDIR ?= /boot/home/config/man ;
NOARSCAN ?= true ;
RANLIB ?= ranlib ;
STDHDRS ?= /boot/develop/headers/posix ;
YACC ?= bison -y ;
YACCGEN ?= .c ;
YACCFILES ?= y.tab ;
YACCFLAGS ?= -d ;
}
else if $(UNIX)
{
switch $(OS)
{
case AIX :
STDLIBS ?= -lbsd ;
case AMIGA :
CC ?= gcc ;
YACC ?= bison -y ;
case CYGWIN :
CC ?= gcc ;
CCFLAGS += -D__cygwin__ ;
LEX ?= flex ;
JAMSHELL ?= sh -c ;
RANLIB ?= "" ;
SUFEXE ?= .exe ;
YACC ?= bison -y ;
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 ;
AR ?= ar rusc ;
C++ ?= c++ ;
MANDIR ?= /usr/local/share/man ;
RANLIB ?= "" ;
SUFSHLIB ?= .dylib ;
SUFIMPLIB ?= .dylib ;
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 ;
CCOPTFLAG ?= -O0 ;
case UNIXWARE :
RANLIB ?= "" ;
RELOCATE ?= true ;
}
# UNIX defaults
CCFLAGS ?= -DUNIX -D_THREAD_SAFE -pipe ;
CCOPTFLAG ?= -O2 ;
CCDEBUGFLAG ?= -g ;
CCPROFFLAG ?= ;
CCSHOBJFLAG ?= -fPIC ; # Position independent is better for ShLibrary
C++FLAGS ?= $(CCFLAGS) ;
CHMOD ?= chmod ;
CHGRP ?= chgrp ;
CHOWN ?= chown ;
LEX ?= lex ;
LINKFLAGS ?= ;
LINKOPTFLAG ?= -O ; # Affects creating .so's
LINKSTRIPFLAG ?= -s ;
LINKDEBUGFLAG ?= ;
LINKPROFFLAG ?= ;
SHLINKFLAGS ?= ; # Flags for creation of shared library
STDLIBS ?= -lm -lpthread ;
SHSTDLIBS ?= $(STDLIBS) ;
LINKFLAG ?= -l ;
RANLIB ?= "" ;
YACC ?= yacc ;
YACCGEN ?= .c ;
YACCFILES ?= y.tab ;
YACCFLAGS ?= -d ;
HDRS ?= /usr/local/include ;
# Add some good defaults for OS X
if $(OS) = MACOSX {
CCFLAGS += -Wno-sign-compare ; # supress new gcc4 warnings ?
CCFLAGS += -fpascal-strings ; # for compatibility with the OSX API