summaryrefslogtreecommitdiffstats
path: root/win/rules.vc
blob: 016b4ee92ef2726a052493d2857aaf4e1a90a5d7 (plain)
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
#------------------------------------------------------------------------------
# rules.vc --
#
#	Microsoft Visual C++ makefile include for decoding the commandline
#	macros.  This file does not need editing to build Tcl.
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# Copyright (c) 2001 Tomasoft Engineering.
#
#------------------------------------------------------------------------------
# RCS: @(#) $Id: rules.vc,v 1.5 2002/02/20 19:06:54 davygrvy Exp $
#------------------------------------------------------------------------------

!ifndef _RULES_VC
_RULES_VC = 1

cc32		= $(CC)   # built-in default.
link32		= link
lib32		= lib
rc32		= $(RC)   # built-in default.

!ifndef INSTALLDIR
INSTALLDIR	= C:\Progra~1\Tcl
!endif

!ifndef MACHINE
MACHINE		= IX86
!endif

!message ===============================================================================


#----------------------------------------------------------
# Test for compiler features
#----------------------------------------------------------

### Just display the compiler and linker versions to the output
!if [$(cc32) 2>&1 | find "(R)"]
!endif
!if [$(link32) 2>&1 | find "(R)"]
!endif

### test for optimizations
!if [$(cc32) -Ox -nologo -c -Zs -TC -Fdtemp nul 2>&1 | find "D4002" > nul]
!message *** Compiler has 'Optimizations'
OPTIMIZING	= 1
!else
!message *** Compiler doesn't have 'Optimizations'
OPTIMIZING	= 0
!endif

### test for pentium errata
!if "$(MACHINE)" == "IX86"
!if [$(cc32) -QI0f -nologo -c -Zs -TC -Fdtemp nul 2>&1 | find "D4002" > nul]
!message *** Compiler has 'Pentium 0x0f fix'
PENT_0F_ERRATA	= 1
!else
!message *** Compiler doesn't have 'Pentium 0x0f fix'
PENT_0F_ERRATA	= 0
!endif
!if [$(link32) -nologo -opt:nowin98 2>&1 | find "LNK1117" > nul]
!message *** Linker has 'Win98 alignment problem'
ALIGN98_HACK	= 1
!else
!message *** Linker doesn't have 'Win98 alignment problem'
ALIGN98_HACK	= 0
!endif
!else
PENT_0F_ERRATA	= 0
ALIGN98_HACK	= 0
!endif

### test for Itanium errata
!if "$(MACHINE)" == "IA64"
!if [$(cc32) -QIA64_Bx -nologo -c -Zs -TC -Fdtemp nul 2>&1 | find "D4002" > nul]
!message *** Compiler has 'B-stepping errata workarounds'
ITAN_B_ERRATA	= 1
!else
!message *** Compiler doesn't have 'B-stepping errata workarounds'
ITAN_B_ERRATA	= 0
!endif
!else
ITAN_B_ERRATA	= 0
!endif

### Clean-up temp files after tests.
!if [@for %d in (temp.idb temp.pdb) do @if exist %d del %d]
!endif


#----------------------------------------------------------
# Decode the options requested.
#----------------------------------------------------------

!if "$(OPTS)" == "" || ![echo "$(OPTS)" | find /i "none" > nul]
STATIC_BUILD	= 0
TCL_THREADS	= 0
DEBUG		= 0
PROFILE		= 0
MSVCRT		= 0
TCL_LINKWITHEXTENSIONS	= 0
!else
!if ![echo $(OPTS) | find /i "static" > nul]
!message *** Doing static
STATIC_BUILD	= 1
!else
STATIC_BUILD	= 0
!endif
!if ![echo $(OPTS) | find /i "msvcrt" > nul]
!message *** Doing msvcrt
MSVCRT		= 1
!else
MSVCRT		= 0
!endif
!if ![echo $(OPTS) | find /i "linkexten" > nul]
!message *** Doing linkexten
TCL_LINKWITHEXTENSIONS	= 1
!else
TCL_LINKWITHEXTENSIONS	= 0
!endif
!if ![echo $(OPTS) | find /i "threads" > nul]
!message *** Doing threads
TCL_THREADS	= 1
!else
TCL_THREADS	= 0
!endif
!if ![echo $(OPTS) | find /i "symbols" > nul]
!message *** Doing symbols
DEBUG		= 1
!else
DEBUG		= 0
!endif
!if ![echo $(OPTS) | find /i "profile" > nul]
!message *** Doing profile
PROFILE		= 1
!else
PROFILE		= 0
!endif
!endif


!if !$(STATIC_BUILD)
# Make sure we don't build overly fat DLLs.
MSVCRT		= 1
# Shouldn't statically put the extensions inside the shell when dynamic.
TCL_LINKWITHEXTENSIONS = 0
!endif


#----------------------------------------------------------
# Figure-out how to name our intermediate and output directories.
# We wouldn't want different builds to use the same .obj files
# by accident.
#----------------------------------------------------------

SUFX	    = tsdx

!if $(DEBUG)
BUILDDIRTOP = Debug
DBGX	    = d
!else
BUILDDIRTOP = Release
DBGX	    =
SUFX	    = $(SUFX:d=)
!endif

TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX

!if !$(STATIC_BUILD)
TMP_DIRFULL = $(TMP_DIRFULL:Static=)
SUFX	    = $(SUFX:s=)
EXT	    = dll
!if $(MSVCRT)
TMP_DIRFULL = $(TMP_DIRFULL:X=)
SUFX	    = $(SUFX:x=)
!endif
!else
TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
EXT	    = lib
!if !$(MSVCRT)
TMP_DIRFULL = $(TMP_DIRFULL:X=)
SUFX	    = $(SUFX:x=)
!endif
!endif

!if !$(TCL_THREADS)
TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
SUFX	    = $(SUFX:t=)
!endif

!ifndef TMP_DIR
TMP_DIR	    = $(TMP_DIRFULL)
!ifndef OUT_DIR
OUT_DIR	    = .\$(BUILDDIRTOP)
!endif
!else
!ifndef OUT_DIR
OUT_DIR	    = $(TMP_DIR)
!endif
!endif


#----------------------------------------------------------
# Decode the statistics requested.
#----------------------------------------------------------

!if "$(STATS)" == "" || ![echo "$(STATS)" | find /i "none" > nul]
TCL_MEM_DEBUG	    = 0
TCL_COMPILE_DEBUG   = 0
!else
!if ![echo $(STATS) | find /i "memdbg" > nul]
!message *** Doing memdbg
TCL_MEM_DEBUG	    = 1
!else
TCL_MEM_DEBUG	    = 0
!endif
!if ![echo $(STATS) | find /i "compdbg" > nul]
!message *** Doing compdbg
TCL_COMPILE_DEBUG   = 1
!else
TCL_COMPILE_DEBUG   = 0
!endif
!endif


#----------------------------------------------------------
# Set our defines armed with our options.
#----------------------------------------------------------

OPTDEFINES	=
!if $(TCL_MEM_DEBUG)
OPTDEFINES	= -DTCL_MEM_DEBUG
!endif
!if $(TCL_COMPILE_DEBUG)
OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
!endif
!if $(TCL_THREADS)
OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
!endif
!if $(STATIC_BUILD)
OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
!endif


#----------------------------------------------------------
# Display stats being used.
#----------------------------------------------------------

!message *** Intermediate directory will be '$(TMP_DIR)'
!message *** Output directory will be '$(OUT_DIR)'
!message *** Suffix for binaries will be '$(SUFX)'
!message *** Optional defines are '$(OPTDEFINES)'
!message

!endif