| 1 |
#------------------------------------------------------------------------------ |
| 2 |
# rules.vc -- |
| 3 |
# |
| 4 |
# Microsoft Visual C++ makefile include for decoding the commandline |
| 5 |
# macros. This file does not need editing to build Tcl. |
| 6 |
# |
| 7 |
# See the file "license.terms" for information on usage and redistribution |
| 8 |
# of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 9 |
# |
| 10 |
# Copyright (c) 2001-2002 David Gravereaux. |
| 11 |
# |
| 12 |
#------------------------------------------------------------------------------ |
| 13 |
# RCS: @(#) $Id: rules.vc,v 1.5.2.1 2003/03/23 02:25:22 kennykb Exp $ |
| 14 |
#------------------------------------------------------------------------------ |
| 15 |
|
| 16 |
!ifndef _RULES_VC |
| 17 |
_RULES_VC = 1 |
| 18 |
|
| 19 |
cc32 = $(CC) # built-in default. |
| 20 |
link32 = link |
| 21 |
lib32 = lib |
| 22 |
rc32 = $(RC) # built-in default. |
| 23 |
|
| 24 |
!ifndef INSTALLDIR |
| 25 |
### Assume the normal default. |
| 26 |
_INSTALLDIR = C:\Program Files\Tcl |
| 27 |
!else |
| 28 |
### Fix the path seperators. |
| 29 |
_INSTALLDIR = $(INSTALLDIR:/=\) |
| 30 |
!endif |
| 31 |
|
| 32 |
!ifndef MACHINE |
| 33 |
MACHINE = IX86 |
| 34 |
!endif |
| 35 |
|
| 36 |
|
| 37 |
#---------------------------------------------------------- |
| 38 |
# Set the proper copy method to avoid overwrite questions |
| 39 |
# to the user when copying files and selecting the right |
| 40 |
# "delete all" method. |
| 41 |
#---------------------------------------------------------- |
| 42 |
|
| 43 |
!if "$(OS)" == "Windows_NT" |
| 44 |
RMDIR = rmdir /S /Q |
| 45 |
!if ![ver | find "4.0" > nul] |
| 46 |
CPY = echo y | xcopy /i |
| 47 |
!else |
| 48 |
CPY = xcopy /i /y |
| 49 |
!endif |
| 50 |
!else |
| 51 |
CPY = xcopy /i |
| 52 |
RMDIR = deltree /Y |
| 53 |
!endif |
| 54 |
|
| 55 |
|
| 56 |
!message =============================================================================== |
| 57 |
|
| 58 |
#---------------------------------------------------------- |
| 59 |
# build the helper app we need to overcome nmake's limiting |
| 60 |
# environment. |
| 61 |
#---------------------------------------------------------- |
| 62 |
|
| 63 |
!if !exist(nmakehlp.exe) |
| 64 |
!if [$(cc32) -nologo -ML nmakehlp.c -link -subsystem:console > nul] |
| 65 |
!endif |
| 66 |
!endif |
| 67 |
|
| 68 |
#---------------------------------------------------------- |
| 69 |
# Test for compiler features |
| 70 |
#---------------------------------------------------------- |
| 71 |
|
| 72 |
### test for optimizations |
| 73 |
!if [nmakehlp -c -Otip] |
| 74 |
!message *** Compiler has 'Optimizations' |
| 75 |
OPTIMIZING = 1 |
| 76 |
!else |
| 77 |
!message *** Compiler doesn't have 'Optimizations' |
| 78 |
OPTIMIZING = 0 |
| 79 |
!endif |
| 80 |
|
| 81 |
!if "$(MACHINE)" == "IX86" |
| 82 |
### test for pentium errata |
| 83 |
!if [nmakehlp -c -QI0f] |
| 84 |
!message *** Compiler has 'Pentium 0x0f fix' |
| 85 |
PENT_0F_ERRATA = 1 |
| 86 |
!else |
| 87 |
!message *** Compiler doesn't have 'Pentium 0x0f fix' |
| 88 |
PENT_0F_ERRATA = 0 |
| 89 |
!endif |
| 90 |
### test for -align:4096, when align:512 will do. |
| 91 |
!if [nmakehlp -l -opt:nowin98] |
| 92 |
!message *** Linker has 'Win98 alignment problem' |
| 93 |
ALIGN98_HACK = 1 |
| 94 |
!else |
| 95 |
!message *** Linker doesn't have 'Win98 alignment problem' |
| 96 |
ALIGN98_HACK = 0 |
| 97 |
!endif |
| 98 |
!else |
| 99 |
PENT_0F_ERRATA = 0 |
| 100 |
ALIGN98_HACK = 0 |
| 101 |
!endif |
| 102 |
|
| 103 |
!if "$(MACHINE)" == "IA64" |
| 104 |
### test for Itanium errata |
| 105 |
!if [nmakehlp -c -QIA64_Bx] |
| 106 |
!message *** Compiler has 'B-stepping errata workarounds' |
| 107 |
ITAN_B_ERRATA = 1 |
| 108 |
!else |
| 109 |
!message *** Compiler doesn't have 'B-stepping errata workarounds' |
| 110 |
ITAN_B_ERRATA = 0 |
| 111 |
!endif |
| 112 |
!else |
| 113 |
ITAN_B_ERRATA = 0 |
| 114 |
!endif |
| 115 |
|
| 116 |
#---------------------------------------------------------- |
| 117 |
# Decode the options requested. |
| 118 |
#---------------------------------------------------------- |
| 119 |
|
| 120 |
!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"] |
| 121 |
STATIC_BUILD = 0 |
| 122 |
TCL_THREADS = 0 |
| 123 |
DEBUG = 0 |
| 124 |
PROFILE = 0 |
| 125 |
MSVCRT = 0 |
| 126 |
LOIMPACT = 0 |
| 127 |
TCL_USE_STATIC_PACKAGES = 0 |
| 128 |
USE_THREAD_ALLOC = 0 |
| 129 |
!else |
| 130 |
!if [nmakehlp -f $(OPTS) "static"] |
| 131 |
!message *** Doing static |
| 132 |
STATIC_BUILD = 1 |
| 133 |
!else |
| 134 |
STATIC_BUILD = 0 |
| 135 |
!endif |
| 136 |
!if [nmakehlp -f $(OPTS) "msvcrt"] |
| 137 |
!message *** Doing msvcrt |
| 138 |
MSVCRT = 1 |
| 139 |
!else |
| 140 |
MSVCRT = 0 |
| 141 |
!endif |
| 142 |
!if [nmakehlp -f $(OPTS) "staticpkg"] |
| 143 |
!message *** Doing staticpkg |
| 144 |
TCL_USE_STATIC_PACKAGES = 1 |
| 145 |
!else |
| 146 |
TCL_USE_STATIC_PACKAGES = 0 |
| 147 |
!endif |
| 148 |
!if [nmakehlp -f $(OPTS) "threads"] |
| 149 |
!message *** Doing threads |
| 150 |
TCL_THREADS = 1 |
| 151 |
!else |
| 152 |
TCL_THREADS = 0 |
| 153 |
!endif |
| 154 |
!if [nmakehlp -f $(OPTS) "symbols"] |
| 155 |
!message *** Doing symbols |
| 156 |
DEBUG = 1 |
| 157 |
!else |
| 158 |
DEBUG = 0 |
| 159 |
!endif |
| 160 |
!if [nmakehlp -f $(OPTS) "profile"] |
| 161 |
!message *** Doing profile |
| 162 |
PROFILE = 1 |
| 163 |
!else |
| 164 |
PROFILE = 0 |
| 165 |
!endif |
| 166 |
!if [nmakehlp -f $(OPTS) "loimpact"] |
| 167 |
!message *** Doing loimpact |
| 168 |
LOIMPACT = 1 |
| 169 |
!else |
| 170 |
LOIMPACT = 0 |
| 171 |
!endif |
| 172 |
!if [nmakehlp -f $(OPTS) "thrdalloc"] |
| 173 |
!message *** Doing thrdalloc |
| 174 |
USE_THREAD_ALLOC = 1 |
| 175 |
!else |
| 176 |
USE_THREAD_ALLOC = 0 |
| 177 |
!endif |
| 178 |
!endif |
| 179 |
|
| 180 |
|
| 181 |
!if !$(STATIC_BUILD) |
| 182 |
# Make sure we don't build overly fat DLLs. |
| 183 |
MSVCRT = 1 |
| 184 |
# We shouldn't statically put the extensions inside the shell when dynamic. |
| 185 |
TCL_USE_STATIC_PACKAGES = 0 |
| 186 |
!endif |
| 187 |
|
| 188 |
|
| 189 |
#---------------------------------------------------------- |
| 190 |
# Figure-out how to name our intermediate and output directories. |
| 191 |
# We wouldn't want different builds to use the same .obj files |
| 192 |
# by accident. |
| 193 |
#---------------------------------------------------------- |
| 194 |
|
| 195 |
SUFX = tsgx |
| 196 |
|
| 197 |
!if $(DEBUG) |
| 198 |
BUILDDIRTOP = Debug |
| 199 |
DBGX = g |
| 200 |
!else |
| 201 |
BUILDDIRTOP = Release |
| 202 |
DBGX = |
| 203 |
SUFX = $(SUFX:g=) |
| 204 |
!endif |
| 205 |
|
| 206 |
TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX |
| 207 |
|
| 208 |
!if !$(STATIC_BUILD) |
| 209 |
TMP_DIRFULL = $(TMP_DIRFULL:Static=) |
| 210 |
SUFX = $(SUFX:s=) |
| 211 |
EXT = dll |
| 212 |
!if $(MSVCRT) |
| 213 |
TMP_DIRFULL = $(TMP_DIRFULL:X=) |
| 214 |
SUFX = $(SUFX:x=) |
| 215 |
!endif |
| 216 |
!else |
| 217 |
TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=) |
| 218 |
EXT = lib |
| 219 |
!if !$(MSVCRT) |
| 220 |
TMP_DIRFULL = $(TMP_DIRFULL:X=) |
| 221 |
SUFX = $(SUFX:x=) |
| 222 |
!endif |
| 223 |
!endif |
| 224 |
|
| 225 |
!if !$(TCL_THREADS) |
| 226 |
TMP_DIRFULL = $(TMP_DIRFULL:Threaded=) |
| 227 |
SUFX = $(SUFX:t=) |
| 228 |
!endif |
| 229 |
|
| 230 |
!ifndef TMP_DIR |
| 231 |
TMP_DIR = $(TMP_DIRFULL) |
| 232 |
!ifndef OUT_DIR |
| 233 |
OUT_DIR = .\$(BUILDDIRTOP) |
| 234 |
!endif |
| 235 |
!else |
| 236 |
!ifndef OUT_DIR |
| 237 |
OUT_DIR = $(TMP_DIR) |
| 238 |
!endif |
| 239 |
!endif |
| 240 |
|
| 241 |
|
| 242 |
#---------------------------------------------------------- |
| 243 |
# Decode the statistics requested. |
| 244 |
#---------------------------------------------------------- |
| 245 |
|
| 246 |
!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"] |
| 247 |
TCL_MEM_DEBUG = 0 |
| 248 |
TCL_COMPILE_DEBUG = 0 |
| 249 |
!else |
| 250 |
!if [nmakehlp -f $(STATS) "memdbg"] |
| 251 |
!message *** Doing memdbg |
| 252 |
TCL_MEM_DEBUG = 1 |
| 253 |
!else |
| 254 |
TCL_MEM_DEBUG = 0 |
| 255 |
!endif |
| 256 |
!if [nmakehlp -f $(STATS) "compdbg"] |
| 257 |
!message *** Doing compdbg |
| 258 |
TCL_COMPILE_DEBUG = 1 |
| 259 |
!else |
| 260 |
TCL_COMPILE_DEBUG = 0 |
| 261 |
!endif |
| 262 |
!endif |
| 263 |
|
| 264 |
|
| 265 |
#---------------------------------------------------------- |
| 266 |
# Set our defines now armed with our options. |
| 267 |
#---------------------------------------------------------- |
| 268 |
|
| 269 |
OPTDEFINES = |
| 270 |
!if $(TCL_MEM_DEBUG) |
| 271 |
OPTDEFINES = -DTCL_MEM_DEBUG |
| 272 |
!endif |
| 273 |
!if $(TCL_COMPILE_DEBUG) |
| 274 |
OPTDEFINES = $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS |
| 275 |
!endif |
| 276 |
!if $(TCL_THREADS) |
| 277 |
OPTDEFINES = $(OPTDEFINES) -DTCL_THREADS=1 |
| 278 |
!if $(USE_THREAD_ALLOC) |
| 279 |
OPTDEFINES = $(OPTDEFINES) -DUSE_THREAD_ALLOC=1 |
| 280 |
!endif |
| 281 |
!endif |
| 282 |
!if $(STATIC_BUILD) |
| 283 |
OPTDEFINES = $(OPTDEFINES) -DSTATIC_BUILD |
| 284 |
!endif |
| 285 |
|
| 286 |
|
| 287 |
#---------------------------------------------------------- |
| 288 |
# Get common info used when building extensions. |
| 289 |
#---------------------------------------------------------- |
| 290 |
|
| 291 |
!if "$(PROJECT)" != "tcl" |
| 292 |
|
| 293 |
!if !defined(TCLDIR) |
| 294 |
!if exist("$(_INSTALLDIR)\include\tcl.h") |
| 295 |
TCLINSTALL = 1 |
| 296 |
_TCLDIR = $(_INSTALLDIR) |
| 297 |
!else |
| 298 |
MSG=^ |
| 299 |
Don't know where tcl.h is. Set the TCLDIR macro. |
| 300 |
!error $(MSG) |
| 301 |
!endif |
| 302 |
!else |
| 303 |
_TCLDIR = $(TCLDIR:/=\) |
| 304 |
!if exist("$(_TCLDIR)\include\tcl.h") |
| 305 |
TCLINSTALL = 1 |
| 306 |
!elseif exist("$(_TCLDIR)\generic\tcl.h") |
| 307 |
TCLINSTALL = 0 |
| 308 |
!else |
| 309 |
MSG =^ |
| 310 |
Don't know where tcl.h is. The TCLDIR macro doesn't appear correct. |
| 311 |
!error $(MSG) |
| 312 |
!endif |
| 313 |
!endif |
| 314 |
|
| 315 |
### TODO: add a command to nmakehlp.c to grep for Tcl's version from tcl.h. |
| 316 |
### Because nmake can't return a string, we'll need to play games with return |
| 317 |
### codes. It might look something like this: |
| 318 |
#!if [nmakehlp -g $(TCL.H)] == 81 |
| 319 |
#TCL_DOTVERSION = 8.1 |
| 320 |
#!elseif [nmakehlp -g $(TCL.H)] == 82 |
| 321 |
#TCL_DOTVERSION = 8.2 |
| 322 |
#... |
| 323 |
#!endif |
| 324 |
|
| 325 |
TCL_DOTVERSION = 8.4 |
| 326 |
TCL_VERSION = $(TCL_DOTVERSION:.=) |
| 327 |
|
| 328 |
!if $(TCLINSTALL) |
| 329 |
TCLSH = "$(_INSTALLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe" |
| 330 |
TCLSTUBLIB = "$(_INSTALLDIR)\lib\tclstub$(TCL_VERSION).lib" |
| 331 |
TCLIMPLIB = "$(_INSTALLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib" |
| 332 |
TCL_LIBRARY = $(_INSTALLDIR)\lib |
| 333 |
TCLREGLIB = "$(_INSTALLDIR)\lib\tclreg11$(SUFX:t=).lib" |
| 334 |
TCLDDELIB = "$(_INSTALLDIR)\lib\tcldde12$(SUFX:t=).lib" |
| 335 |
COFFBASE = \must\have\tcl\sources\to\build\this\target |
| 336 |
TCLTOOLSDIR = \must\have\tcl\sources\to\build\this\target |
| 337 |
!else |
| 338 |
TCLSH = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe" |
| 339 |
TCLSTUBLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib" |
| 340 |
TCLIMPLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib" |
| 341 |
TCL_LIBRARY = $(_TCLDIR)\library |
| 342 |
TCLREGLIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg11$(SUFX:t=).lib" |
| 343 |
TCLDDELIB = "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde12$(SUFX:t=).lib" |
| 344 |
COFFBASE = "$(_TCLDIR)\win\coffbase.txt" |
| 345 |
TCLTOOLSDIR = $(_TCLDIR)\tools |
| 346 |
!endif |
| 347 |
|
| 348 |
!endif |
| 349 |
|
| 350 |
|
| 351 |
#---------------------------------------------------------- |
| 352 |
# Display stats being used. |
| 353 |
#---------------------------------------------------------- |
| 354 |
|
| 355 |
!message *** Intermediate directory will be '$(TMP_DIR)' |
| 356 |
!message *** Output directory will be '$(OUT_DIR)' |
| 357 |
!message *** Suffix for binaries will be '$(SUFX)' |
| 358 |
!message *** Optional defines are '$(OPTDEFINES)' |
| 359 |
|
| 360 |
!endif |
| 361 |
|