diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2006-06-14 23:52:01 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2006-06-14 23:52:01 (GMT) |
commit | 53d75ce4d4c749f78c90f6614524a82be1a32f1b (patch) | |
tree | efa942d6ec10fd251b276cea668dd868a4abd5d5 | |
parent | 435e02ea268c7298e0ca532f5bb78c990886abd2 (diff) | |
download | tk-53d75ce4d4c749f78c90f6614524a82be1a32f1b.zip tk-53d75ce4d4c749f78c90f6614524a82be1a32f1b.tar.gz tk-53d75ce4d4c749f78c90f6614524a82be1a32f1b.tar.bz2 |
Sync with tcl to enable building with VC8 (VS2005 C compiler)
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | win/makefile.vc | 67 | ||||
-rw-r--r-- | win/nmakehlp.c | 116 | ||||
-rw-r--r-- | win/rules.vc | 204 |
4 files changed, 185 insertions, 208 deletions
@@ -1,3 +1,9 @@ +2006-06-15 Pat Thoyts <patthoyts@users.sourceforge.net> + + * win/makefile.vc: Sync with tcl to enable building with + * win/rules.vc: VC8 (VS2005 C compiler) + * win/nmakehlp.c: + 2006-06-14 Don Porter <dgp@users.sourceforge.net> * generic/tkScale.c: Revised variable writing logic to account diff --git a/win/makefile.vc b/win/makefile.vc index a6b422f..16fdbc0 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,12 +12,13 @@ # Copyright (c) 2001-2002 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.67.2.13 2006/03/28 22:23:53 patthoyts Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.67.2.14 2006/06/14 23:52:01 patthoyts Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) -# or with the MS Platform SDK (MSSDK) -!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) +# or with the MS Platform SDK (MSSDK). Visual Studio .NET 2003 and 2005 define +# VCINSTALLDIR instead. +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) && !defined(VCINSTALLDIR) MSG = ^ 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^ @@ -156,7 +157,7 @@ the build instructions. MSG = ^ You must run this makefile only from the directory it is in.^ Please `cd` to its location first. -!error $(MSG) +!error $(MSG) !endif PROJECT = tk @@ -169,19 +170,7 @@ PROJECT = tk !endif STUBPREFIX = $(PROJECT)stub -!if [nmakehlp -g ../generic/tk.h TK_VERSION] == 84 -DOTVERSION = 8.4 -!elseif [nmakehlp -g ../generic/tk.h TK_VERSION] == 85 -DOTVERSION = 8.5 -!elseif [nmakehlp -g ../generic/tk.h TK_VERSION] == 86 -DOTVERSION = 8.6 -!elseif [nmakehlp -g ../generic/tk.h TK_VERSION] == 90 -DOTVERSION = 9.0 -!elseif [nmakehlp -g ../generic/tk.h TK_VERSION] == 0 -MSG =^ -Can't get version string from ../generic/tk.h -!error $(MSG) -!endif +DOTVERSION = 8.4 VERSION = $(DOTVERSION:.=) WISHNAMEPREFIX = wish @@ -221,7 +210,8 @@ TKTESTOBJS = \ $(TMP_DIR)\tkTest.obj \ $(TMP_DIR)\tkSquare.obj \ $(TMP_DIR)\testMain.obj \ - $(TMP_DIR)\tkWinTest.obj + $(TMP_DIR)\tkWinTest.obj \ + $(TMP_DIR)\wish.res XLIBOBJS = \ $(TMP_DIR)\xcolors.obj \ @@ -363,28 +353,23 @@ TK_DEFINES = $(OPTDEFINES) # Compile flags #--------------------------------------------------------------------- -!if $(DEBUG) -!if "$(MACHINE)" == "IA64" -cdebug = -Od -Zi +!if !$(DEBUG) +!if $(OPTIMIZING) +### This cranks the optimization level to maximize speed +cdebug = -O2 $(OPTIMIZATIONS) !else -cdebug = -Z7 -Od -WX +cdebug = !endif +!else if "$(MACHINE)" == "IA64" +### Warnings are too many, can't support warnings into errors. +cdebug = -Z7 -Od $(DEBUGFLAGS) !else -# This cranks the optimization level up. We can't use -02 because sometimes -# it causes problems. -cdebug = -Oti +cdebug = -Z7 -WX $(DEBUGFLAGS) !endif -# declarations common to all compiler options -cflags = -nologo -c -W3 -YX -Fp$(TMP_DIR)^\ - -!if $(PENT_0F_ERRATA) -cflags = $(cflags) -QI0f -!endif - -!if $(ITAN_B_ERRATA) -cflags = $(cflags) -QIA64_Bx -!endif +### Declarations common to all compiler options +cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE +cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ !if $(MSVCRT) !if "$(DBGX)" == "" @@ -416,7 +401,7 @@ ldebug = -debug:full -debugtype:cv ldebug = -release -opt:ref -opt:icf,3 !endif -# declarations common to all linker options +### Declarations common to all linker options lflags = -nologo -machine:$(MACHINE) $(ldebug) !if $(PROFILE) @@ -424,10 +409,10 @@ lflags = $(lflags) -profile !endif !if $(ALIGN98_HACK) && !$(STATIC_BUILD) -# align sections for PE size savings. +### 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. +### Align sections for speed in loading by choosing the virtual page size. lflags = $(lflags) -align:4096 !endif @@ -521,6 +506,7 @@ $** $(TCLSTUBLIB) @<< $** << + $(_VC_MANIFEST_EMBED_DLL) -@del $*.exp !endif @@ -531,17 +517,20 @@ $(TKSTUBLIB): $(TKSTUBOBJS) $(WISH): $(WISHOBJS) $(TKIMPLIB) $(link32) $(guilflags) -out:$@ $(guilibs) $(TCLIMPLIB) $** + $(_VC_MANIFEST_EMBED_EXE) $(WISHC): $(WISHOBJS) $(TKIMPLIB) $(link32) $(conlflags) -out:$@ $(guilibs) $(TCLIMPLIB) $** + $(_VC_MANIFEST_EMBED_EXE) $(TKTEST): $(TKTESTOBJS) $(TKIMPLIB) $(link32) $(guilflags) -out:$@ $(guilibs) $(TCLIMPLIB) $** - + $(_VC_MANIFEST_EMBED_EXE) $(CAT32): $(_TCLDIR)\win\cat.c $(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $? $(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj $(baselibs) + $(_VC_MANIFEST_EMBED_EXE) install-binaries: @$(CPY) "$(WISH)" "$(BIN_INSTALL_DIR)\" diff --git a/win/nmakehlp.c b/win/nmakehlp.c index ff0bfd9..03841a4 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -9,27 +9,25 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * ---------------------------------------------------------------------------- - * RCS: @(#) $Id: nmakehlp.c,v 1.1.6.1 2004/10/27 00:36:34 davygrvy Exp $ + * RCS: @(#) $Id: nmakehlp.c,v 1.1.6.2 2006/06/14 23:52:01 patthoyts Exp $ * ---------------------------------------------------------------------------- */ + +#define _CRT_SECURE_NO_DEPRECATE #include <windows.h> #pragma comment (lib, "user32.lib") #pragma comment (lib, "kernel32.lib") -#include <stdio.h> /* protos */ int CheckForCompilerFeature (const char *option); int CheckForLinkerFeature (const char *option); int IsIn (const char *string, const char *substring); -int GrepForDefine (const char *file, const char *string); DWORD WINAPI ReadFromPipe (LPVOID args); /* globals */ -#define CHUNK 25 -#define STATICBUFFERSIZE 1000 typedef struct { HANDLE pipe; - char buffer[STATICBUFFERSIZE]; + char buffer[1000]; } pipeinfo; pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'}; @@ -45,10 +43,16 @@ main (int argc, char *argv[]) DWORD dwWritten; int chars; - /* make sure children (cl.exe and link.exe) are kept quiet. */ + /* + * Make sure children (cl.exe and link.exe) are kept quiet. + */ + SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); - /* Make sure the compiler and linker aren't effected by the outside world. */ + /* + * Make sure the compiler and linker aren't affected by the outside world. + */ + SetEnvironmentVariable("CL", ""); SetEnvironmentVariable("LINK", ""); @@ -85,15 +89,6 @@ main (int argc, char *argv[]) } else { return IsIn(argv[2], argv[3]); } - case 'g': - if (argc == 2) { - chars = wsprintf(msg, "usage: %s -g <file> <string>\n" - "grep for a #define\n" - "exitcodes: integer of the found string (no decimals)\n", argv[0]); - WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); - return 2; - } - return GrepForDefine(argv[2], argv[3]); } } chars = wsprintf(msg, "usage: %s -c|-l|-f ...\n" @@ -110,11 +105,11 @@ CheckForCompilerFeature (const char *option) STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; - DWORD threadID; + DWORD threadID, n; char msg[300]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; - char cmdline[100]; + char cmdline[256]; hProcess = GetCurrentProcess(); @@ -142,7 +137,12 @@ CheckForCompilerFeature (const char *option) 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); /* base command line */ - strcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X "); + n = GetEnvironmentVariable("CC", cmdline, 255); + cmdline[n] = 0; + if (n == 0) + strcpy(cmdline, "cl.exe"); + strncat(cmdline, " -nologo -c -TC -Zs -X ", 255); + /* append our option for testing */ strcat(cmdline, option); /* filename to compile, which exists, but is nothing and empty. */ @@ -186,13 +186,37 @@ CheckForCompilerFeature (const char *option) WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); + /* clean up temporary files before returning */ + DeleteFile("temp.idb"); + DeleteFile("temp.pdb"); + /* wait for our pipe to get done reading, should it be a little slow. */ WaitForMultipleObjects(2, pipeThreads, TRUE, 500); CloseHandle(pipeThreads[0]); CloseHandle(pipeThreads[1]); - /* look for the commandline warning code in both streams. */ - return !(strstr(Out.buffer, "D4002") != NULL || strstr(Err.buffer, "D4002") != NULL); +#ifdef _DEBUG + { + DWORD err = 0; + strcat(cmdline, "\n"); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), cmdline, + strlen(cmdline), &err, NULL); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), Out.buffer, + strlen(Out.buffer), &err,NULL); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), Err.buffer, + strlen(Err.buffer), &err,NULL); + } +#endif + + /* + * Look for the commandline warning code in both streams. + * - in MSVC 6 & 7 we get D4002, in MSVC 8 we get D9002. + */ + + return !(strstr(Out.buffer, "D4002") != NULL + || strstr(Err.buffer, "D4002") != NULL + || strstr(Out.buffer, "D9002") != NULL + || strstr(Err.buffer, "D9002") != NULL); } int @@ -236,6 +260,8 @@ CheckForLinkerFeature (const char *option) strcpy(cmdline, "link.exe -nologo "); /* append our option for testing */ strcat(cmdline, option); + /* filename to compile, which exists, but is nothing and empty. */ +// strcat(cmdline, " nul"); ok = CreateProcess( NULL, /* Module name. */ @@ -293,11 +319,7 @@ ReadFromPipe (LPVOID args) BOOL ok; again: - if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) { - CloseHandle(pi->pipe); - return -1; - } - ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L); + ok = ReadFile(pi->pipe, lastBuf, 25, &dwRead, 0L); if (!ok || dwRead == 0) { CloseHandle(pi->pipe); return 0; @@ -313,43 +335,3 @@ IsIn (const char *string, const char *substring) { return (strstr(string, substring) != NULL); } - -/* - * Find a specified #define by name. - * - * If the line is '#define TCL_VERSION "8.5"', it returns - * 85 as the result. - */ - -int -GrepForDefine (const char *file, const char *string) -{ - FILE *f; - char s1[51], s2[51], s3[51]; - int r = 0; - double d1; - - f = fopen(file, "rt"); - if (f == NULL) { - return 0; - } - - do { - r = fscanf(f, "%50s", s1); - if (r == 1 && !strcmp(s1, "#define")) { - /* get next two words */ - r = fscanf(f, "%50s %50s", s2, s3); - if (r != 2) continue; - /* is the first word what we're looking for? */ - if (!strcmp(s2, string)) { - fclose(f); - /* add 1 past first double quote char. "8.5" */ - d1 = atof(s3 + 1); /* 8.5 */ - return ((int) (d1 * 10) & 0xFF); /* 85 */ - } - } - } while (!feof(f)); - - fclose(f); - return 0; -} diff --git a/win/rules.vc b/win/rules.vc index deb75bd..2a5b0c7 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -7,10 +7,11 @@ # See the file "license.terms" for information on usage and redistribution # of this file, and for a DISCLAIMER OF ALL WARRANTIES. # -# Copyright (c) 2001-2003 David Gravereaux. +# Copyright (c) 2001-2002 David Gravereaux. +# Copyright (c) 2003 Patrick Thoyts # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: rules.vc,v 1.5.2.2 2004/10/27 00:36:34 davygrvy Exp $ +# RCS: @(#) $Id: rules.vc,v 1.5.2.3 2006/06/14 23:52:01 patthoyts Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC @@ -25,7 +26,7 @@ rc32 = $(RC) # built-in default. ### Assume the normal default. _INSTALLDIR = C:\Program Files\Tcl !else -### Fix the path seperators. +### Fix the path separators. _INSTALLDIR = $(INSTALLDIR:/=\) !endif @@ -33,9 +34,6 @@ _INSTALLDIR = $(INSTALLDIR:/=\) MACHINE = IX86 !endif -!ifndef CFG_ENCODING -CFG_ENCODING = \"cp1252\" -!endif #---------------------------------------------------------- # Set the proper copy method to avoid overwrite questions @@ -64,7 +62,7 @@ RMDIR = deltree /Y #---------------------------------------------------------- !if !exist(nmakehlp.exe) -!if [$(cc32) -nologo -ML nmakehlp.c -link -subsystem:console > nul] +!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul] !endif !endif @@ -73,7 +71,7 @@ RMDIR = deltree /Y #---------------------------------------------------------- ### test for optimizations -!if [nmakehlp -c -Otip] +!if [nmakehlp -c -Ot] !message *** Compiler has 'Optimizations' OPTIMIZING = 1 !else @@ -81,15 +79,71 @@ OPTIMIZING = 1 OPTIMIZING = 0 !endif +OPTIMIZATIONS = + +!if [nmakehlp -c -Ot] +OPTIMIZATIONS = $(OPTIMIZATIONS) -Ot +!endif + +!if [nmakehlp -c -Oi] +OPTIMIZATIONS = $(OPTIMIZATIONS) -Oi +!endif + +!if [nmakehlp -c -Op] +OPTIMIZATIONS = $(OPTIMIZATIONS) -Op +!endif + +!if [nmakehlp -c -fp:precise] +OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:precise +!endif + +!if [nmakehlp -c -fp:except] +OPTIMIZATIONS = $(OPTIMIZATIONS) -fp:except +!endif + +!if [nmakehlp -c -Gs] +OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs +!endif + +!if [nmakehlp -c -GS] +OPTIMIZATIONS = $(OPTIMIZATIONS) -GS +!endif + +DEBUGFLAGS = + +!if [nmakehlp -c -RTC1] +DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 +!elseif [nmakehlp -c -GZ] +DEBUGFLAGS = $(DEBUGFLAGS) -GZ +!endif + +COMPILERFLAGS =-W3 + +!if [nmakehlp -c -YX] +OPTIMIZATIONS = $(OPTIMIZATIONS) -YX +!endif + !if "$(MACHINE)" == "IX86" ### test for pentium errata !if [nmakehlp -c -QI0f] !message *** Compiler has 'Pentium 0x0f fix' -PENT_0F_ERRATA = 1 +COMPILERFLAGS = $(COMPILERFLAGSS) -QI0f !else !message *** Compiler doesn't have 'Pentium 0x0f fix' -PENT_0F_ERRATA = 0 !endif +!endif + +!if "$(MACHINE)" == "IA64" +### test for Itanium errata +!if [nmakehlp -c -QIA64_Bx] +!message *** Compiler has 'B-stepping errata workarounds' +COMPILERFLAGS = $(COMPILERFLAGS) -QIA64_Bx +!else +!message *** Compiler does not have 'B-stepping errata workarounds' +!endif +!endif + +!if "$(MACHINE)" == "IX86" ### test for -align:4096, when align:512 will do. !if [nmakehlp -l -opt:nowin98] !message *** Linker has 'Win98 alignment problem' @@ -99,21 +153,26 @@ ALIGN98_HACK = 1 ALIGN98_HACK = 0 !endif !else -PENT_0F_ERRATA = 0 ALIGN98_HACK = 0 !endif -!if "$(MACHINE)" == "IA64" -### test for Itanium errata -!if [nmakehlp -c -QIA64_Bx] -!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 +#---------------------------------------------------------- +# MSVC8 (ships with Visual Studio 2005) generates a manifest +# file that we should link into the binaries. This is how. +#---------------------------------------------------------- + +_VC_MANIFEST_EMBED_EXE= +_VC_MANIFEST_EMBED_DLL= +!if ![cl /Zs /Tc NUL 2>&1 | find "Version 12" > NUL] +VCVER=6 +!elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 13" > NUL] +VCVER=7 +!elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 14" > NUL] +VCVER=8 +_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 +_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 !else -ITAN_B_ERRATA = 0 +VCVER=0 !endif #---------------------------------------------------------- @@ -202,28 +261,21 @@ TCL_USE_STATIC_PACKAGES = 0 # by accident. #---------------------------------------------------------- -#---------------------------------------- -# Naming convention: -# t = full thread support. -# s = static library (as opposed to an -# import library) -# g = linked to the debug enabled C -# run-time. -# x = special static build when it -# links to the dynamic C run-time. -#---------------------------------------- SUFX = tsgx !if $(DEBUG) BUILDDIRTOP = Debug +DBGX = g !else BUILDDIRTOP = Release -!endif - -!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED) +DBGX = SUFX = $(SUFX:g=) !endif +#!if $(VCVER) > 6 +#BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER) +#!endif + TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX !if !$(STATIC_BUILD) @@ -284,36 +336,12 @@ TCL_COMPILE_DEBUG = 0 #---------------------------------------------------------- -# Decode the checks requested. -#---------------------------------------------------------- - -!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"] -TCL_NO_DEPRECATED = 0 -FULLWARNINGS = 0 -!else -!if [nmakehlp -f $(CHECKS) "nodep"] -!message *** Doing nodep check -TCL_NO_DEPRECATED = 1 -!else -TCL_NO_DEPRECATED = 0 -!endif -!if [nmakehlp -f $(CHECKS) "fullwarn"] -!message *** Doing full warnings check -FULLWARNINGS = 1 -!else -FULLWARNINGS = 0 -!endif -!endif - - -#---------------------------------------------------------- # Set our defines now armed with our options. #---------------------------------------------------------- -OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) - +OPTDEFINES = !if $(TCL_MEM_DEBUG) -OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG +OPTDEFINES = -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS @@ -327,9 +355,6 @@ OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 !if $(STATIC_BUILD) OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD !endif -!if $(TCL_NO_DEPRECATED) -OPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED -!endif !if $(DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DEBUG @@ -339,7 +364,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED !if $(PROFILE) OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED !endif -!if "$(MACHINE)" == "IA64" +!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !endif @@ -352,66 +377,39 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !if !defined(TCLDIR) !if exist("$(_INSTALLDIR)\include\tcl.h") -TCLH = "$(_INSTALLDIR)\include\tcl.h" TCLINSTALL = 1 _TCLDIR = $(_INSTALLDIR) !else MSG=^ -Don't know where tcl.h is. Set the TCLDIR macro. +Failed to find tcl.h. Set the TCLDIR macro. !error $(MSG) !endif !else _TCLDIR = $(TCLDIR:/=\) !if exist("$(_TCLDIR)\include\tcl.h") -TCLH = "$(_TCLDIR)\include\tcl.h" TCLINSTALL = 1 !elseif exist("$(_TCLDIR)\generic\tcl.h") -TCLH = "$(_TCLDIR)\generic\tcl.h" TCLINSTALL = 0 !else MSG =^ -Don't know where tcl.h is. The TCLDIR macro doesn't appear correct. +Failed to find tcl.h. The TCLDIR macro does not appear correct. !error $(MSG) !endif !endif -#---------------------------------------------------------- -# Get the version from the header file. Try all possibles -# even though some aren't fully valid. -#---------------------------------------------------------- +### TODO: add a command to nmakehlp.c to grep for Tcl's version from tcl.h. +### Because nmake can't return a string, we'll need to play games with return +### codes. It might look something like this: +#!if [nmakehlp -g $(TCL.H)] == 81 +#TCL_DOTVERSION = 8.1 +#!elseif [nmakehlp -g $(TCL.H)] == 82 +#TCL_DOTVERSION = 8.2 +#... +#!endif -!if [nmakehlp -g $(TCLH) TCL_VERSION] == 76 -TCL_DOTVERSION = 7.6 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 80 -TCL_DOTVERSION = 8.0 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 81 -TCL_DOTVERSION = 8.1 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 82 -TCL_DOTVERSION = 8.2 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 83 -TCL_DOTVERSION = 8.3 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 84 TCL_DOTVERSION = 8.4 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 85 -TCL_DOTVERSION = 8.5 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 86 -TCL_DOTVERSION = 8.6 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 90 -TCL_DOTVERSION = 9.0 -!elseif [nmakehlp -g $(TCLH) TCL_VERSION] == 0 -MSG =^ -Can't get version string from $(TCLH) -!error $(MSG) -!endif - TCL_VERSION = $(TCL_DOTVERSION:.=) -!if $(TCL_VERSION) < 81 -TCL_DOES_STUBS = 0 -!else -TCL_DOES_STUBS = 1 -!endif - !if $(TCLINSTALL) TCLSH = "$(_INSTALLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" TCLSTUBLIB = "$(_INSTALLDIR)\lib\tclstub$(TCL_VERSION).lib" @@ -443,5 +441,7 @@ TCLTOOLSDIR = $(_TCLDIR)\tools !message *** Output directory will be '$(OUT_DIR)' !message *** Suffix for binaries will be '$(SUFX)' !message *** Optional defines are '$(OPTDEFINES)' +!message *** Compiler version $(VCVER) options are\ + '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS)' !endif |