summaryrefslogtreecommitdiffstats
path: root/win/rules.vc
diff options
context:
space:
mode:
Diffstat (limited to 'win/rules.vc')
-rw-r--r--win/rules.vc132
1 files changed, 109 insertions, 23 deletions
diff --git a/win/rules.vc b/win/rules.vc
index 6562add..4217753 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -8,9 +8,10 @@
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
#
# Copyright (c) 2001-2003 David Gravereaux.
+# Copyright (c) 2003-2006 Patrick Thoyts
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: rules.vc,v 1.12 2006/09/22 19:02:08 andreas_kupries Exp $
+# RCS: @(#) $Id: rules.vc,v 1.13 2006/10/19 00:48:26 patthoyts Exp $
#------------------------------------------------------------------------------
!ifndef _RULES_VC
@@ -25,12 +26,16 @@ 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
!ifndef MACHINE
+!if "$(CPU)" == ""
MACHINE = IX86
+!else
+MACHINE = $(CPU)
+!endif
!endif
!ifndef CFG_ENCODING
@@ -48,13 +53,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 ===============================================================================
@@ -64,7 +70,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 +79,7 @@ RMDIR = deltree /Y
#----------------------------------------------------------
### test for optimizations
-!if [nmakehlp -c -Otip]
+!if [nmakehlp -c -Ot]
!message *** Compiler has 'Optimizations'
OPTIMIZING = 1
!else
@@ -81,15 +87,75 @@ 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
+
+!if [nmakehlp -c -GL]
+OPTIMIZATIONS = $(OPTIMIZATIONS) -GL
+!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 +165,32 @@ 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
+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.
+#----------------------------------------------------------
+
+_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
#----------------------------------------------------------
@@ -220,6 +297,13 @@ BUILDDIRTOP = Debug
BUILDDIRTOP = Release
!endif
+!if "$(MACHINE)" != "IX86"
+BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
+!endif
+!if $(VCVER) > 6
+BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
+!endif
+
!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
SUFX = $(SUFX:g=)
!endif
@@ -310,7 +394,7 @@ FULLWARNINGS = 0
# Set our defines now armed with our options.
#----------------------------------------------------------
-OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING)
+OPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
!if $(TCL_MEM_DEBUG)
OPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG
@@ -339,7 +423,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
@@ -357,7 +441,7 @@ 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
@@ -370,7 +454,7 @@ 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
@@ -404,7 +488,6 @@ Can't get version string from $(TCLH)
!error $(MSG)
!endif
-TCL_PATCHLEVEL = a5
TCL_VERSION = $(TCL_DOTVERSION:.=)
!if $(TCL_VERSION) < 81
@@ -444,5 +527,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)
+!message *** Compiler options '$(OPTIMIZATIONS) $(DEBUGFLAGS)'
+!message *** Link options '$(LINKERFLAGS)'
!endif