Diff

Differences From Artifact [dc425d4798]:

To Artifact [a8ad16f8ba]:


11
12
13
14
15
16
17
18

19
20
21

22
23



24

25
26
27



28
29
30
31
32
33
34
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







-
+


-
+


+
+
+
-
+

-
-
+
+
+







# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
# Copyright (c) 2001 ActiveState Corporation.
# Copyright (c) 2001-2002 David Gravereaux.
# Copyright (c) 2003 Pat Thoyts
# Copyright (c) 2003-2006 Pat Thoyts
#
#-------------------------------------------------------------------------
# RCS: @(#)$Id: makefile.vc,v 1.3 2007/02/28 23:33:41 patthoyts Exp $
# RCS: @(#)$Id: makefile.vc,v 1.4 2007/09/06 21:01:55 patthoyts Exp $
#-------------------------------------------------------------------------

# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
# or with the MS Platform SDK (MSSDK). Visual Studio .NET 2003 and 2005 define
# VCINSTALLDIR instead. The MSVC Toolkit release defines yet another.
!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCToolkitInstallDir)
!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) && !defined(VCINSTALLDIR) && !defined(VCToolkitInstallDir)
MSG = ^
You will need to run vcvars32.bat from Developer Studio, first, to setup^
the environment.  Jump to this line to read the new instructions.
You need to run vcvars32.bat from Developer Studio or setenv.bat from the^
Platform SDK first to setup the environment.  Jump to this line to read^
the build instructions.
!error $(MSG)
!endif

#------------------------------------------------------------------------------
# HOW TO USE this makefile:
#
# 1)  It is now necessary to have %MSVCDir% set in the environment.  This is
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
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







-
+















-
+



-
+
+







#		msvcrt  =  Effects the static option only to switch it from
#			   using libcmt(d) as the C runtime [by default] to
#			   msvcrt(d). This is useful for static embedding
#			   support.
#		staticpkg = Effects the static option only to switch
#			   tclshXX.exe to have the dde and reg extension linked
#			   inside it.
#		threads =  Turns on full multithreading support.
#		nothreads = Turns off multithreading support (not recommended)
#		thrdalloc = Use the thread allocator (shared global free pool).
#		symbols =  Adds symbols for step debugging.
#		profile =  Adds profiling hooks.  Map file is assumed.
#		loimpact =  Adds a flag for how NT treats the heap to keep memory
#			   in use, low.  This is said to impact alloc performance.
#
#	STATS=memdbg,compdbg,none
#		Sets optional memory and bytecode compiler debugging code added
#		to the core.  The default is for none.  Any combination of the
#		above may be used (comma separated).  'none' will over-ride
#		everything to nothing.
#
#		memdbg   = Enables the debugging memory allocator.
#		compdbg  = Enables byte compilation logging.
#
#	MACHINE=(IX86|IA64|ALPHA)
#	MACHINE=(IX86|IA64|ALPHA|AMD64)
#		Set the machine type used for the compiler, linker, and
#		resource compiler.  This hook is needed to tell the tools
#		when alternate platforms are requested.  IX86 is the default
#		when not specified.
#		when not specified. If the CPU environment variable has been
#		set (ie: recent Platform SDK) then MACHINE is set from CPU.
#
#	TMP_DIR=<path>
#	OUT_DIR=<path>
#		Hooks to allow the intermediate and output directories to be
#		changed.  $(OUT_DIR) is assumed to be 
#		$(BINROOT)\(Release|Debug) based on if symbols are requested.
#		$(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
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
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







+
+
+


















-
+


+

+
+

+







+







#
# You need to specify the object files that need to be linked into your
# binary here.
#
#-------------------------------------------------------------------------

PROJECT = tls

# Uncomment the following line if this is a Tk extension.
#PROJECT_REQUIRES_TK=1
!include "rules.vc"

DOTVERSION      = 1.5.1
VERSION         = $(DOTVERSION:.=)
STUBPREFIX      = $(PROJECT)stub

DLLOBJS = \
	$(TMP_DIR)\tls.obj \
	$(TMP_DIR)\tlsBIO.obj \
	$(TMP_DIR)\tlsIO.obj \
	$(TMP_DIR)\tlsX509.obj \
	$(TMP_DIR)\tls.res

#-------------------------------------------------------------------------
# Locate the OpenSSL library and headers
#-------------------------------------------------------------------------

!ifndef OPENSSL
OPENSSL = c:\opt
OPENSSL = c:\opt\openssl
!endif

!ifndef SSL_INCLUDE_DIR
SSL_INCLUDE_DIR = $(OPENSSL)\include
!endif
!ifndef SSL_LIB_DIR
SSL_LIB_DIR     = $(OPENSSL)\lib
!endif

SSL_LIBS        =-libpath:"$(SSL_LIB_DIR)" ssleay32s.lib libeay32s.lib

SSL_CFLAGS      =-DNO_IDEA=1 -DNO_RC5=1

!if !exist("$(SSL_LIB_DIR)\ssleay32s.lib")
MSG = ^
Failed to locate "$(SSL_LIB_DIR)\ssleay32s.lib"
You must provide the path to your OpenSSL library....
!error $(MSG)
!endif

#-------------------------------------------------------------------------
# Target names and paths ( shouldn't need changing )
#-------------------------------------------------------------------------
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
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







-
+



-
+

-
+

-
+



+
-
+

+
-
-
-
+
+
+
-
-
-
+



-
+





-
+





+
+
+
+
+
+
+



-
+

-
+

-
-
+
+







+
+
+





-
+
+
+
+
+




















+
+
+
+
+
+
+
+
+
+
+
+
+
-
+







#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------

!if !$(DEBUG)
!if $(OPTIMIZING)
### This cranks the optimization level to maximize speed
cdebug	= -O2 -Op -Gs
cdebug	= $(OPTIMIZATIONS)
!else
cdebug	=
!endif
!else if "$(MACHINE)" == "IA64"
!else if "$(MACHINE)" == "IA64" #|| "$(MACHINE)" == "AMD64"
### Warnings are too many, can't support warnings into errors.
cdebug	= -Z7 -Od -GZ
cdebug	= -Zi -Od $(DEBUGFLAGS)
!else
cdebug	= -Z7 -WX -Od -GZ
cdebug	= -Zi -WX $(DEBUGFLAGS)
!endif

### Declarations common to all compiler options
cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c -W3 -YX -Fp$(TMP_DIR)^\
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\

# Warning level
!if $(PENT_0F_ERRATA)
cflags = $(cflags) -QI0f
!endif
!if $(FULLWARNINGS)
cflags = $(cflags) -W4
!else

!if $(ITAN_B_ERRATA)
cflags = $(cflags) -QIA64_Bx
cflags = $(cflags) -W3
!endif

!if $(MSVCRT)
!if $(DEBUG)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
!else
!if $(DEBUG)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MTd
!else
crt = -MT
!endif
!endif

!if !$(STATIC_BUILD)
cflags = $(cflags) -DUSE_TCL_STUBS
!if defined(TKSTUBLIB)
cflags = $(cflags) -DUSE_TK_STUBS
!endif
!endif

INCLUDES	= $(TCL_INCLUDES) -I"$(WINDIR)" -I"$(GENERICDIR)" \
		  -I"$(SSL_INCLUDE_DIR)"
BASE_CLFAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
BASE_CFLAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE
TCL_CFLAGS	= -DUSE_TCL_STUBS -DBUILD_$(PROJECT) $(SSL_CFLAGS) \
TCL_CFLAGS	= -DPACKAGE_NAME="\"$(PROJECT)\"" \
		  -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
                  -DPACKAGE_NAME="\"$(PROJECT)\"" \
		  $(BASE_CLFAGS) $(OPTDEFINES)
                  $(SSL_CFLAGS) \
		  $(BASE_CFLAGS) $(OPTDEFINES)

#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------

!if $(DEBUG)
ldebug	= -debug:full -debugtype:cv
!if $(MSVCRT)
ldebug = $(ldebug) -nodefaultlib:msvcrt
!endif
!else
ldebug	= -release -opt:ref -opt:icf,3
!endif

### Declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE) $(ldebug)
lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)

!if $(FULLWARNINGS)
lflags = $(lflags) -warn:3
!endif

!if $(PROFILE)
lflags	= $(lflags) -profile
!endif

!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
### Align sections for PE size savings.
lflags	= $(lflags) -opt:nowin98
!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
### Align sections for speed in loading by choosing the virtual page size.
lflags	= $(lflags) -align:4096
!endif

!if $(LOIMPACT)
lflags	= $(lflags) -ws:aggressive
!endif

dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows
!if !$(STATIC_BUILD)
baselibs  = $(TCLSTUBLIB)
!if defined(TKSTUBLIB)
baselibs  = $(baselibs) $(TKSTUBLIB)
!endif
!endif

# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
baselibs   = $(baselibs) bufferoverflowU.lib
!endif

baselibs  = $(TCLSTUBLIB) $(SSL_LIBS) ws2_32.lib user32.lib gdi32.lib advapi32.lib
baselibs  = $(baselibs) $(SSL_LIBS) ws2_32.lib user32.lib gdi32.lib advapi32.lib

#---------------------------------------------------------------------
# TclTest flags
#---------------------------------------------------------------------

!IF "$(TESTPAT)" != ""
TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
324
325
326
327
328
329
330
331

332
333
334
335
336
337
338
364
365
366
367
368
369
370

371
372
373
374
375
376
377
378







-
+







# have to handle the output differently on Win9x.
#
!if "$(OS)" == "Windows_NT"  || "$(MSVCDIR)" == "IDE"
test: setup $(PROJECT)
        set TCL_LIBRARY=$(ROOT)/library
        $(TCLSH) <<
load $(PRJLIB:\=/)
source [file normalize [file join $(LIBDIR) tls.tcl]]
source [file join $(LIBDIR) tls.tcl]
cd "$(ROOT)/tests"
set argv "$(TESTFLAGS)"
source all.tcl
<<
!else
test: setup $(PROJECT)
        echo Please wait while the test results are collected
349
350
351
352
353
354
355





356
357
358

359

360
361
362
363
364
365
366
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







+
+
+
+
+



+

+








setup:
	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)

# See <tcl>/win/coffbase.txt for extension base addresses.
$(PRJLIB): $(DLLOBJS)
!if $(STATIC_BUILD)
	$(lib32) -nologo -out:$@ @<<
$**
<<
!else
	$(link32) $(dlllflags) -base:0x10780000 -out:$@ $(baselibs) @<<
$**
<<
	$(_VC_MANIFEST_EMBED_DLL)
	-@del $*.exp
!endif

$(PRJSTUBLIB): $(PRJSTUBOBJS)
	$(lib32) -nologo -out:$@ $(PRJSTUBOBJS)

#---------------------------------------------------------------------
# Implicit rules
#---------------------------------------------------------------------
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
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







-
-
-
+
+
+













+
+
+
+
+
+
+
+
+
+
+
+







{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<

{$(WINDIR)}.rc{$(TMP_DIR)}.res:
	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -D__WIN32__ \
                -DCOMMAVERSION=$(DOTVERSION:.=,),0 \
                -DDOTVERSION=\"$(DOTVERSION)\" \
                -DVERSION=\"$(VERSION)$(SUFX)\" \
		-DCOMMAVERSION=$(DOTVERSION:.=,),0 \
		-DDOTVERSION=\"$(DOTVERSION)\" \
		-DVERSION=\"$(VERSION)$(SUFX)\" \
!if $(DEBUG)
	-d DEBUG \
!endif
!if $(TCL_THREADS)
	-d TCL_THREADS \
!endif
!if $(STATIC_BUILD)
	-d STATIC_BUILD \
!endif
	$<

.SUFFIXES:
.SUFFIXES:.c .rc

#-------------------------------------------------------------------------
# Explicit dependency rules
#
#-------------------------------------------------------------------------

$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
	nmakehlp -s << $** > $@
@PACKAGE_VERSION@    $(DOTVERSION)
@PACKAGE_NAME@       $(PROJECT)
@PKG_LIB_FILE@       $(PRJLIBNAME)
<<

#---------------------------------------------------------------------
# Installation. (EDIT)
#
# You may need to modify this section to reflect the final distribution
# of your files and possibly to generate documentation.
#
429
430
431
432
433
434
435



436
437
438
439
440
441
442
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504







+
+
+







#---------------------------------------------------------------------
# Clean up
#---------------------------------------------------------------------

clean:
	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
	@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch

realclean: clean
	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)

distclean: realclean
	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj