Changes to win/makefile.vc.
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
|
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
|
-
-
+
+
-
-
-
+
+
+
-
-
-
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
+
-
+
-
-
+
-
+
-
+
-
-
+
-
-
+
-
-
-
+
-
-
-
-
+
+
-
-
-
+
-
-
-
-
-
-
-
+
+
-
-
-
-
-
-
-
-
+
-
-
+
-
-
-
-
-
-
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
+
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
+
-
-
-
-
-
-
+
-
-
-
-
+
-
-
-
-
-
-
-
-
+
-
-
-
-
+
-
-
-
-
+
-
-
-
-
-
-
+
+
+
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
|
#------------------------------------------------------------- -*- makefile -*-
# makefile.vc --
#
# Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
# Makefile for TBDC MySQL interface
#
# Basic build, test and install
# This makefile is based upon the Tcl 8.6 Makefile.vc and modified to
# make it suitable as a general package makefile. Look for the word EDIT
# which marks sections that may need modification. As a minumum you will
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir install
# nmake /s /nologo /f makefile.vc INSTALLDIR=c:\path\to\installdir test
# need to change the PROJECT, DOTVERSION and DLLOBJS variables to values
# relevant to your package.
#
#
# For other build options (debug, static etc.)
# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
# detailed documentation.
#
# 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-2005 ActiveState Corporation.
# Copyright (c) 2001-2004 David Gravereaux.
# Copyright (c) 2003-2008 Pat Thoyts.
#------------------------------------------------------------------------------
# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
MSG = ^
PROJECT = tdbcmysql
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
# Tcl 8.6 etc. compile with /DUNICODE. TDBC pre-nmake reform compiled
#------------------------------------------------------------------------------
# HOW TO USE this makefile:
#
# 1) It is now necessary to have MSVCDir, MSDevDir or MSSDK set in the
# environment. This is used as a check to see if vcvars32.bat had been
# run prior to running nmake or during the installation of Microsoft
# Visual C++, MSVCDir had been set globally and the PATH adjusted.
# Either way is valid.
#
# You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
# directory to setup the proper environment, if needed, for your
# current setup. This is a needed bootstrap requirement and allows the
# swapping of different environments to be easier.
#
# 2) To use the Platform SDK (not expressly needed), run setenv.bat after
# vcvars32.bat according to the instructions for it. This can also
# turn on the 64-bit compiler, if your SDK has it.
#
# 3) Targets are:
# all -- Builds everything.
# <project> -- Builds the project (eg: nmake sample)
# test -- Builds and runs the test suite.
# install -- Installs the built binaries and libraries to $(INSTALLDIR)
# in an appropriate subdirectory.
# clean/realclean/distclean -- varying levels of cleaning.
#
# 4) Macros usable on the commandline:
# INSTALLDIR=<path>
# Sets where to install Tcl from the built binaries.
# C:\Progra~1\Tcl is assumed when not specified.
#
# OPTS=loimpact,msvcrt,nothreads,pdbs,profile,static,symbols,unchecked,none
# Sets special options for the core. The default is for none.
# without -DUNICODE. Keep that behaviour for now. TBD
# Any combination of the above may be used (comma separated).
# 'none' will over-ride everything to nothing.
#
# loimpact = Adds a flag for how NT treats the heap to keep memory
# in use, low. This is said to impact alloc performance.
# msvcrt = Affects 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.
USE_WIDECHAR_API = 0
# nothreads = Turns off multithreading support (not recommended)
# static = Builds a static library of the core instead of a
# dll. The shell will be static (and large), as well.
# pdbs = Build detached symbols for release builds.
# profile = Adds profiling hooks. Map file is assumed.
# symbols = Debug build. Links to the debug C runtime, disables
# optimizations and creates pdb symbols files.
# unchecked = Allows a symbols build to not use the debug
# enabled runtime (msvcrt.dll not msvcrtd.dll
# or libcmt.lib not libcmtd.lib).
#
# 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.
#
# CHECKS=64bit,fullwarn,nodep,none
# Sets special macros for checking compatability.
#
# 64bit = Enable 64bit portability warnings (if available)
# fullwarn = Builds with full compiler and link warnings enabled.
# Very verbose.
# nodep = Turns off compatability macros to ensure Tk isn't
# being built with deprecated functions.
#
# MACHINE=(ALPHA|AMD64|IA64|IX86)
# 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. 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.
#
# TESTPAT=<file>
# Reads the tests requested to be run from this file.
#
# 5) Examples:
#
# Basic syntax of calling nmake looks like this:
# nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
#
# Standard (no frills)
# c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
# Setting environment for using Microsoft Visual C++ tools.
# c:\tcl_src\win\>nmake -f makefile.vc all
# c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
#
# Building for Win64
# c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
# Setting environment for using Microsoft Visual C++ tools.
# c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
# Targeting Windows pre64 RETAIL
# c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64
#
#------------------------------------------------------------------------------
#==============================================================================
#------------------------------------------------------------------------------
!if !exist("makefile.vc")
MSG = ^
You must run this makefile only from the directory it is in.^
Please `cd` to its location first.
!error $(MSG)
!endif
#-------------------------------------------------------------------------
# Project specific information (EDIT)
#
# You should edit this with the name and version of your project. This
# information is used to generate the name of the package library and
# it's install location.
#
# For example, the sample extension is going to build sample05.dll and
# would install it into $(INSTALLDIR)\lib\sample05
#
# You need to specify the object files that need to be linked into your
# binary here.
#
#-------------------------------------------------------------------------
PROJECT = tdbcmysql
# Uncomment the following line if this is a Tk extension.
#PROJECT_REQUIRES_TK=1
!include "rules.vc"
!include "rules-ext.vc"
# nmakehelp -V <file> <tag> will search the file for tag, skips until a
# number and returns all character until a character not in [0-9.ab]
# is read.
!if [echo REM = This file is generated from Makefile.vc > versions.vc]
!endif
# get project version from row AC_INIT([tdbcmysql], ...)
!if [echo DOTVERSION = \>> versions.vc] \
&& [nmakehlp -V ..\configure.ac AC_INIT >> versions.vc]
!endif
!if [echo TCL_VERSION_REQ = \>> versions.vc] \
&& [nmakehlp -V ..\configure.ac TCL_VERSION_REQ >> versions.vc]
!endif
!include "versions.vc"
VERSION = $(DOTVERSION:.=)
STUBPREFIX = $(PROJECT)stub
DLLOBJS = \
PRJ_OBJS = \
$(TMP_DIR)\tdbcmysql.obj \
$(TMP_DIR)\mysqlStubInit.obj
# Uncomment the following line if you want to build and install stubs
PRJSTUBOBJS = \
$(TMP_DIR)\mysqlStubInit.obj
# PRJ_STUBOBJS = $(TMP_DIR)\mysqlStubInit.obj
PRJHEADERS = \
PRJ_HEADERS = \
$(GENERICDIR)\fakemysql.h \
$(GENERICDIR)\mysqlStubs.h
# Locate TDBC headers and libraries.
#-------------------------------------------------------------------------
# Target names and paths ( shouldn't need changing )
# In principle, we don't need the TDBC source directory, and an installed
#-------------------------------------------------------------------------
# TDBC should suffice. But that needs additional machinery not implemented
BINROOT = $(MAKEDIR)
ROOT = $(MAKEDIR)\..
# yet.
PRJIMPLIB = $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
PRJLIBNAME = $(PROJECT)$(VERSION)$(SUFX).$(EXT)
PRJLIB = $(OUT_DIR)\$(PRJLIBNAME)
!if [echo TDBC_DIR = \> nmakehlp.out] \
|| [nmakehlp -L generic\tdbcInt.h >> nmakehlp.out]
PRJSTUBLIBNAME = $(STUBPREFIX)$(VERSION).lib
PRJSTUBLIB = $(OUT_DIR)\$(PRJSTUBLIBNAME)
!error Could not locate TDBC source directory.
### Make sure we use backslash only.
PRJ_INSTALL_DIR = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
LIB_INSTALL_DIR = $(PRJ_INSTALL_DIR)
BIN_INSTALL_DIR = $(PRJ_INSTALL_DIR)
DOC_INSTALL_DIR = $(PRJ_INSTALL_DIR)
SCRIPT_INSTALL_DIR = $(PRJ_INSTALL_DIR)
INCLUDE_INSTALL_DIR = $(_TCLDIR)\include
!endif
!include nmakehlp.out
### The following paths CANNOT have spaces in them.
GENERICDIR = $(ROOT)\generic
WINDIR = $(ROOT)\win
LIBDIR = $(ROOT)\library
DOCDIR = $(ROOT)\doc
TOOLSDIR = $(ROOT)\tools
COMPATDIR = $(ROOT)\compat
# Get the TDBC version from its configure.ac
### tdbc
TDBC_DOTVERSION = $(DOTVERSION)
!if [echo TDBC_DOTVERSION = \> versions.vc] \
TDBC_VERSION = $(TDBC_DOTVERSION:.=)
# tdbc source folder is "../tdbc" in source distribution and
# "../tdbc1.0.0" in tcl8.6.0 bundeled distribution
TDBC_DIR = $(ROOT)\..\tdbc
!if !exist($(TDBC_DIR))
TDBC_DIR = $(ROOT)\..\tdbc$(TDBC_DOTVERSION)
&& [nmakehlp -V "$(TDBC_DIR)\configure.ac" tdbc >> versions.vc]
!error Could not retrieve TDBC version.
!endif
TDBC_GENERIC_DIR = $(TDBC_DIR)\generic
### tdbc stub lib
TDBCSTUBLIBNAME = tdbcstub$(TDBC_VERSION).lib
TDBCSTUBLIB = "$(_TCLDIR)\lib\$(TDBCSTUBLIBNAME)"
!if !exist($(TDBCSTUBLIB))
TDBCSTUBLIB = $(TDBC_DIR)\win\$(BUILDDIRTOP)\$(TDBCSTUBLIBNAME)
!include versions.vc
TDBC_VERSION = $(TDBC_DOTVERSION:.=)
TDBC_GENERIC_DIR = $(TDBC_DIR)\generic
TDBCSTUBLIBNAME = tdbcstub$(TDBC_VERSION).lib
TDBCSTUBLIB = $(TDBC_DIR)\win\$(BUILDDIRTOP)\$(TDBCSTUBLIBNAME)
!endif
TDBC_LIB_FILE = tdbc$(TDBC_VERSION).dll
TDBC_BIN_DIR = $(TDBC_DIR)/win/$(BUILDDIRTOP)
TDBC_LIB_FILE = tdbc$(TDBC_VERSION).dll
TDBC_BIN_DIR = $(TDBC_DIR)/win/$(BUILDDIRTOP)
#---------------------------------------------------------------------
# Compile flags
#---------------------------------------------------------------------
PRJ_INCLUDES = -I"$(TDBC_GENERIC_DIR)"
!if !$(DEBUG)
!if $(OPTIMIZING)
### This cranks the optimization level to maximize speed
cdebug = $(OPTIMIZATIONS)
!else
cdebug =
!endif
!else if "$(MACHINE)" == "IA64"
### Warnings are too many, can't support warnings into errors.
cdebug = -Zi -Od $(DEBUGFLAGS)
!else
cdebug = -Zi -WX $(DEBUGFLAGS)
!endif
### Declarations common to all compiler options
cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\
!if $(MSVCRT)
!if $(DEBUG) && !$(UNCHECKED)
crt = -MDd
!else
crt = -MD
!endif
!else
!if $(DEBUG) && !$(UNCHECKED)
crt = -MTd
!else
crt = -MT
!endif
!endif
cflags = $(cflags) -DMODULE_SCOPE=extern
!if !$(STATIC_BUILD)
cflags = $(cflags) -DUSE_TCL_STUBS
!if defined(TKSTUBLIB)
PRJ_LIBS = $(TDBCSTUBLIB)
cflags = $(cflags) -DUSE_TK_STUBS
!endif
!endif
INCLUDES = $(TCL_INCLUDES) -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(TDBC_GENERIC_DIR)"
BASE_CFLAGS = $(cflags) $(cdebug) $(crt) $(INCLUDES)
CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE
TCL_CFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \
-DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
-DBUILD_$(PROJECT) \
$(BASE_CFLAGS) $(OPTDEFINES) \
-Dinline=__inline
# Disable standard test target because we have a custom one
### Stubs files should not be compiled with -GL
STUB_CFLAGS = $(cflags) $(cdebug:-GL=) #$(TK_DEFINES)
DISABLE_TARGET_test = 1
#---------------------------------------------------------------------
# Link flags
#---------------------------------------------------------------------
!include "$(_RULESDIR)\targets.vc"
!if $(DEBUG)
ldebug = -debug
!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) $(LINKERFLAGS) $(ldebug)
# Our install has a few more steps than the default install
!if $(PROFILE)
lflags = $(lflags) -profile
!endif
install: default-install-docs-n
!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
# The TIP 477 generation of pkgIndex.tcl from pkgIndex.tcl.in does not include
dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows
!if !$(STATIC_BUILD)
baselibs = $(TCLSTUBLIB) $(TDBCSTUBLIB)
!if defined(TKSTUBLIB)
# all replacements below so define our own.
baselibs = $(baselibs) $(TKSTUBLIB)
!endif
!endif
pkgindex: $(OUT_DIR)\pkgIndex.tcl
# Avoid 'unresolved external symbol __security_cookie' errors.
# c.f. http://support.microsoft.com/?id=894573
!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
baselibs = $(baselibs) bufferoverflowU.lib
!endif
!endif
$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
#---------------------------------------------------------------------
# TclTest flags
#---------------------------------------------------------------------
@nmakehlp -s << $** > $@
!if "$(TESTPAT)" != ""
TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
!endif
@PACKAGE_NAME@ $(PROJECT)
#---------------------------------------------------------------------
# Project specific targets (EDIT)
#---------------------------------------------------------------------
all: setup $(PROJECT)
$(PROJECT): setup pkgIndex $(PRJLIB)
@PACKAGE_VERSION@ $(DOTVERSION)
@TCL_VERSION_REQ@ $(TCL_VERSION_REQ)
@PKG_LIB_FILE@ $(PRJLIBNAME)
install: install-binaries install-libraries install-docs
pkgIndex: setup $(OUT_DIR)\pkgIndex.tcl
<<
!if !$(STATIC_BUILD)
$(PROJECT): $(PRJSTUBLIB)
!endif
test: setup $(PROJECT)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TCLLIBPATH=$(OUT_DIR_PATH:\=/)
@set TDBC_LIBRARY=$(LIBDIR:\=/)
@$(CPY) $(LIBDIR)\*.tcl $(OUT_DIR)
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
$(DEBUGGER) $(TCLSH) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS)
!else
@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
$(DEBUGGER) $(TCLSH) "$(ROOT:\=/)/tests/all.tcl" $(TESTFLAGS) \
-load "package ifneeded tdbc::mysql $(DOTVERSION) \
{source {$(LIBDIR:\=/)/tdbcmysql.tcl};load {$(PRJLIB:\=/)} $(PROJECT)};\
package ifneeded tdbc $(TDBC_DOTVERSION) \
{source {$(TDBC_BIN_DIR:\=/)/tdbc.tcl};load {$(TDBC_BIN_DIR:\=/)/$(TDBC_LIB_FILE)} tdbc}"
!endif
shell: setup $(PROJECT)
@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
@set TDBC_LIBRARY=$(LIBDIR:\=/)
!if $(TCLINSTALL)
@set PATH=$(_TCLDIR)\bin;$(PATH)
!else
@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
!endif
$(DEBUGGER) $(TCLSH) $(SCRIPT)
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)
$(link32) $(dlllflags) -base:@$(COFFBASE),tdbc -out:$@ $(baselibs) @<<
$**
<<
$(_VC_MANIFEST_EMBED_DLL)
-@del $*.exp
$(PRJSTUBLIB): $(PRJSTUBOBJS)
$(lib32) -nologo -out:$@ $(PRJSTUBOBJS)
#---------------------------------------------------------------------
# Implicit rules
#---------------------------------------------------------------------
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
$(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
$<
<<
{$(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)\" \
!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
#
#-------------------------------------------------------------------------
.PHONY: $(OUT_DIR)\pkgIndex.tcl
$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
@nmakehlp -s << $** > $@
@PACKAGE_NAME@ $(PROJECT)
@PACKAGE_VERSION@ $(DOTVERSION)
@TCL_VERSION_REQ@ $(TCL_VERSION_REQ)
@PKG_LIB_FILE@ $(PRJLIBNAME)
<<
$(TMP_DIR)\mysqlStubInit.obj : $(GENERICDIR)\mysqlStubInit.c
$(cc32) $(STUB_CFLAGS) $(TCL_INCLUDES) -Zl -DSTATIC_BUILD -Fo$@ $?
#---------------------------------------------------------------------
# Installation. (EDIT)
#
# You may need to modify this section to reflect the final distribution
# of your files and possibly to generate documentation.
#
#---------------------------------------------------------------------
install-binaries:
@echo Installing binaries to '$(SCRIPT_INSTALL_DIR)'
@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
@$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
install-libraries: $(OUT_DIR)\pkgIndex.tcl
@echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
@if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
@echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
@$(CPY) $(OUT_DIR)\pkgIndex.tcl "$(SCRIPT_INSTALL_DIR)"
install-docs:
@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
@if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"
#---------------------------------------------------------------------
# Clean up
#---------------------------------------------------------------------
clean:
@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.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
|
Changes to win/nmakehlp.c.
︙ | | |
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
-
-
+
+
|
/* ISO hack for dumb VC++ */
#ifdef _MSC_VER
#define snprintf _snprintf
#endif
/* protos */
static int CheckForCompilerFeature(const char *option);
static int CheckForLinkerFeature(const char *option);
static int CheckForLinkerFeature(const char **options, int count);
static int IsIn(const char *string, const char *substring);
static int SubstituteFile(const char *substs, const char *filename);
static int QualifyPath(const char *path);
static int LocateDependency(const char *keyfile);
static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
static DWORD WINAPI ReadFromPipe(LPVOID args);
/* globals */
#define CHUNK 25
#define STATICBUFFERSIZE 1000
|
︙ | | |
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
|
+
|
main(
int argc,
char *argv[])
{
char msg[300];
DWORD dwWritten;
int chars;
char *s;
/*
* Make sure children (cl.exe and link.exe) are kept quiet.
*/
SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
|
︙ | | |
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
|
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
|
-
+
-
+
-
+
|
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return CheckForCompilerFeature(argv[2]);
case 'l':
if (argc != 3) {
if (argc < 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -l <linker option>\n"
"usage: %s -l <linker option> ?<mandatory option> ...?\n"
"Tests for whether link.exe supports an option\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return CheckForLinkerFeature(argv[2]);
return CheckForLinkerFeature(&argv[2], argc-2);
case 'f':
if (argc == 2) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -f <string> <substring>\n"
"Find a substring within another\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
|
︙ | | |
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
|
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
|
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
"Extract a version from a file:\n"
"eg: pkgIndex.tcl \"package ifneeded http\"",
argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 0;
}
printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
return 0;
s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0');
if (s && *s) {
printf("%s\n", s);
return 0;
} else
return 1; /* Version not found. Return non-0 exit code */
case 'Q':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -Q path\n"
"Emit the fully qualified path\n"
"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return QualifyPath(argv[2]);
case 'L':
if (argc != 3) {
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -L keypath\n"
"Emit the fully qualified path of directory containing keypath\n"
"exitcodes: 0 == success, 1 == not found, 2 == error\n", argv[0]);
WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
&dwWritten, NULL);
return 2;
}
return LocateDependency(argv[2]);
}
}
chars = snprintf(msg, sizeof(msg) - 1,
"usage: %s -c|-f|-l|-Q|-s|-V ...\n"
"This is a little helper app to equalize shell differences between WinNT and\n"
"Win9x and get nmake.exe to accomplish its job.\n",
argv[0]);
|
︙ | | |
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
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
|
-
+
+
+
-
+
|
|| strstr(Err.buffer, "D9002") != NULL
|| strstr(Out.buffer, "D2021") != NULL
|| strstr(Err.buffer, "D2021") != NULL);
}
static int
CheckForLinkerFeature(
const char *option)
const char **options,
int count)
{
STARTUPINFO si;
PROCESS_INFORMATION pi;
SECURITY_ATTRIBUTES sa;
DWORD threadID;
char msg[300];
BOOL ok;
HANDLE hProcess, h, pipeThreads[2];
int i;
char cmdline[100];
char cmdline[255];
hProcess = GetCurrentProcess();
ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESTDHANDLES;
|
︙ | | |
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
|
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
|
+
-
+
+
+
+
|
lstrcpy(cmdline, "link.exe -nologo ");
/*
* Append our option for testing.
*/
for (i = 0; i < count; i++) {
lstrcat(cmdline, option);
lstrcat(cmdline, " \"");
lstrcat(cmdline, options[i]);
lstrcat(cmdline, "\"");
}
ok = CreateProcess(
NULL, /* Module name. */
cmdline, /* Command line. */
NULL, /* Process handle not inheritable. */
NULL, /* Thread handle not inheritable. */
TRUE, /* yes, inherit handles. */
|
︙ | | |
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
|
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
|
-
+
+
+
|
/*
* Look for the commandline warning code in the stderr stream.
*/
return !(strstr(Out.buffer, "LNK1117") != NULL ||
strstr(Err.buffer, "LNK1117") != NULL ||
strstr(Out.buffer, "LNK4044") != NULL ||
strstr(Err.buffer, "LNK4044") != NULL);
strstr(Err.buffer, "LNK4044") != NULL ||
strstr(Out.buffer, "LNK4224") != NULL ||
strstr(Err.buffer, "LNK4224") != NULL);
}
static DWORD WINAPI
ReadFromPipe(
LPVOID args)
{
pipeinfo *pi = (pipeinfo *) args;
|
︙ | | |
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
|
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
|
-
-
+
+
-
+
|
/*
* Build a list of substutitions from the first filename
*/
sp = fopen(substitutions, "rt");
if (sp != NULL) {
while (fgets(szBuffer, cbBuffer, sp) != NULL) {
char *ks, *ke, *vs, *ve;
ks = szBuffer;
unsigned char *ks, *ke, *vs, *ve;
ks = (unsigned char*)szBuffer;
while (ks && *ks && isspace(*ks)) ++ks;
ke = ks;
while (ke && *ke && !isspace(*ke)) ++ke;
vs = ke;
while (vs && *vs && isspace(*vs)) ++vs;
ve = vs;
while (ve && *ve && !(*ve == '\r' || *ve == '\n')) ++ve;
*ke = 0, *ve = 0;
list_insert(&substPtr, ks, vs);
list_insert(&substPtr, (char*)ks, (char*)vs);
}
fclose(sp);
}
/* debug: dump the list */
#ifdef _DEBUG
{
|
︙ | | |
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
|
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
|
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
|
while ((p = strchr(szPath, '/')) && *p)
*p = '\\';
PathCombine(szTmp, szCwd, szPath);
PathCanonicalize(szCwd, szTmp);
printf("%s\n", szCwd);
return 0;
}
/*
* Implements LocateDependency for a single directory. See that command
* for an explanation.
* Returns 0 if found after printing the directory.
* Returns 1 if not found but no errors.
* Returns 2 on any kind of error
* Basically, these are used as exit codes for the process.
*/
static int LocateDependencyHelper(const char *dir, const char *keypath)
{
HANDLE hSearch;
char path[MAX_PATH+1];
int dirlen, keylen, ret;
WIN32_FIND_DATA finfo;
if (dir == NULL || keypath == NULL)
return 2; /* Have no real error reporting mechanism into nmake */
dirlen = strlen(dir);
if ((dirlen + 3) > sizeof(path))
return 2;
strncpy(path, dir, dirlen);
strncpy(path+dirlen, "\\*", 3); /* Including terminating \0 */
keylen = strlen(keypath);
#if 0 /* This function is not available in Visual C++ 6 */
/*
* Use numerics 0 -> FindExInfoStandard,
* 1 -> FindExSearchLimitToDirectories,
* as these are not defined in Visual C++ 6
*/
hSearch = FindFirstFileEx(path, 0, &finfo, 1, NULL, 0);
#else
hSearch = FindFirstFile(path, &finfo);
#endif
if (hSearch == INVALID_HANDLE_VALUE)
return 1; /* Not found */
/* Loop through all subdirs checking if the keypath is under there */
ret = 1; /* Assume not found */
do {
int sublen;
/*
* We need to check it is a directory despite the
* FindExSearchLimitToDirectories in the above call. See SDK docs
*/
if ((finfo.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == 0)
continue;
sublen = strlen(finfo.cFileName);
if ((dirlen+1+sublen+1+keylen+1) > sizeof(path))
continue; /* Path does not fit, assume not matched */
strncpy(path+dirlen+1, finfo.cFileName, sublen);
path[dirlen+1+sublen] = '\\';
strncpy(path+dirlen+1+sublen+1, keypath, keylen+1);
if (PathFileExists(path)) {
/* Found a match, print to stdout */
path[dirlen+1+sublen] = '\0';
QualifyPath(path);
ret = 0;
break;
}
} while (FindNextFile(hSearch, &finfo));
FindClose(hSearch);
return ret;
}
/*
* LocateDependency --
*
* Locates a dependency for a package.
* keypath - a relative path within the package directory
* that is used to confirm it is the correct directory.
* The search path for the package directory is currently only
* the parent and grandparent of the current working directory.
* If found, the command prints
* name_DIRPATH=<full path of located directory>
* and returns 0. If not found, does not print anything and returns 1.
*/
static int LocateDependency(const char *keypath)
{
int i, ret;
static char *paths[] = {"..", "..\\..", "..\\..\\.."};
for (i = 0; i < (sizeof(paths)/sizeof(paths[0])); ++i) {
ret = LocateDependencyHelper(paths[i], keypath);
if (ret == 0)
return ret;
}
return ret;
}
/*
* Local variables:
* mode: c
* c-basic-offset: 4
* fill-column: 78
* indent-tabs-mode: t
* tab-width: 8
* End:
*/
|
Added win/rules-ext.vc.