summaryrefslogtreecommitdiffstats
path: root/win
diff options
context:
space:
mode:
authordavygrvy <davygrvy@pobox.com>2002-02-20 19:06:53 (GMT)
committerdavygrvy <davygrvy@pobox.com>2002-02-20 19:06:53 (GMT)
commitc63339d9da2747a31ca37d104e676a4f18380744 (patch)
treeca98358496f878ad9ca14dae14ce374662339552 /win
parentcc1bbd201a7a27fca359161852a83c76154dca64 (diff)
downloadtcl-c63339d9da2747a31ca37d104e676a4f18380744.zip
tcl-c63339d9da2747a31ca37d104e676a4f18380744.tar.gz
tcl-c63339d9da2747a31ca37d104e676a4f18380744.tar.bz2
* win/buildall.vc.bat:
* win/makefile.vc: * win/rules.vc: General clean-ups. Added compiler and linker tests for a) the pentium 0x0F errata, b) optimizing (not all have this), and c) linker v6 section alignment confusion. All these are tested first to make sure any D4002 or LNK1117 warnings aren't displayed. The pentium 0x0F errata is a recommended switch. The v5 linker's section alignment default is 512, but the v6 linker was changed to 4096 in an attempt to speed loading on Win98. I changed the default to always be 512 across both linkers, unless linking statically, then 4096 is used for the claimed speed effect. Using a 512 alignment saves 12k bytes of dead space in the DLL. Added IA64 B-stepping errata switch when the compiler supports it. Added profiling to $(lflags) when requested and also removed the explict -entry option as the default works fine as is. Removed win/tclWinInit.c from the special case section to let it use the common implicit rule as the $(EXTFLAGS) macro it had was never referenced anywhere.
Diffstat (limited to 'win')
-rwxr-xr-xwin/buildall.vc.bat31
-rw-r--r--win/makefile.vc65
-rw-r--r--win/rules.vc86
3 files changed, 144 insertions, 38 deletions
diff --git a/win/buildall.vc.bat b/win/buildall.vc.bat
index 2302881..74c6e29 100755
--- a/win/buildall.vc.bat
+++ b/win/buildall.vc.bat
@@ -1,19 +1,34 @@
@echo off
-rem
-rem This is an example batchfile for building everything. Please
-rem edit this (or make your own) for your needs and wants using
-rem the instructions for calling makefile.vc found in makefile.vc
-rem
-rem RCS: @(#) $Id: buildall.vc.bat,v 1.2 2001/11/20 04:23:53 davygrvy Exp $
+:: This is an example batchfile for building everything. Please
+:: edit this (or make your own) for your needs and wants using
+:: the instructions for calling makefile.vc found in makefile.vc
+::
+:: RCS: @(#) $Id: buildall.vc.bat,v 1.3 2002/02/20 19:06:53 davygrvy Exp $
-if "%MSVCDir%" == "" call c:\progra~1\micros~4\vc98\bin\vcvars32.bat
-set INSTALLDIR=d:\tclTestArea
+echo Sit back and have a couple cups of coffee while this grinds through ;)
+echo You asked for *everything*, remember?
+echo.
+
+if "%MSVCDir%" == "" call C:\progra~1\micros~4\vc98\bin\vcvars32.bat
+set INSTALLDIR=C:\progra~1\tcl
nmake -nologo -f makefile.vc release winhelp OPTS=none
+if errorlevel 1 goto error
nmake -nologo -f makefile.vc release OPTS=static
+if errorlevel 1 goto error
nmake -nologo -f makefile.vc core dlls OPTS=static,msvcrt
+if errorlevel 1 goto error
nmake -nologo -f makefile.vc core OPTS=static,threads
+if errorlevel 1 goto error
nmake -nologo -f makefile.vc dlls OPTS=static,msvcrt,threads
+if errorlevel 1 goto error
nmake -nologo -f makefile.vc shell OPTS=threads
+if errorlevel 1 goto error
+goto end
+
+:error
+echo **BOOM!**
+
+:end
pause
diff --git a/win/makefile.vc b/win/makefile.vc
index a6b082a..302657b 100644
--- a/win/makefile.vc
+++ b/win/makefile.vc
@@ -12,7 +12,7 @@
# Copyright (c) 2001 Tomasoft Engineering.
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: makefile.vc,v 1.80 2002/02/20 12:33:32 davygrvy Exp $
+# RCS: @(#) $Id: makefile.vc,v 1.81 2002/02/20 19:06:53 davygrvy Exp $
#------------------------------------------------------------------------------
!if "$(MSVCDIR)" == ""
@@ -299,9 +299,10 @@ TCLOBJS = \
TCLSTUBOBJS = $(TMP_DIR)\tclStubLib.obj
-WINDIR = $(ROOT)\win
+COMPATDIR = $(ROOT)\compat
GENERICDIR = $(ROOT)\generic
TOOLSDIR = $(ROOT)\tools
+WINDIR = $(ROOT)\win
TCL_INCLUDES = -I"$(WINDIR)" -I"$(GENERICDIR)"
TCL_DEFINES = $(OPTDEFINES)
@@ -312,16 +313,29 @@ TCL_DEFINES = $(OPTDEFINES)
#---------------------------------------------------------------------
!if !$(DEBUG)
+!if $(OPTIMIZING)
# This cranks the optimization level to maximize speed
-cdebug = -O2 -Gs
+cdebug = -O2 -Op -Gs
+!else
+cdebug =
+!endif
!else if "$(MACHINE)" == "IA64"
-cdebug = -Od -Zi
+# Warnings are too many to support warnings into errors.
+cdebug = -Z7 -Od
!else
-cdebug = -Z7 -Od -WX
+cdebug = -Z7 -WX -Od
!endif
# declarations common to all compiler options
-cflags = -nologo -c -W3 -YX -QI0f -QIfdiv -Fp$(TMP_DIR)^\
+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
!if $(MSVCRT)
crt = -MD$(DBGX)
@@ -329,9 +343,9 @@ crt = -MD$(DBGX)
crt = -MT$(DBGX)
!endif
-BASE_CLFAGS = $(cdebug) $(cflags) $(crt) $(TCL_INCLUDES)
+BASE_CLFAGS = $(cflags) $(cdebug) $(crt) $(TCL_INCLUDES)
TCL_CFLAGS = $(BASE_CLFAGS) $(TCL_DEFINES)
-CON_CFLAGS = $(cdebug) $(cflags) $(crt) -DCONSOLE
+CON_CFLAGS = $(cflags) $(cdebug) $(crt) -DCONSOLE
#---------------------------------------------------------------------
@@ -341,16 +355,24 @@ CON_CFLAGS = $(cdebug) $(cflags) $(crt) -DCONSOLE
!if $(DEBUG)
ldebug = -debug:full -debugtype:cv
!else
-ldebug = -release
+ldebug = -release -opt:ref -opt:icf,3
!endif
# declarations common to all linker options
-lflags = -nologo -machine:$(MACHINE)
+lflags = -nologo -machine:$(MACHINE) $(ldebug)
!if $(PROFILE)
lflags = $(lflags) -profile
!endif
+!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 page size.
+lflags = $(lflags) -align:4096
+!endif
+
dlllflags = $(lflags) -dll
conlflags = $(lflags) -subsystem:console
guilflags = $(lflags) -subsystem:windows
@@ -405,7 +427,7 @@ $(TCLLIB): $(TCLOBJS)
$**
<<
!else
- $(link32) $(ldebug) $(dlllflags) -out:$@ $(winlibs) @<<
+ $(link32) $(dlllflags) -out:$@ $(winlibs) @<<
$**
<<
-@del $*.exp
@@ -416,20 +438,20 @@ $(TCLSTUBLIB): $(TCLSTUBOBJS)
$(lib32) -nologo -out:$@ $(TCLSTUBOBJS)
$(TCLSH): $(TCLSHOBJS) $(TCLIMPLIB)
- $(link32) $(ldebug) $(conlflags) -stack:2300000 -out:$@ $(baselibs) @<<
+ $(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) @<<
$**
<<
$(TCLTEST): $(TCLTESTOBJS) $(TCLIMPLIB)
- $(link32) $(ldebug) $(conlflags) -stack:2300000 -out:$@ $(baselibs) @<<
+ $(link32) $(conlflags) -stack:2300000 -out:$@ $(baselibs) @<<
$**
<<
$(TCLPIPEDLL): $(WINDIR)\stub16.c
$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $(WINDIR)\stub16.c
- $(link32) $(ldebug) $(conlflags) -out:$@ $(TMP_DIR)\stub16.obj \
+ $(link32) $(conlflags) -out:$@ $(TMP_DIR)\stub16.obj \
$(baselibs)
@@ -438,7 +460,7 @@ $(TCLDDEDLL): $(TMP_DIR)\tclWinDde.obj
$(lib32) -nologo -out:$@ $(TMP_DIR)\tclWinDde.obj
!else
$(TCLDDEDLL): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB)
- $(link32) $(ldebug) $(dlllflags) -out:$@ $** $(baselibs)
+ $(link32) $(dlllflags) -out:$@ $** $(baselibs)
-@del $*.exp
-@del $*.lib
!endif
@@ -449,7 +471,7 @@ $(TCLREGDLL): $(TMP_DIR)\tclWinReg.obj
$(lib32) -nologo -out:$@ $(TMP_DIR)\tclWinReg.obj
!else
$(TCLREGDLL): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB)
- $(link32) $(ldebug) $(dlllflags) -out:$@ $** $(baselibs)
+ $(link32) $(dlllflags) -out:$@ $** $(baselibs)
-@del $*.exp
-@del $*.lib
!endif
@@ -573,9 +595,6 @@ $(TCLRTF): $(MAN2TCL).exe $(TCLSH)
# Special case object file targets
#---------------------------------------------------------------------
-$(TMP_DIR)\tclWinInit.obj: $(WINDIR)\tclWinInit.c
- $(cc32) -DBUILD_tcl $(TCL_CFLAGS) $(EXTFLAGS) -Fo$(TMP_DIR)\ $?
-
$(TMP_DIR)\testMain.obj: $(WINDIR)\tclAppInit.c
!if $(TCL_LINKWITHEXTENSIONS)
$(cc32) $(TCL_CFLAGS) -DTCL_TEST -DTCL_LINKWITHEXTENSIONS -Fo$@ $?
@@ -653,17 +672,17 @@ $(GENERICDIR)\regguts.h: $(GENERICDIR)\regcustom.h
#---------------------------------------------------------------------
{$(WINDIR)}.c{$(TMP_DIR)}.obj::
- $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<<
+ $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
- $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<<
+ $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
-{$(ROOT)\compat}.c{$(TMP_DIR)}.obj::
- $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<<
+{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
+ $(cc32) $(TCL_CFLAGS) -DBUILD_tcl -Fo$(TMP_DIR)\ @<<
$<
<<
diff --git a/win/rules.vc b/win/rules.vc
index 6a17846..016b4ee 100644
--- a/win/rules.vc
+++ b/win/rules.vc
@@ -10,7 +10,7 @@
# Copyright (c) 2001 Tomasoft Engineering.
#
#------------------------------------------------------------------------------
-# RCS: @(#) $Id: rules.vc,v 1.4 2001/11/15 00:19:41 davygrvy Exp $
+# RCS: @(#) $Id: rules.vc,v 1.5 2002/02/20 19:06:54 davygrvy Exp $
#------------------------------------------------------------------------------
!ifndef _RULES_VC
@@ -29,11 +29,72 @@ INSTALLDIR = C:\Progra~1\Tcl
MACHINE = IX86
!endif
+!message ===============================================================================
+
+
+#----------------------------------------------------------
+# Test for compiler features
+#----------------------------------------------------------
+
+### Just display the compiler and linker versions to the output
+!if [$(cc32) 2>&1 | find "(R)"]
+!endif
+!if [$(link32) 2>&1 | find "(R)"]
+!endif
+
+### test for optimizations
+!if [$(cc32) -Ox -nologo -c -Zs -TC -Fdtemp nul 2>&1 | find "D4002" > nul]
+!message *** Compiler has 'Optimizations'
+OPTIMIZING = 1
+!else
+!message *** Compiler doesn't have 'Optimizations'
+OPTIMIZING = 0
+!endif
+
+### test for pentium errata
+!if "$(MACHINE)" == "IX86"
+!if [$(cc32) -QI0f -nologo -c -Zs -TC -Fdtemp nul 2>&1 | find "D4002" > nul]
+!message *** Compiler has 'Pentium 0x0f fix'
+PENT_0F_ERRATA = 1
+!else
+!message *** Compiler doesn't have 'Pentium 0x0f fix'
+PENT_0F_ERRATA = 0
+!endif
+!if [$(link32) -nologo -opt:nowin98 2>&1 | find "LNK1117" > nul]
+!message *** Linker has 'Win98 alignment problem'
+ALIGN98_HACK = 1
+!else
+!message *** Linker doesn't have 'Win98 alignment problem'
+ALIGN98_HACK = 0
+!endif
+!else
+PENT_0F_ERRATA = 0
+ALIGN98_HACK = 0
+!endif
+
+### test for Itanium errata
+!if "$(MACHINE)" == "IA64"
+!if [$(cc32) -QIA64_Bx -nologo -c -Zs -TC -Fdtemp nul 2>&1 | find "D4002" > nul]
+!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
+!else
+ITAN_B_ERRATA = 0
+!endif
+
+### Clean-up temp files after tests.
+!if [@for %d in (temp.idb temp.pdb) do @if exist %d del %d]
+!endif
+
#----------------------------------------------------------
# Decode the options requested.
#----------------------------------------------------------
-!if "$(OPTS)" == "" || ![echo $(OPTS) | find /i "none" > nul]
+
+!if "$(OPTS)" == "" || ![echo "$(OPTS)" | find /i "none" > nul]
STATIC_BUILD = 0
TCL_THREADS = 0
DEBUG = 0
@@ -140,15 +201,12 @@ OUT_DIR = $(TMP_DIR)
!endif
!endif
-!message *** Intermediate directory will be '$(TMP_DIR)'
-!message *** Output directory will be '$(OUT_DIR)'
-!message *** Suffix for binaries will be '$(SUFX)'
-
#----------------------------------------------------------
# Decode the statistics requested.
#----------------------------------------------------------
-!if "$(STATS)" == "" || ![echo $(STATS) | find /i "none" > nul]
+
+!if "$(STATS)" == "" || ![echo "$(STATS)" | find /i "none" > nul]
TCL_MEM_DEBUG = 0
TCL_COMPILE_DEBUG = 0
!else
@@ -166,6 +224,11 @@ TCL_COMPILE_DEBUG = 0
!endif
!endif
+
+#----------------------------------------------------------
+# Set our defines armed with our options.
+#----------------------------------------------------------
+
OPTDEFINES =
!if $(TCL_MEM_DEBUG)
OPTDEFINES = -DTCL_MEM_DEBUG
@@ -180,6 +243,15 @@ OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1
OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD
!endif
+
+#----------------------------------------------------------
+# Display stats being used.
+#----------------------------------------------------------
+
+!message *** Intermediate directory will be '$(TMP_DIR)'
+!message *** Output directory will be '$(OUT_DIR)'
+!message *** Suffix for binaries will be '$(SUFX)'
!message *** Optional defines are '$(OPTDEFINES)'
+!message
!endif