summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
Diffstat (limited to 'win')
-rw-r--r--win/makefile.vc4
-rw-r--r--win/nmakehlp.c44
-rw-r--r--win/rules.vc20
3 files changed, 49 insertions, 19 deletions
diff --git a/win/makefile.vc b/win/makefile.vc
index 62222de..238069d 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -12,7 +12,7 @@
# Copyright (c) 2001-2004 David Gravereaux.
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: makefile.vc,v 1.149 2006/09/26 00:05:03 patthoyts Exp $
+# RCS: @(#) $Id: makefile.vc,v 1.150 2006/09/26 20:47:03 patthoyts Exp $
#------------------------------------------------------------------------------
# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
@@ -474,7 +474,7 @@ 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
diff --git a/win/nmakehlp.c b/win/nmakehlp.c
index 5b7a3b4..28bb903 100644
--- a/win/nmakehlp.c
+++ b/win/nmakehlp.c
@@ -10,15 +10,22 @@
* of this file, and for a DISCLAIMER OF ALL WARRANTIES.
*
* ----------------------------------------------------------------------------
- * RCS: @(#) $Id: nmakehlp.c,v 1.9 2005/11/04 00:06:49 dkf Exp $
+ * RCS: @(#) $Id: nmakehlp.c,v 1.10 2006/09/26 20:47:03 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 */
@@ -70,7 +77,8 @@ main(
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,
@@ -80,7 +88,8 @@ main(
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,
@@ -90,7 +99,8 @@ main(
return CheckForLinkerFeature(argv[2]);
case 'f':
if (argc == 2) {
- chars = wsprintf(msg, "usage: %s -f <string> <substring>\n"
+ 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,
@@ -107,7 +117,8 @@ main(
}
case 'g':
if (argc == 2) {
- chars = wsprintf(msg, "usage: %s -g <file> <string>\n"
+ 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]);
@@ -118,7 +129,8 @@ main(
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]);
@@ -177,19 +189,19 @@ CheckForCompilerFeature(
* Base command line.
*/
- strcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X ");
+ lstrcpy(cmdline, "cl.exe -nologo -c -TC -Zs -X ");
/*
* Append our option for testing
*/
- strcat(cmdline, option);
+ lstrcat(cmdline, option);
/*
* Filename to compile, which exists, but is nothing and empty.
*/
- strcat(cmdline, " .\\nul");
+ lstrcat(cmdline, " .\\nul");
ok = CreateProcess(
NULL, /* Module name. */
@@ -211,7 +223,7 @@ CheckForCompilerFeature(
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;
}
@@ -309,13 +321,13 @@ CheckForLinkerFeature(
* Base command line.
*/
- strcpy(cmdline, "link.exe -nologo ");
+ lstrcpy(cmdline, "link.exe -nologo ");
/*
* Append our option for testing.
*/
- strcat(cmdline, option);
+ lstrcat(cmdline, option);
ok = CreateProcess(
NULL, /* Module name. */
@@ -331,13 +343,13 @@ CheckForLinkerFeature(
if (!ok) {
DWORD err = GetLastError();
- int chars = wsprintf(msg,
+ 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],
(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;
}
@@ -378,7 +390,9 @@ CheckForLinkerFeature(
*/
return !(strstr(Out.buffer, "LNK1117") != NULL ||
- strstr(Err.buffer, "LNK1117") != NULL);
+ strstr(Err.buffer, "LNK1117") != NULL ||
+ strstr(Out.buffer, "LNK4044") != NULL ||
+ strstr(Err.buffer, "LNK4044") != NULL);
}
DWORD WINAPI
diff --git a/win/rules.vc b/win/rules.vc
index 1a1bda6..ff4e5b8 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -11,7 +11,7 @@
# Copyright (c) 2003-2006 Patrick Thoyts
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: rules.vc,v 1.24 2006/09/26 00:05:03 patthoyts Exp $
+# RCS: @(#) $Id: rules.vc,v 1.25 2006/09/26 20:47:03 patthoyts Exp $
#------------------------------------------------------------------------------
!ifndef _RULES_VC
@@ -109,6 +109,10 @@ OPTIMIZATIONS = $(OPTIMIZATIONS) -Gs
OPTIMIZATIONS = $(OPTIMIZATIONS) -GS
!endif
+!if [nmakehlp -c -GL]
+OPTIMIZATIONS = $(OPTIMIZATIONS) -GL
+!endif
+
DEBUGFLAGS =
!if [nmakehlp -c -RTC1]
@@ -117,6 +121,10 @@ DEBUGFLAGS = $(DEBUGFLAGS) -RTC1
DEBUGFLAGS = $(DEBUGFLAGS) -GZ
!endif
+!if [nmakehlp -c -RTCc]
+DEBUGFLAGS = $(DEBUGFLAGS) -RTCc
+!endif
+
COMPILERFLAGS =-W3
!if [nmakehlp -c -YX]
@@ -156,6 +164,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.
@@ -509,6 +523,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 '$(OPTIMIZATIONS) $(DEBUGFLAGS)'
+!message *** Compiler version $(VCVER)
+!message *** Compiler options '$(OPTIMIZATIONS) $(DEBUGFLAGS)'
+!message *** Link options '$(LINKERFLAGS)'
!endif