diff options
author | patthoyts <patthoyts@users.sourceforge.net> | 2006-09-26 23:55:50 (GMT) |
---|---|---|
committer | patthoyts <patthoyts@users.sourceforge.net> | 2006-09-26 23:55:50 (GMT) |
commit | 3cb17d526fa3edf42b32a5e82b5c52f1866105a8 (patch) | |
tree | dd2b2ac49c84033e65cf74247332d4840ee9554a /win | |
parent | 16dd0f69842fc8f2155b68584dcefe10e7c4a469 (diff) | |
download | tk-3cb17d526fa3edf42b32a5e82b5c52f1866105a8.zip tk-3cb17d526fa3edf42b32a5e82b5c52f1866105a8.tar.gz tk-3cb17d526fa3edf42b32a5e82b5c52f1866105a8.tar.bz2 |
* win/makefile.vc: Support MSVC8 and AMD64 target. Also try using
* win/rules.vc: sed to generate the manifest (cross-compile cannot
* win/nmakehlp.c: execute tclsh). If no sed, use the tclsh exe.
Diffstat (limited to 'win')
-rw-r--r-- | win/makefile.vc | 27 | ||||
-rw-r--r-- | win/nmakehlp.c | 347 | ||||
-rw-r--r-- | win/rules.vc | 79 |
3 files changed, 338 insertions, 115 deletions
diff --git a/win/makefile.vc b/win/makefile.vc index bf0aeb0..097b3e6 100644 --- a/win/makefile.vc +++ b/win/makefile.vc @@ -12,7 +12,7 @@ # Copyright (c) 2001-2002 David Gravereaux. # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: makefile.vc,v 1.67.2.16 2006/09/25 17:28:21 andreas_kupries Exp $ +# RCS: @(#) $Id: makefile.vc,v 1.67.2.17 2006/09/26 23:55:50 patthoyts Exp $ #------------------------------------------------------------------------------ # Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR) @@ -371,6 +371,12 @@ cdebug = -Z7 -WX $(DEBUGFLAGS) cwarn = -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ +!if $(FULLWARNINGS) +cflags = $(cflags) -W4 +!else +cflags = $(cflags) -W3 +!endif + !if $(MSVCRT) !if "$(DBGX)" == "" crt = -MD @@ -385,10 +391,10 @@ crt = -MTd !endif !endif -BASE_CLFAGS = $(cdebug) $(cflags) $(crt) $(TK_INCLUDES) -TK_CFLAGS = $(BASE_CLFAGS) $(TK_DEFINES) -DUSE_TCL_STUBS +BASE_CFLAGS = $(cdebug) $(cflags) $(crt) $(TK_INCLUDES) +TK_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES) -DUSE_TCL_STUBS CON_CFLAGS = $(cdebug) $(cflags) $(crt) -DCONSOLE -WISH_CFLAGS = $(BASE_CLFAGS) $(TK_DEFINES) +WISH_CFLAGS = $(BASE_CFLAGS) $(TK_DEFINES) #--------------------------------------------------------------------- @@ -402,7 +408,11 @@ 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 @@ -719,6 +729,12 @@ $(TMP_DIR)\tkStubImg.obj : $(GENERICDIR)\tkStubImg.c #--------------------------------------------------------------------- $(TMP_DIR)\wish.exe.manifest: $(WINDIR)\wish.exe.manifest.in +!if ![sed "1d" < NUL > NUL] + sed -f << $** > $@ +s/@MACHINE@/$(MACHINE:IX86=X86)/ +s/@TK_WIN_VERSION@/$(DOTVERSION).0.0/ +<< +!else $(TCLSH) << set f [open {$(WINDIR:\=/)/wish.exe.manifest.in} r] set data [read $$f] @@ -733,6 +749,7 @@ puts -nonewline $$f $$data close $$f exit << +!endif $(TMP_DIR)\tk.res: \ $(RCDIR)\buttons.bmp \ diff --git a/win/nmakehlp.c b/win/nmakehlp.c index 03841a4..82a307c 100644 --- a/win/nmakehlp.c +++ b/win/nmakehlp.c @@ -1,4 +1,5 @@ -/* ---------------------------------------------------------------------------- +/* + * ---------------------------------------------------------------------------- * nmakehlp.c -- * * This is used to fix limitations within nmake and the environment. @@ -9,35 +10,51 @@ * of this file, and for a DISCLAIMER OF ALL WARRANTIES. * * ---------------------------------------------------------------------------- - * RCS: @(#) $Id: nmakehlp.c,v 1.1.6.2 2006/06/14 23:52:01 patthoyts Exp $ + * RCS: @(#) $Id: nmakehlp.c,v 1.1.6.3 2006/09/26 23:55:50 patthoyts Exp $ * ---------------------------------------------------------------------------- */ #define _CRT_SECURE_NO_DEPRECATE #include <windows.h> +#include <shlwapi.h> #pragma comment (lib, "user32.lib") #pragma comment (lib, "kernel32.lib") +#pragma comment (lib, "shlwapi.lib") +#include <stdio.h> +#include <math.h> +#if defined(_M_IA64) || defined(_M_AMD64) +#pragma comment(lib, "bufferoverflowU") +#endif + /* protos */ -int CheckForCompilerFeature (const char *option); -int CheckForLinkerFeature (const char *option); -int IsIn (const char *string, const char *substring); -DWORD WINAPI ReadFromPipe (LPVOID args); + +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[1000]; + char buffer[STATICBUFFERSIZE]; } pipeinfo; pipeinfo Out = {INVALID_HANDLE_VALUE, '\0'}; pipeinfo Err = {INVALID_HANDLE_VALUE, '\0'}; + +/* + * exitcodes: 0 == no, 1 == yes, 2 == error + */ - - -/* exitcodes: 0 == no, 1 == yes, 2 == error */ int -main (int argc, char *argv[]) +main( + int argc, + char *argv[]) { char msg[300]; DWORD dwWritten; @@ -50,7 +67,7 @@ main (int argc, char *argv[]) SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX); /* - * Make sure the compiler and linker aren't affected by the outside world. + * Make sure the compiler and linker aren't effected by the outside world. */ SetEnvironmentVariable("CL", ""); @@ -60,56 +77,79 @@ main (int argc, char *argv[]) switch (*(argv[1]+1)) { case 'c': if (argc != 3) { - chars = wsprintf(msg, "usage: %s -c <compiler option>\n" + chars = wnsprintf(msg, sizeof(msg)-1, + "usage: %s -c <compiler option>\n" "Tests for whether cl.exe supports an option\n" "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]); - WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, + &dwWritten, NULL); return 2; } return CheckForCompilerFeature(argv[2]); case 'l': if (argc != 3) { - chars = wsprintf(msg, "usage: %s -l <linker option>\n" + chars = wnsprintf(msg, sizeof(msg) - 1, + "usage: %s -l <linker 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); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, + &dwWritten, NULL); return 2; } return CheckForLinkerFeature(argv[2]); case 'f': if (argc == 2) { - chars = wsprintf(msg, "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, &dwWritten, NULL); + chars = wnsprintf(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, + &dwWritten, NULL); return 2; } else if (argc == 3) { - /* if the string is blank, there is no match */ + /* + * If the string is blank, there is no match. + */ + return 0; } else { return IsIn(argv[2], argv[3]); } + case 'g': + if (argc == 2) { + chars = wnsprintf(msg, sizeof(msg) - 1, + "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" + chars = wnsprintf(msg, sizeof(msg) - 1, + "usage: %s -c|-l|-f ...\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]); WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars, &dwWritten, NULL); return 2; } - + int -CheckForCompilerFeature (const char *option) +CheckForCompilerFeature( + const char *option) { STARTUPINFO si; PROCESS_INFORMATION pi; SECURITY_ATTRIBUTES sa; - DWORD threadID, n; + DWORD threadID; char msg[300]; BOOL ok; HANDLE hProcess, h, pipeThreads[2]; - char cmdline[256]; + char cmdline[100]; hProcess = GetCurrentProcess(); @@ -124,29 +164,44 @@ CheckForCompilerFeature (const char *option) sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = FALSE; - /* create a non-inheritible pipe. */ + /* + * Create a non-inheritible pipe. + */ + CreatePipe(&Out.pipe, &h, &sa, 0); - /* dupe the write side, make it inheritible, and close the original. */ - DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, - 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + /* + * Dupe the write side, make it inheritible, and close the original. + */ + + DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + + /* + * Same as above, but for the error side. + */ - /* Same as above, but for the error side. */ CreatePipe(&Err.pipe, &h, &sa, 0); - DuplicateHandle(hProcess, h, hProcess, &si.hStdError, - 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); - /* base command line */ - n = GetEnvironmentVariable("CC", cmdline, 255); - cmdline[n] = 0; - if (n == 0) - strcpy(cmdline, "cl.exe"); - strncat(cmdline, " -nologo -c -TC -Zs -X ", 255); + /* + * Base command line. + */ - /* append our option for testing */ - strcat(cmdline, option); - /* filename to compile, which exists, but is nothing and empty. */ - strcat(cmdline, " .\\nul"); + lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X "); + + /* + * Append our option for testing + */ + + lstrcat(cmdline, option); + + /* + * Filename to compile, which exists, but is nothing and empty. + */ + + lstrcat(cmdline, " .\\nul"); ok = CreateProcess( NULL, /* Module name. */ @@ -162,65 +217,62 @@ CheckForCompilerFeature (const char *option) if (!ok) { DWORD err = GetLastError(); - int chars = wsprintf(msg, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); + int chars = wsprintf(msg, + "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | - FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID) &msg[chars], + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| + FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], (300-chars), 0); - WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err, NULL); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); return 2; } - /* close our references to the write handles that have now been inherited. */ + /* + * Close our references to the write handles that have now been inherited. + */ + CloseHandle(si.hStdOutput); CloseHandle(si.hStdError); WaitForInputIdle(pi.hProcess, 5000); CloseHandle(pi.hThread); - /* start the pipe reader threads. */ + /* + * Start the pipe reader threads. + */ + pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID); pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID); - /* block waiting for the process to end. */ + /* + * Block waiting for the process to end. + */ + 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. + */ - /* 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]); -#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 -CheckForLinkerFeature (const char *option) +CheckForLinkerFeature( + const char *option) { STARTUPINFO si; PROCESS_INFORMATION pi; @@ -244,24 +296,38 @@ CheckForLinkerFeature (const char *option) sa.lpSecurityDescriptor = NULL; sa.bInheritHandle = TRUE; - /* create a non-inheritible pipe. */ + /* + * Create a non-inheritible pipe. + */ + CreatePipe(&Out.pipe, &h, &sa, 0); - /* dupe the write side, make it inheritible, and close the original. */ - DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, - 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + /* + * Dupe the write side, make it inheritible, and close the original. + */ + + DuplicateHandle(hProcess, h, hProcess, &si.hStdOutput, 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + + /* + * Same as above, but for the error side. + */ - /* Same as above, but for the error side. */ CreatePipe(&Err.pipe, &h, &sa, 0); - DuplicateHandle(hProcess, h, hProcess, &si.hStdError, - 0, TRUE, DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + DuplicateHandle(hProcess, h, hProcess, &si.hStdError, 0, TRUE, + DUPLICATE_SAME_ACCESS | DUPLICATE_CLOSE_SOURCE); + + /* + * Base command line. + */ + + lstrcpy(cmdline, "link.exe -nologo "); + + /* + * Append our option for testing. + */ - /* base command line */ - 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"); + lstrcat(cmdline, option); ok = CreateProcess( NULL, /* Module name. */ @@ -277,49 +343,73 @@ CheckForLinkerFeature (const char *option) if (!ok) { DWORD err = GetLastError(); - int chars = wsprintf(msg, "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); + int chars = wnsprintf(msg, sizeof(msg) - 1, + "Tried to launch: \"%s\", but got error [%u]: ", cmdline, err); - FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS | - FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID) &msg[chars], + FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM|FORMAT_MESSAGE_IGNORE_INSERTS| + FORMAT_MESSAGE_MAX_WIDTH_MASK, 0L, err, 0, (LPVOID)&msg[chars], (300-chars), 0); - WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, strlen(msg), &err, NULL); + WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, lstrlen(msg), &err,NULL); return 2; } - /* close our references to the write handles that have now been inherited. */ + /* + * Close our references to the write handles that have now been inherited. + */ + CloseHandle(si.hStdOutput); CloseHandle(si.hStdError); WaitForInputIdle(pi.hProcess, 5000); CloseHandle(pi.hThread); - /* start the pipe reader threads. */ + /* + * Start the pipe reader threads. + */ + pipeThreads[0] = CreateThread(NULL, 0, ReadFromPipe, &Out, 0, &threadID); pipeThreads[1] = CreateThread(NULL, 0, ReadFromPipe, &Err, 0, &threadID); - /* block waiting for the process to end. */ + /* + * Block waiting for the process to end. + */ + WaitForSingleObject(pi.hProcess, INFINITE); CloseHandle(pi.hProcess); - /* wait for our pipe to get done reading, should it be a little slow. */ + /* + * 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 the stderr stream. */ - return !(strstr(Out.buffer, "LNK1117") != NULL || strstr(Err.buffer, "LNK1117") != NULL); -} + /* + * 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); +} + DWORD WINAPI -ReadFromPipe (LPVOID args) +ReadFromPipe( + LPVOID args) { pipeinfo *pi = (pipeinfo *) args; char *lastBuf = pi->buffer; DWORD dwRead; BOOL ok; -again: - ok = ReadFile(pi->pipe, lastBuf, 25, &dwRead, 0L); + again: + if (lastBuf - pi->buffer + CHUNK > STATICBUFFERSIZE) { + CloseHandle(pi->pipe); + return -1; + } + ok = ReadFile(pi->pipe, lastBuf, CHUNK, &dwRead, 0L); if (!ok || dwRead == 0) { CloseHandle(pi->pipe); return 0; @@ -329,9 +419,68 @@ again: return 0; /* makes the compiler happy */ } - + int -IsIn (const char *string, const char *substring) +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 */ + while (floor(d1) != d1) { + d1 *= 10.0; + } + return ((int) d1); /* 85 */ + } + } + } while (!feof(f)); + + fclose(f); + return 0; +} diff --git a/win/rules.vc b/win/rules.vc index a45ce36..06b7c1d 100644 --- a/win/rules.vc +++ b/win/rules.vc @@ -7,11 +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-2002 David Gravereaux. -# Copyright (c) 2003 Patrick Thoyts +# Copyright (c) 2001-2003 David Gravereaux. +# Copyright (c) 2003-2006 Patrick Thoyts # #------------------------------------------------------------------------------ -# RCS: @(#) $Id: rules.vc,v 1.5.2.4 2006/09/22 19:01:52 andreas_kupries Exp $ +# RCS: @(#) $Id: rules.vc,v 1.5.2.5 2006/09/26 23:55:50 patthoyts Exp $ #------------------------------------------------------------------------------ !ifndef _RULES_VC @@ -34,6 +34,9 @@ _INSTALLDIR = $(INSTALLDIR:/=\) MACHINE = IX86 !endif +!ifndef CFG_ENCODING +CFG_ENCODING = \"cp1252\" +!endif #---------------------------------------------------------- # Set the proper copy method to avoid overwrite questions @@ -46,13 +49,14 @@ RMDIR = rmdir /S /Q !if ![ver | find "4.0" > nul] CPY = echo y | xcopy /i !else -CPY = xcopy /i /y +CPY = xcopy /i /y >NUL !endif !else CPY = xcopy /i RMDIR = deltree /Y !endif - +MKDIR = mkdir +COPY = copy /y >NUL !message =============================================================================== @@ -109,6 +113,10 @@ OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs OPTIMIZATIONS = $(OPTIMIZATIONS) -GS !endif +!if [nmakehlp -c -GL] +OPTIMIZATIONS = $(OPTIMIZATIONS) -GL +!endif + DEBUGFLAGS = !if [nmakehlp -c -RTC1] @@ -117,6 +125,10 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1 DEBUGFLAGS = $(DEBUGFLAGS) -GZ !endif +!if [nmakehlp -c -RTCc] +DEBUGFLAGS = $(DEBUGFLAGS) -RTCc +!endif + COMPILERFLAGS =-W3 !if [nmakehlp -c -YX] @@ -156,6 +168,12 @@ ALIGN98_HACK = 0 ALIGN98_HACK = 0 !endif +LINKERFLAGS = + +!if [nmakehlp -l -ltcg] +LINKERFLAGS =-ltcg +!endif + #---------------------------------------------------------- # MSVC8 (ships with Visual Studio 2005) generates a manifest # file that we should link into the binaries. This is how. @@ -261,6 +279,16 @@ 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) @@ -272,9 +300,12 @@ DBGX = SUFX = $(SUFX:g=) !endif -#!if $(VCVER) > 6 -#BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER) -#!endif +!if "$(MACHINE)" != "IX86" +BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE) +!endif +!if $(VCVER) > 6 +BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER) +!endif TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX @@ -334,6 +365,28 @@ TCL_COMPILE_DEBUG = 0 !endif !endif +#---------------------------------------------------------- +# 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. @@ -341,7 +394,7 @@ TCL_COMPILE_DEBUG = 0 OPTDEFINES = !if $(TCL_MEM_DEBUG) -OPTDEFINES = -DTCL_MEM_DEBUG +OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG !endif !if $(TCL_COMPILE_DEBUG) OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS @@ -377,6 +430,7 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT !if !defined(TCLDIR) !if exist("$(_INSTALLDIR)\include\tcl.h") +TCLH = "$(_INSTALLDIR)\include\tcl.h" TCLINSTALL = 1 _TCLDIR = $(_INSTALLDIR) !else @@ -387,8 +441,10 @@ Failed to find tcl.h. Set the TCLDIR macro. !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 =^ @@ -442,7 +498,8 @@ 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)' +!message *** Compiler version $(VCVER) +!message *** Compiler options '$(OPTIMIZATIONS) $(DEBUGFLAGS)' +!message *** Link options '$(LINKERFLAGS)' !endif |