1*076b9443SCy Schubert#------------------------------------------------------------------------------ 2*076b9443SCy Schubert# rules.vc -- 3*076b9443SCy Schubert# 4*076b9443SCy Schubert# Microsoft Visual C++ makefile include for decoding the commandline 5*076b9443SCy Schubert# macros. This file does not need editing to build Tcl. 6*076b9443SCy Schubert# 7*076b9443SCy Schubert# See the file "license.terms" for information on usage and redistribution 8*076b9443SCy Schubert# of this file, and for a DISCLAIMER OF ALL WARRANTIES. 9*076b9443SCy Schubert# 10*076b9443SCy Schubert# Copyright (c) 2001-2003 David Gravereaux. 11*076b9443SCy Schubert# Copyright (c) 2003-2008 Patrick Thoyts 12*076b9443SCy Schubert#------------------------------------------------------------------------------ 13*076b9443SCy Schubert 14*076b9443SCy Schubert!ifndef _RULES_VC 15*076b9443SCy Schubert_RULES_VC = 1 16*076b9443SCy Schubert 17*076b9443SCy Schubertcc32 = $(CC) # built-in default. 18*076b9443SCy Schubertlink32 = link 19*076b9443SCy Schubertlib32 = lib 20*076b9443SCy Schubertrc32 = $(RC) # built-in default. 21*076b9443SCy Schubert 22*076b9443SCy Schubert!ifndef INSTALLDIR 23*076b9443SCy Schubert### Assume the normal default. 24*076b9443SCy Schubert_INSTALLDIR = C:\Program Files\Tcl 25*076b9443SCy Schubert!else 26*076b9443SCy Schubert### Fix the path separators. 27*076b9443SCy Schubert_INSTALLDIR = $(INSTALLDIR:/=\) 28*076b9443SCy Schubert!endif 29*076b9443SCy Schubert 30*076b9443SCy Schubert#---------------------------------------------------------- 31*076b9443SCy Schubert# Set the proper copy method to avoid overwrite questions 32*076b9443SCy Schubert# to the user when copying files and selecting the right 33*076b9443SCy Schubert# "delete all" method. 34*076b9443SCy Schubert#---------------------------------------------------------- 35*076b9443SCy Schubert 36*076b9443SCy Schubert!if "$(OS)" == "Windows_NT" 37*076b9443SCy SchubertRMDIR = rmdir /S /Q 38*076b9443SCy SchubertERRNULL = 2>NUL 39*076b9443SCy Schubert!if ![ver | find "4.0" > nul] 40*076b9443SCy SchubertCPY = echo y | xcopy /i >NUL 41*076b9443SCy SchubertCOPY = copy >NUL 42*076b9443SCy Schubert!else 43*076b9443SCy SchubertCPY = xcopy /i /y >NUL 44*076b9443SCy SchubertCOPY = copy /y >NUL 45*076b9443SCy Schubert!endif 46*076b9443SCy Schubert!else # "$(OS)" != "Windows_NT" 47*076b9443SCy SchubertCPY = xcopy /i >_JUNK.OUT # On Win98 NUL does not work here. 48*076b9443SCy SchubertCOPY = copy >_JUNK.OUT # On Win98 NUL does not work here. 49*076b9443SCy SchubertRMDIR = deltree /Y 50*076b9443SCy SchubertNULL = \NUL # Used in testing directory existence 51*076b9443SCy SchubertERRNULL = >NUL # Win9x shell cannot redirect stderr 52*076b9443SCy Schubert!endif 53*076b9443SCy SchubertMKDIR = mkdir 54*076b9443SCy Schubert 55*076b9443SCy Schubert#------------------------------------------------------------------------------ 56*076b9443SCy Schubert# Determine the host and target architectures and compiler version. 57*076b9443SCy Schubert#------------------------------------------------------------------------------ 58*076b9443SCy Schubert 59*076b9443SCy Schubert_HASH=^# 60*076b9443SCy Schubert_VC_MANIFEST_EMBED_EXE= 61*076b9443SCy Schubert_VC_MANIFEST_EMBED_DLL= 62*076b9443SCy SchubertVCVER=0 63*076b9443SCy Schubert!if ![echo VCVERSION=_MSC_VER > vercl.x] \ 64*076b9443SCy Schubert && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \ 65*076b9443SCy Schubert && ![echo ARCH=IX86 >> vercl.x] \ 66*076b9443SCy Schubert && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \ 67*076b9443SCy Schubert && ![echo ARCH=AMD64 >> vercl.x] \ 68*076b9443SCy Schubert && ![echo $(_HASH)endif >> vercl.x] \ 69*076b9443SCy Schubert && ![cl -nologo -TC -P vercl.x $(ERRNULL)] 70*076b9443SCy Schubert!include vercl.i 71*076b9443SCy Schubert!if ![echo VCVER= ^\> vercl.vc] \ 72*076b9443SCy Schubert && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc] 73*076b9443SCy Schubert!include vercl.vc 74*076b9443SCy Schubert!endif 75*076b9443SCy Schubert!endif 76*076b9443SCy Schubert!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc] 77*076b9443SCy Schubert!endif 78*076b9443SCy Schubert 79*076b9443SCy Schubert!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86] 80*076b9443SCy SchubertNATIVE_ARCH=IX86 81*076b9443SCy Schubert!else 82*076b9443SCy SchubertNATIVE_ARCH=AMD64 83*076b9443SCy Schubert!endif 84*076b9443SCy Schubert 85*076b9443SCy Schubert# Since MSVC8 we must deal with manifest resources. 86*076b9443SCy Schubert!if $(VCVERSION) >= 1400 87*076b9443SCy Schubert_VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1 88*076b9443SCy Schubert_VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2 89*076b9443SCy Schubert!endif 90*076b9443SCy Schubert 91*076b9443SCy Schubert!ifndef MACHINE 92*076b9443SCy SchubertMACHINE=$(ARCH) 93*076b9443SCy Schubert!endif 94*076b9443SCy Schubert 95*076b9443SCy Schubert!ifndef CFG_ENCODING 96*076b9443SCy SchubertCFG_ENCODING = \"cp1252\" 97*076b9443SCy Schubert!endif 98*076b9443SCy Schubert 99*076b9443SCy Schubert!message =============================================================================== 100*076b9443SCy Schubert 101*076b9443SCy Schubert#---------------------------------------------------------- 102*076b9443SCy Schubert# build the helper app we need to overcome nmake's limiting 103*076b9443SCy Schubert# environment. 104*076b9443SCy Schubert#---------------------------------------------------------- 105*076b9443SCy Schubert 106*076b9443SCy Schubert!if !exist(nmakehlp.exe) 107*076b9443SCy Schubert!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul] 108*076b9443SCy Schubert!endif 109*076b9443SCy Schubert!endif 110*076b9443SCy Schubert 111*076b9443SCy Schubert#---------------------------------------------------------- 112*076b9443SCy Schubert# Test for compiler features 113*076b9443SCy Schubert#---------------------------------------------------------- 114*076b9443SCy Schubert 115*076b9443SCy Schubert### test for optimizations 116*076b9443SCy Schubert!if [nmakehlp -c -Ot] 117*076b9443SCy Schubert!message *** Compiler has 'Optimizations' 118*076b9443SCy SchubertOPTIMIZING = 1 119*076b9443SCy Schubert!else 120*076b9443SCy Schubert!message *** Compiler does not have 'Optimizations' 121*076b9443SCy SchubertOPTIMIZING = 0 122*076b9443SCy Schubert!endif 123*076b9443SCy Schubert 124*076b9443SCy SchubertOPTIMIZATIONS = 125*076b9443SCy Schubert 126*076b9443SCy Schubert!if [nmakehlp -c -Ot] 127*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -Ot 128*076b9443SCy Schubert!endif 129*076b9443SCy Schubert 130*076b9443SCy Schubert!if [nmakehlp -c -Oi] 131*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -Oi 132*076b9443SCy Schubert!endif 133*076b9443SCy Schubert 134*076b9443SCy Schubert!if [nmakehlp -c -Op] 135*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -Op 136*076b9443SCy Schubert!endif 137*076b9443SCy Schubert 138*076b9443SCy Schubert!if [nmakehlp -c -fp:strict] 139*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -fp:strict 140*076b9443SCy Schubert!endif 141*076b9443SCy Schubert 142*076b9443SCy Schubert!if [nmakehlp -c -Gs] 143*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -Gs 144*076b9443SCy Schubert!endif 145*076b9443SCy Schubert 146*076b9443SCy Schubert!if [nmakehlp -c -GS] 147*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -GS 148*076b9443SCy Schubert!endif 149*076b9443SCy Schubert 150*076b9443SCy Schubert!if [nmakehlp -c -GL] 151*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -GL 152*076b9443SCy Schubert!endif 153*076b9443SCy Schubert 154*076b9443SCy SchubertDEBUGFLAGS = 155*076b9443SCy Schubert 156*076b9443SCy Schubert!if [nmakehlp -c -RTC1] 157*076b9443SCy SchubertDEBUGFLAGS = $(DEBUGFLAGS) -RTC1 158*076b9443SCy Schubert!elseif [nmakehlp -c -GZ] 159*076b9443SCy SchubertDEBUGFLAGS = $(DEBUGFLAGS) -GZ 160*076b9443SCy Schubert!endif 161*076b9443SCy Schubert 162*076b9443SCy SchubertCOMPILERFLAGS =-W3 -DUNICODE -D_UNICODE 163*076b9443SCy Schubert 164*076b9443SCy Schubert# In v13 -GL and -YX are incompatible. 165*076b9443SCy Schubert!if [nmakehlp -c -YX] 166*076b9443SCy Schubert!if ![nmakehlp -c -GL] 167*076b9443SCy SchubertOPTIMIZATIONS = $(OPTIMIZATIONS) -YX 168*076b9443SCy Schubert!endif 169*076b9443SCy Schubert!endif 170*076b9443SCy Schubert 171*076b9443SCy Schubert!if "$(MACHINE)" == "IX86" 172*076b9443SCy Schubert### test for pentium errata 173*076b9443SCy Schubert!if [nmakehlp -c -QI0f] 174*076b9443SCy Schubert!message *** Compiler has 'Pentium 0x0f fix' 175*076b9443SCy SchubertCOMPILERFLAGS = $(COMPILERFLAGS) -QI0f 176*076b9443SCy Schubert!else 177*076b9443SCy Schubert!message *** Compiler does not have 'Pentium 0x0f fix' 178*076b9443SCy Schubert!endif 179*076b9443SCy Schubert!endif 180*076b9443SCy Schubert 181*076b9443SCy Schubert!if "$(MACHINE)" == "IA64" 182*076b9443SCy Schubert### test for Itanium errata 183*076b9443SCy Schubert!if [nmakehlp -c -QIA64_Bx] 184*076b9443SCy Schubert!message *** Compiler has 'B-stepping errata workarounds' 185*076b9443SCy SchubertCOMPILERFLAGS = $(COMPILERFLAGS) -QIA64_Bx 186*076b9443SCy Schubert!else 187*076b9443SCy Schubert!message *** Compiler does not have 'B-stepping errata workarounds' 188*076b9443SCy Schubert!endif 189*076b9443SCy Schubert!endif 190*076b9443SCy Schubert 191*076b9443SCy Schubert!if "$(MACHINE)" == "IX86" 192*076b9443SCy Schubert### test for -align:4096, when align:512 will do. 193*076b9443SCy Schubert!if [nmakehlp -l -opt:nowin98] 194*076b9443SCy Schubert!message *** Linker has 'Win98 alignment problem' 195*076b9443SCy SchubertALIGN98_HACK = 1 196*076b9443SCy Schubert!else 197*076b9443SCy Schubert!message *** Linker does not have 'Win98 alignment problem' 198*076b9443SCy SchubertALIGN98_HACK = 0 199*076b9443SCy Schubert!endif 200*076b9443SCy Schubert!else 201*076b9443SCy SchubertALIGN98_HACK = 0 202*076b9443SCy Schubert!endif 203*076b9443SCy Schubert 204*076b9443SCy SchubertLINKERFLAGS = 205*076b9443SCy Schubert 206*076b9443SCy Schubert!if [nmakehlp -l -ltcg] 207*076b9443SCy SchubertLINKERFLAGS =-ltcg 208*076b9443SCy Schubert!endif 209*076b9443SCy Schubert 210*076b9443SCy Schubert#---------------------------------------------------------- 211*076b9443SCy Schubert# Decode the options requested. 212*076b9443SCy Schubert#---------------------------------------------------------- 213*076b9443SCy Schubert 214*076b9443SCy Schubert!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] 215*076b9443SCy SchubertSTATIC_BUILD = 0 216*076b9443SCy SchubertTCL_THREADS = 1 217*076b9443SCy SchubertDEBUG = 0 218*076b9443SCy SchubertSYMBOLS = 0 219*076b9443SCy SchubertPROFILE = 0 220*076b9443SCy SchubertPGO = 0 221*076b9443SCy SchubertMSVCRT = 0 222*076b9443SCy SchubertLOIMPACT = 0 223*076b9443SCy SchubertTCL_USE_STATIC_PACKAGES = 0 224*076b9443SCy SchubertUSE_THREAD_ALLOC = 1 225*076b9443SCy SchubertUNCHECKED = 0 226*076b9443SCy Schubert!else 227*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "static"] 228*076b9443SCy Schubert!message *** Doing static 229*076b9443SCy SchubertSTATIC_BUILD = 1 230*076b9443SCy Schubert!else 231*076b9443SCy SchubertSTATIC_BUILD = 0 232*076b9443SCy Schubert!endif 233*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "msvcrt"] 234*076b9443SCy Schubert!message *** Doing msvcrt 235*076b9443SCy SchubertMSVCRT = 1 236*076b9443SCy Schubert!else 237*076b9443SCy SchubertMSVCRT = 0 238*076b9443SCy Schubert!endif 239*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "staticpkg"] 240*076b9443SCy Schubert!message *** Doing staticpkg 241*076b9443SCy SchubertTCL_USE_STATIC_PACKAGES = 1 242*076b9443SCy Schubert!else 243*076b9443SCy SchubertTCL_USE_STATIC_PACKAGES = 0 244*076b9443SCy Schubert!endif 245*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "nothreads"] 246*076b9443SCy Schubert!message *** Compile explicitly for non-threaded tcl 247*076b9443SCy SchubertTCL_THREADS = 0 248*076b9443SCy Schubert!else 249*076b9443SCy SchubertTCL_THREADS = 1 250*076b9443SCy SchubertUSE_THREAD_ALLOC= 1 251*076b9443SCy Schubert!endif 252*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "symbols"] 253*076b9443SCy Schubert!message *** Doing symbols 254*076b9443SCy SchubertDEBUG = 1 255*076b9443SCy Schubert!else 256*076b9443SCy SchubertDEBUG = 0 257*076b9443SCy Schubert!endif 258*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "pdbs"] 259*076b9443SCy Schubert!message *** Doing pdbs 260*076b9443SCy SchubertSYMBOLS = 1 261*076b9443SCy Schubert!else 262*076b9443SCy SchubertSYMBOLS = 0 263*076b9443SCy Schubert!endif 264*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "profile"] 265*076b9443SCy Schubert!message *** Doing profile 266*076b9443SCy SchubertPROFILE = 1 267*076b9443SCy Schubert!else 268*076b9443SCy SchubertPROFILE = 0 269*076b9443SCy Schubert!endif 270*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "pgi"] 271*076b9443SCy Schubert!message *** Doing profile guided optimization instrumentation 272*076b9443SCy SchubertPGO = 1 273*076b9443SCy Schubert!elseif [nmakehlp -f $(OPTS) "pgo"] 274*076b9443SCy Schubert!message *** Doing profile guided optimization 275*076b9443SCy SchubertPGO = 2 276*076b9443SCy Schubert!else 277*076b9443SCy SchubertPGO = 0 278*076b9443SCy Schubert!endif 279*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "loimpact"] 280*076b9443SCy Schubert!message *** Doing loimpact 281*076b9443SCy SchubertLOIMPACT = 1 282*076b9443SCy Schubert!else 283*076b9443SCy SchubertLOIMPACT = 0 284*076b9443SCy Schubert!endif 285*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "thrdalloc"] 286*076b9443SCy Schubert!message *** Doing thrdalloc 287*076b9443SCy SchubertUSE_THREAD_ALLOC = 1 288*076b9443SCy Schubert!endif 289*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "tclalloc"] 290*076b9443SCy Schubert!message *** Doing tclalloc 291*076b9443SCy SchubertUSE_THREAD_ALLOC = 0 292*076b9443SCy Schubert!endif 293*076b9443SCy Schubert!if [nmakehlp -f $(OPTS) "unchecked"] 294*076b9443SCy Schubert!message *** Doing unchecked 295*076b9443SCy SchubertUNCHECKED = 1 296*076b9443SCy Schubert!else 297*076b9443SCy SchubertUNCHECKED = 0 298*076b9443SCy Schubert!endif 299*076b9443SCy Schubert!endif 300*076b9443SCy Schubert 301*076b9443SCy Schubert 302*076b9443SCy Schubert!if !$(STATIC_BUILD) 303*076b9443SCy Schubert# Make sure we don't build overly fat DLLs. 304*076b9443SCy SchubertMSVCRT = 1 305*076b9443SCy Schubert# We shouldn't statically put the extensions inside the shell when dynamic. 306*076b9443SCy SchubertTCL_USE_STATIC_PACKAGES = 0 307*076b9443SCy Schubert!endif 308*076b9443SCy Schubert 309*076b9443SCy Schubert 310*076b9443SCy Schubert#---------------------------------------------------------- 311*076b9443SCy Schubert# Figure-out how to name our intermediate and output directories. 312*076b9443SCy Schubert# We wouldn't want different builds to use the same .obj files 313*076b9443SCy Schubert# by accident. 314*076b9443SCy Schubert#---------------------------------------------------------- 315*076b9443SCy Schubert 316*076b9443SCy Schubert#---------------------------------------- 317*076b9443SCy Schubert# Naming convention: 318*076b9443SCy Schubert# t = full thread support. 319*076b9443SCy Schubert# s = static library (as opposed to an 320*076b9443SCy Schubert# import library) 321*076b9443SCy Schubert# g = linked to the debug enabled C 322*076b9443SCy Schubert# run-time. 323*076b9443SCy Schubert# x = special static build when it 324*076b9443SCy Schubert# links to the dynamic C run-time. 325*076b9443SCy Schubert#---------------------------------------- 326*076b9443SCy SchubertSUFX = tsgx 327*076b9443SCy Schubert 328*076b9443SCy Schubert!if $(DEBUG) 329*076b9443SCy SchubertBUILDDIRTOP = Debug 330*076b9443SCy Schubert!else 331*076b9443SCy SchubertBUILDDIRTOP = Release 332*076b9443SCy Schubert!endif 333*076b9443SCy Schubert 334*076b9443SCy Schubert!if "$(MACHINE)" != "IX86" 335*076b9443SCy SchubertBUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE) 336*076b9443SCy Schubert!endif 337*076b9443SCy Schubert!if $(VCVER) > 6 338*076b9443SCy SchubertBUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER) 339*076b9443SCy Schubert!endif 340*076b9443SCy Schubert 341*076b9443SCy Schubert!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED) 342*076b9443SCy SchubertSUFX = $(SUFX:g=) 343*076b9443SCy Schubert!endif 344*076b9443SCy Schubert 345*076b9443SCy SchubertTMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX 346*076b9443SCy Schubert 347*076b9443SCy Schubert!if !$(STATIC_BUILD) 348*076b9443SCy SchubertTMP_DIRFULL = $(TMP_DIRFULL:Static=) 349*076b9443SCy SchubertSUFX = $(SUFX:s=) 350*076b9443SCy SchubertEXT = dll 351*076b9443SCy Schubert!if $(MSVCRT) 352*076b9443SCy SchubertTMP_DIRFULL = $(TMP_DIRFULL:X=) 353*076b9443SCy SchubertSUFX = $(SUFX:x=) 354*076b9443SCy Schubert!endif 355*076b9443SCy Schubert!else 356*076b9443SCy SchubertTMP_DIRFULL = $(TMP_DIRFULL:Dynamic=) 357*076b9443SCy SchubertEXT = lib 358*076b9443SCy Schubert!if !$(MSVCRT) 359*076b9443SCy SchubertTMP_DIRFULL = $(TMP_DIRFULL:X=) 360*076b9443SCy SchubertSUFX = $(SUFX:x=) 361*076b9443SCy Schubert!endif 362*076b9443SCy Schubert!endif 363*076b9443SCy Schubert 364*076b9443SCy Schubert!if !$(TCL_THREADS) 365*076b9443SCy SchubertTMP_DIRFULL = $(TMP_DIRFULL:Threaded=) 366*076b9443SCy SchubertSUFX = $(SUFX:t=) 367*076b9443SCy Schubert!endif 368*076b9443SCy Schubert 369*076b9443SCy Schubert!ifndef TMP_DIR 370*076b9443SCy SchubertTMP_DIR = $(TMP_DIRFULL) 371*076b9443SCy Schubert!ifndef OUT_DIR 372*076b9443SCy SchubertOUT_DIR = .\$(BUILDDIRTOP) 373*076b9443SCy Schubert!endif 374*076b9443SCy Schubert!else 375*076b9443SCy Schubert!ifndef OUT_DIR 376*076b9443SCy SchubertOUT_DIR = $(TMP_DIR) 377*076b9443SCy Schubert!endif 378*076b9443SCy Schubert!endif 379*076b9443SCy Schubert 380*076b9443SCy Schubert 381*076b9443SCy Schubert#---------------------------------------------------------- 382*076b9443SCy Schubert# Decode the statistics requested. 383*076b9443SCy Schubert#---------------------------------------------------------- 384*076b9443SCy Schubert 385*076b9443SCy Schubert!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"] 386*076b9443SCy SchubertTCL_MEM_DEBUG = 0 387*076b9443SCy SchubertTCL_COMPILE_DEBUG = 0 388*076b9443SCy Schubert!else 389*076b9443SCy Schubert!if [nmakehlp -f $(STATS) "memdbg"] 390*076b9443SCy Schubert!message *** Doing memdbg 391*076b9443SCy SchubertTCL_MEM_DEBUG = 1 392*076b9443SCy Schubert!else 393*076b9443SCy SchubertTCL_MEM_DEBUG = 0 394*076b9443SCy Schubert!endif 395*076b9443SCy Schubert!if [nmakehlp -f $(STATS) "compdbg"] 396*076b9443SCy Schubert!message *** Doing compdbg 397*076b9443SCy SchubertTCL_COMPILE_DEBUG = 1 398*076b9443SCy Schubert!else 399*076b9443SCy SchubertTCL_COMPILE_DEBUG = 0 400*076b9443SCy Schubert!endif 401*076b9443SCy Schubert!endif 402*076b9443SCy Schubert 403*076b9443SCy Schubert 404*076b9443SCy Schubert#---------------------------------------------------------- 405*076b9443SCy Schubert# Decode the checks requested. 406*076b9443SCy Schubert#---------------------------------------------------------- 407*076b9443SCy Schubert 408*076b9443SCy Schubert!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"] 409*076b9443SCy SchubertTCL_NO_DEPRECATED = 0 410*076b9443SCy SchubertWARNINGS = -W3 411*076b9443SCy Schubert!else 412*076b9443SCy Schubert!if [nmakehlp -f $(CHECKS) "nodep"] 413*076b9443SCy Schubert!message *** Doing nodep check 414*076b9443SCy SchubertTCL_NO_DEPRECATED = 1 415*076b9443SCy Schubert!else 416*076b9443SCy SchubertTCL_NO_DEPRECATED = 0 417*076b9443SCy Schubert!endif 418*076b9443SCy Schubert!if [nmakehlp -f $(CHECKS) "fullwarn"] 419*076b9443SCy Schubert!message *** Doing full warnings check 420*076b9443SCy SchubertWARNINGS = -W4 421*076b9443SCy Schubert!if [nmakehlp -l -warn:3] 422*076b9443SCy SchubertLINKERFLAGS = $(LINKERFLAGS) -warn:3 423*076b9443SCy Schubert!endif 424*076b9443SCy Schubert!else 425*076b9443SCy SchubertWARNINGS = -W3 426*076b9443SCy Schubert!endif 427*076b9443SCy Schubert!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64] 428*076b9443SCy Schubert!message *** Doing 64bit portability warnings 429*076b9443SCy SchubertWARNINGS = $(WARNINGS) -Wp64 430*076b9443SCy Schubert!endif 431*076b9443SCy Schubert!endif 432*076b9443SCy Schubert 433*076b9443SCy Schubert!if $(PGO) > 1 434*076b9443SCy Schubert!if [nmakehlp -l -ltcg:pgoptimize] 435*076b9443SCy SchubertLINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize 436*076b9443SCy Schubert!else 437*076b9443SCy SchubertMSG=^ 438*076b9443SCy SchubertThis compiler does not support profile guided optimization. 439*076b9443SCy Schubert!error $(MSG) 440*076b9443SCy Schubert!endif 441*076b9443SCy Schubert!elseif $(PGO) > 0 442*076b9443SCy Schubert!if [nmakehlp -l -ltcg:pginstrument] 443*076b9443SCy SchubertLINKERFLAGS = $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument 444*076b9443SCy Schubert!else 445*076b9443SCy SchubertMSG=^ 446*076b9443SCy SchubertThis compiler does not support profile guided optimization. 447*076b9443SCy Schubert!error $(MSG) 448*076b9443SCy Schubert!endif 449*076b9443SCy Schubert!endif 450*076b9443SCy Schubert 451*076b9443SCy Schubert#---------------------------------------------------------- 452*076b9443SCy Schubert# Set our defines now armed with our options. 453*076b9443SCy Schubert#---------------------------------------------------------- 454*076b9443SCy Schubert 455*076b9443SCy SchubertOPTDEFINES = -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS 456*076b9443SCy Schubert 457*076b9443SCy Schubert!if $(TCL_MEM_DEBUG) 458*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DTCL_MEM_DEBUG 459*076b9443SCy Schubert!endif 460*076b9443SCy Schubert!if $(TCL_COMPILE_DEBUG) 461*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS 462*076b9443SCy Schubert!endif 463*076b9443SCy Schubert!if $(TCL_THREADS) 464*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 465*076b9443SCy Schubert!if $(USE_THREAD_ALLOC) 466*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 467*076b9443SCy Schubert!endif 468*076b9443SCy Schubert!endif 469*076b9443SCy Schubert!if $(STATIC_BUILD) 470*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD 471*076b9443SCy Schubert!endif 472*076b9443SCy Schubert!if $(TCL_NO_DEPRECATED) 473*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DTCL_NO_DEPRECATED 474*076b9443SCy Schubert!endif 475*076b9443SCy Schubert 476*076b9443SCy Schubert!if !$(DEBUG) 477*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DNDEBUG 478*076b9443SCy Schubert!if $(OPTIMIZING) 479*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DTCL_CFG_OPTIMIZED 480*076b9443SCy Schubert!endif 481*076b9443SCy Schubert!endif 482*076b9443SCy Schubert!if $(PROFILE) 483*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DTCL_CFG_PROFILED 484*076b9443SCy Schubert!endif 485*076b9443SCy Schubert!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64" 486*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DTCL_CFG_DO64BIT 487*076b9443SCy Schubert!endif 488*076b9443SCy Schubert!if $(VCVERSION) < 1300 489*076b9443SCy SchubertOPTDEFINES = $(OPTDEFINES) -DNO_STRTOI64 490*076b9443SCy Schubert!endif 491*076b9443SCy Schubert 492*076b9443SCy Schubert#---------------------------------------------------------- 493*076b9443SCy Schubert# Locate the Tcl headers to build against 494*076b9443SCy Schubert#---------------------------------------------------------- 495*076b9443SCy Schubert 496*076b9443SCy Schubert!if "$(PROJECT)" == "tcl" 497*076b9443SCy Schubert 498*076b9443SCy Schubert_TCL_H = ..\generic\tcl.h 499*076b9443SCy Schubert 500*076b9443SCy Schubert!else 501*076b9443SCy Schubert 502*076b9443SCy Schubert# If INSTALLDIR set to tcl root dir then reset to the lib dir. 503*076b9443SCy Schubert!if exist("$(_INSTALLDIR)\include\tcl.h") 504*076b9443SCy Schubert_INSTALLDIR=$(_INSTALLDIR)\lib 505*076b9443SCy Schubert!endif 506*076b9443SCy Schubert 507*076b9443SCy Schubert!if !defined(TCLDIR) 508*076b9443SCy Schubert!if exist("$(_INSTALLDIR)\..\include\tcl.h") 509*076b9443SCy SchubertTCLINSTALL = 1 510*076b9443SCy Schubert_TCLDIR = $(_INSTALLDIR)\.. 511*076b9443SCy Schubert_TCL_H = $(_INSTALLDIR)\..\include\tcl.h 512*076b9443SCy SchubertTCLDIR = $(_INSTALLDIR)\.. 513*076b9443SCy Schubert!else 514*076b9443SCy SchubertMSG=^ 515*076b9443SCy SchubertFailed to find tcl.h. Set the TCLDIR macro. 516*076b9443SCy Schubert!error $(MSG) 517*076b9443SCy Schubert!endif 518*076b9443SCy Schubert!else 519*076b9443SCy Schubert_TCLDIR = $(TCLDIR:/=\) 520*076b9443SCy Schubert!if exist("$(_TCLDIR)\include\tcl.h") 521*076b9443SCy SchubertTCLINSTALL = 1 522*076b9443SCy Schubert_TCL_H = $(_TCLDIR)\include\tcl.h 523*076b9443SCy Schubert!elseif exist("$(_TCLDIR)\generic\tcl.h") 524*076b9443SCy SchubertTCLINSTALL = 0 525*076b9443SCy Schubert_TCL_H = $(_TCLDIR)\generic\tcl.h 526*076b9443SCy Schubert!else 527*076b9443SCy SchubertMSG =^ 528*076b9443SCy SchubertFailed to find tcl.h. The TCLDIR macro does not appear correct. 529*076b9443SCy Schubert!error $(MSG) 530*076b9443SCy Schubert!endif 531*076b9443SCy Schubert!endif 532*076b9443SCy Schubert!endif 533*076b9443SCy Schubert 534*076b9443SCy Schubert#-------------------------------------------------------------- 535*076b9443SCy Schubert# Extract various version numbers from tcl headers 536*076b9443SCy Schubert# The generated file is then included in the makefile. 537*076b9443SCy Schubert#-------------------------------------------------------------- 538*076b9443SCy Schubert 539*076b9443SCy Schubert!if [echo REM = This file is generated from rules.vc > versions.vc] 540*076b9443SCy Schubert!endif 541*076b9443SCy Schubert!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \ 542*076b9443SCy Schubert && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc] 543*076b9443SCy Schubert!endif 544*076b9443SCy Schubert!if [echo TCL_MINOR_VERSION = \>> versions.vc] \ 545*076b9443SCy Schubert && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc] 546*076b9443SCy Schubert!endif 547*076b9443SCy Schubert!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \ 548*076b9443SCy Schubert && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc] 549*076b9443SCy Schubert!endif 550*076b9443SCy Schubert 551*076b9443SCy Schubert# If building the tcl core then we need additional package versions 552*076b9443SCy Schubert!if "$(PROJECT)" == "tcl" 553*076b9443SCy Schubert!if [echo PKG_HTTP_VER = \>> versions.vc] \ 554*076b9443SCy Schubert && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc] 555*076b9443SCy Schubert!endif 556*076b9443SCy Schubert!if [echo PKG_TCLTEST_VER = \>> versions.vc] \ 557*076b9443SCy Schubert && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc] 558*076b9443SCy Schubert!endif 559*076b9443SCy Schubert!if [echo PKG_MSGCAT_VER = \>> versions.vc] \ 560*076b9443SCy Schubert && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc] 561*076b9443SCy Schubert!endif 562*076b9443SCy Schubert!if [echo PKG_PLATFORM_VER = \>> versions.vc] \ 563*076b9443SCy Schubert && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc] 564*076b9443SCy Schubert!endif 565*076b9443SCy Schubert!if [echo PKG_SHELL_VER = \>> versions.vc] \ 566*076b9443SCy Schubert && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc] 567*076b9443SCy Schubert!endif 568*076b9443SCy Schubert!if [echo PKG_DDE_VER = \>> versions.vc] \ 569*076b9443SCy Schubert && [nmakehlp -V ..\library\dde\pkgIndex.tcl "dde " >> versions.vc] 570*076b9443SCy Schubert!endif 571*076b9443SCy Schubert!if [echo PKG_REG_VER =\>> versions.vc] \ 572*076b9443SCy Schubert && [nmakehlp -V ..\library\reg\pkgIndex.tcl registry >> versions.vc] 573*076b9443SCy Schubert!endif 574*076b9443SCy Schubert!endif 575*076b9443SCy Schubert 576*076b9443SCy Schubert!include versions.vc 577*076b9443SCy Schubert 578*076b9443SCy Schubert#-------------------------------------------------------------- 579*076b9443SCy Schubert# Setup tcl version dependent stuff headers 580*076b9443SCy Schubert#-------------------------------------------------------------- 581*076b9443SCy Schubert 582*076b9443SCy Schubert!if "$(PROJECT)" != "tcl" 583*076b9443SCy Schubert 584*076b9443SCy SchubertTCL_VERSION = $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION) 585*076b9443SCy Schubert 586*076b9443SCy Schubert!if $(TCL_VERSION) < 81 587*076b9443SCy SchubertTCL_DOES_STUBS = 0 588*076b9443SCy Schubert!else 589*076b9443SCy SchubertTCL_DOES_STUBS = 1 590*076b9443SCy Schubert!endif 591*076b9443SCy Schubert 592*076b9443SCy Schubert!if $(TCLINSTALL) 593*076b9443SCy SchubertTCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" 594*076b9443SCy Schubert!if !exist($(TCLSH)) && $(TCL_THREADS) 595*076b9443SCy SchubertTCLSH = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe" 596*076b9443SCy Schubert!endif 597*076b9443SCy SchubertTCLSTUBLIB = "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib" 598*076b9443SCy SchubertTCLIMPLIB = "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" 599*076b9443SCy SchubertTCL_LIBRARY = $(_TCLDIR)\lib 600*076b9443SCy SchubertTCLREGLIB = "$(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib" 601*076b9443SCy SchubertTCLDDELIB = "$(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib" 602*076b9443SCy SchubertCOFFBASE = \must\have\tcl\sources\to\build\this\target 603*076b9443SCy SchubertTCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target 604*076b9443SCy SchubertTCL_INCLUDES = -I"$(_TCLDIR)\include" 605*076b9443SCy Schubert!else 606*076b9443SCy SchubertTCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" 607*076b9443SCy Schubert!if !exist($(TCLSH)) && $(TCL_THREADS) 608*076b9443SCy SchubertTCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe" 609*076b9443SCy Schubert!endif 610*076b9443SCy SchubertTCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" 611*076b9443SCy SchubertTCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" 612*076b9443SCy SchubertTCL_LIBRARY = $(_TCLDIR)\library 613*076b9443SCy SchubertTCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib" 614*076b9443SCy SchubertTCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib" 615*076b9443SCy SchubertCOFFBASE = "$(_TCLDIR)\win\coffbase.txt" 616*076b9443SCy SchubertTCLTOOLSDIR = $(_TCLDIR)\tools 617*076b9443SCy SchubertTCL_INCLUDES = -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win" 618*076b9443SCy Schubert!endif 619*076b9443SCy Schubert 620*076b9443SCy Schubert!endif 621*076b9443SCy Schubert 622*076b9443SCy Schubert#------------------------------------------------------------------------- 623*076b9443SCy Schubert# Locate the Tk headers to build against 624*076b9443SCy Schubert#------------------------------------------------------------------------- 625*076b9443SCy Schubert 626*076b9443SCy Schubert!if "$(PROJECT)" == "tk" 627*076b9443SCy Schubert_TK_H = ..\generic\tk.h 628*076b9443SCy Schubert_INSTALLDIR = $(_INSTALLDIR)\.. 629*076b9443SCy Schubert!endif 630*076b9443SCy Schubert 631*076b9443SCy Schubert!ifdef PROJECT_REQUIRES_TK 632*076b9443SCy Schubert!if !defined(TKDIR) 633*076b9443SCy Schubert!if exist("$(_INSTALLDIR)\..\include\tk.h") 634*076b9443SCy SchubertTKINSTALL = 1 635*076b9443SCy Schubert_TKDIR = $(_INSTALLDIR)\.. 636*076b9443SCy Schubert_TK_H = $(_TKDIR)\include\tk.h 637*076b9443SCy SchubertTKDIR = $(_TKDIR) 638*076b9443SCy Schubert!elseif exist("$(_TCLDIR)\include\tk.h") 639*076b9443SCy SchubertTKINSTALL = 1 640*076b9443SCy Schubert_TKDIR = $(_TCLDIR) 641*076b9443SCy Schubert_TK_H = $(_TKDIR)\include\tk.h 642*076b9443SCy SchubertTKDIR = $(_TKDIR) 643*076b9443SCy Schubert!endif 644*076b9443SCy Schubert!else 645*076b9443SCy Schubert_TKDIR = $(TKDIR:/=\) 646*076b9443SCy Schubert!if exist("$(_TKDIR)\include\tk.h") 647*076b9443SCy SchubertTKINSTALL = 1 648*076b9443SCy Schubert_TK_H = $(_TKDIR)\include\tk.h 649*076b9443SCy Schubert!elseif exist("$(_TKDIR)\generic\tk.h") 650*076b9443SCy SchubertTKINSTALL = 0 651*076b9443SCy Schubert_TK_H = $(_TKDIR)\generic\tk.h 652*076b9443SCy Schubert!else 653*076b9443SCy SchubertMSG =^ 654*076b9443SCy SchubertFailed to find tk.h. The TKDIR macro does not appear correct. 655*076b9443SCy Schubert!error $(MSG) 656*076b9443SCy Schubert!endif 657*076b9443SCy Schubert!endif 658*076b9443SCy Schubert!endif 659*076b9443SCy Schubert 660*076b9443SCy Schubert#------------------------------------------------------------------------- 661*076b9443SCy Schubert# Extract Tk version numbers 662*076b9443SCy Schubert#------------------------------------------------------------------------- 663*076b9443SCy Schubert 664*076b9443SCy Schubert!if defined(PROJECT_REQUIRES_TK) || "$(PROJECT)" == "tk" 665*076b9443SCy Schubert 666*076b9443SCy Schubert!if [echo TK_MAJOR_VERSION = \>> versions.vc] \ 667*076b9443SCy Schubert && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc] 668*076b9443SCy Schubert!endif 669*076b9443SCy Schubert!if [echo TK_MINOR_VERSION = \>> versions.vc] \ 670*076b9443SCy Schubert && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc] 671*076b9443SCy Schubert!endif 672*076b9443SCy Schubert!if [echo TK_PATCH_LEVEL = \>> versions.vc] \ 673*076b9443SCy Schubert && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc] 674*076b9443SCy Schubert!endif 675*076b9443SCy Schubert 676*076b9443SCy Schubert!include versions.vc 677*076b9443SCy Schubert 678*076b9443SCy SchubertTK_DOTVERSION = $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION) 679*076b9443SCy SchubertTK_VERSION = $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION) 680*076b9443SCy Schubert 681*076b9443SCy Schubert!if "$(PROJECT)" != "tk" 682*076b9443SCy Schubert!if $(TKINSTALL) 683*076b9443SCy SchubertWISH = "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe" 684*076b9443SCy SchubertTKSTUBLIB = "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib" 685*076b9443SCy SchubertTKIMPLIB = "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib" 686*076b9443SCy SchubertTK_INCLUDES = -I"$(_TKDIR)\include" 687*076b9443SCy Schubert!else 688*076b9443SCy SchubertWISH = "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe" 689*076b9443SCy SchubertTKSTUBLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib" 690*076b9443SCy SchubertTKIMPLIB = "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib" 691*076b9443SCy SchubertTK_INCLUDES = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib" 692*076b9443SCy Schubert!endif 693*076b9443SCy Schubert!endif 694*076b9443SCy Schubert 695*076b9443SCy Schubert!endif 696*076b9443SCy Schubert 697*076b9443SCy Schubert#---------------------------------------------------------- 698*076b9443SCy Schubert# Display stats being used. 699*076b9443SCy Schubert#---------------------------------------------------------- 700*076b9443SCy Schubert 701*076b9443SCy Schubert!message *** Intermediate directory will be '$(TMP_DIR)' 702*076b9443SCy Schubert!message *** Output directory will be '$(OUT_DIR)' 703*076b9443SCy Schubert!message *** Suffix for binaries will be '$(SUFX)' 704*076b9443SCy Schubert!message *** Optional defines are '$(OPTDEFINES)' 705*076b9443SCy Schubert!message *** Compiler version $(VCVER). Target machine is $(MACHINE) 706*076b9443SCy Schubert!message *** Host architecture is $(NATIVE_ARCH) 707*076b9443SCy Schubert!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)' 708*076b9443SCy Schubert!message *** Link options '$(LINKERFLAGS)' 709*076b9443SCy Schubert 710*076b9443SCy Schubert!endif 711*076b9443SCy Schubert 712