os/persistentdata/persistentstorage/sqlite3api/TEST/TCL/tcldistribution/win/rules.vc
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
     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-2003 David Gravereaux.
    11 # Copyright (c) 2003-2006 Patrick Thoyts
    12 #
    13 #------------------------------------------------------------------------------
    14 # RCS: @(#) $Id: rules.vc,v 1.11.2.6 2006/10/31 15:17:20 patthoyts Exp $
    15 #------------------------------------------------------------------------------
    16 
    17 !ifndef _RULES_VC
    18 _RULES_VC = 1
    19 
    20 cc32		= $(CC)   # built-in default.
    21 link32		= link
    22 lib32		= lib
    23 rc32		= $(RC)   # built-in default.
    24 
    25 !ifndef INSTALLDIR
    26 ### Assume the normal default.
    27 _INSTALLDIR	= C:\Program Files\Tcl
    28 !else
    29 ### Fix the path separators.
    30 _INSTALLDIR	= $(INSTALLDIR:/=\)
    31 !endif
    32 
    33 !ifndef MACHINE
    34 !if "$(CPU)" == "" || "$(CPU)" == "i386"
    35 MACHINE		= IX86
    36 !else
    37 MACHINE         = $(CPU)
    38 !endif
    39 !endif
    40 
    41 !ifndef CFG_ENCODING
    42 CFG_ENCODING	= \"cp1252\"
    43 !endif
    44 
    45 #----------------------------------------------------------
    46 # Set the proper copy method to avoid overwrite questions
    47 # to the user when copying files and selecting the right
    48 # "delete all" method.
    49 #----------------------------------------------------------
    50 
    51 !if "$(OS)" == "Windows_NT"
    52 RMDIR	= rmdir /S /Q
    53 !if ![ver | find "4.0" > nul]
    54 CPY	= echo y | xcopy /i
    55 !else
    56 CPY	= xcopy /i /y >NUL
    57 !endif
    58 !else
    59 CPY	= xcopy /i
    60 RMDIR	= deltree /Y
    61 !endif
    62 MKDIR   = mkdir
    63 COPY    = copy /y >NUL
    64 
    65 !message ===============================================================================
    66 
    67 #----------------------------------------------------------
    68 # build the helper app we need to overcome nmake's limiting
    69 # environment.
    70 #----------------------------------------------------------
    71 
    72 !if !exist(nmakehlp.exe)
    73 !if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul]
    74 !endif
    75 !endif
    76 
    77 #----------------------------------------------------------
    78 # Test for compiler features
    79 #----------------------------------------------------------
    80 
    81 ### test for optimizations
    82 !if [nmakehlp -c -Ot]
    83 !message *** Compiler has 'Optimizations'
    84 OPTIMIZING	= 1
    85 !else
    86 !message *** Compiler doesn't have 'Optimizations'
    87 OPTIMIZING	= 0
    88 !endif
    89 
    90 OPTIMIZATIONS   =
    91 
    92 !if [nmakehlp -c -Ot]
    93 OPTIMIZATIONS  = $(OPTIMIZATIONS) -Ot
    94 !endif
    95 
    96 !if [nmakehlp -c -Oi]
    97 OPTIMIZATIONS  = $(OPTIMIZATIONS) -Oi
    98 !endif
    99 
   100 !if [nmakehlp -c -Op]
   101 OPTIMIZATIONS  = $(OPTIMIZATIONS) -Op
   102 !endif
   103 
   104 !if [nmakehlp -c -fp:strict]
   105 OPTIMIZATIONS  = $(OPTIMIZATIONS) -fp:strict
   106 !endif
   107 
   108 !if [nmakehlp -c -Gs]
   109 OPTIMIZATIONS  = $(OPTIMIZATIONS) -Gs
   110 !endif
   111 
   112 !if [nmakehlp -c -GS]
   113 OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
   114 !endif
   115 
   116 !if [nmakehlp -c -GL]
   117 OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
   118 !endif
   119 
   120 DEBUGFLAGS     =
   121 
   122 !if [nmakehlp -c -RTC1]
   123 DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
   124 !elseif [nmakehlp -c -GZ]
   125 DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
   126 !endif
   127 
   128 COMPILERFLAGS  =-W3
   129 
   130 # In v13 -GL and -YX are incompatible.
   131 !if [nmakehlp -c -YX]
   132 !if ![nmakehlp -c -GL]
   133 OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
   134 !endif
   135 !endif
   136 
   137 !if "$(MACHINE)" == "IX86"
   138 ### test for pentium errata
   139 !if [nmakehlp -c -QI0f]
   140 !message *** Compiler has 'Pentium 0x0f fix'
   141 COMPILERFLAGS  = $(COMPILERFLAGSS) -QI0f
   142 !else
   143 !message *** Compiler doesn't have 'Pentium 0x0f fix'
   144 !endif
   145 !endif
   146 
   147 !if "$(MACHINE)" == "IA64"
   148 ### test for Itanium errata
   149 !if [nmakehlp -c -QIA64_Bx]
   150 !message *** Compiler has 'B-stepping errata workarounds'
   151 COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
   152 !else
   153 !message *** Compiler does not have 'B-stepping errata workarounds'
   154 !endif
   155 !endif
   156 
   157 !if "$(MACHINE)" == "IX86"
   158 ### test for -align:4096, when align:512 will do.
   159 !if [nmakehlp -l -opt:nowin98]
   160 !message *** Linker has 'Win98 alignment problem'
   161 ALIGN98_HACK	= 1
   162 !else
   163 !message *** Linker doesn't have 'Win98 alignment problem'
   164 ALIGN98_HACK	= 0
   165 !endif
   166 !else
   167 ALIGN98_HACK	= 0
   168 !endif
   169 
   170 LINKERFLAGS     =
   171 
   172 !if [nmakehlp -l -ltcg]
   173 LINKERFLAGS     =-ltcg
   174 !endif
   175 
   176 #----------------------------------------------------------
   177 # MSVC8 (ships with Visual Studio 2005) generates a manifest
   178 # file that we should link into the binaries. This is how.
   179 #----------------------------------------------------------
   180 
   181 _VC_MANIFEST_EMBED_EXE=
   182 _VC_MANIFEST_EMBED_DLL=
   183 !if ![cl /Zs /Tc NUL 2>&1 | find "Version 12" > NUL]
   184 VCVER=6
   185 !elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 13" > NUL]
   186 VCVER=7
   187 !elseif ![cl /Zs /Tc NUL 2>&1 | find "Version 14" > NUL]
   188 VCVER=8
   189 _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
   190 _VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
   191 !else
   192 VCVER=0
   193 !endif
   194 
   195 #----------------------------------------------------------
   196 # Decode the options requested.
   197 #----------------------------------------------------------
   198 
   199 !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
   200 STATIC_BUILD	= 0
   201 TCL_THREADS	= 0
   202 DEBUG		= 0
   203 PROFILE		= 0
   204 MSVCRT		= 0
   205 LOIMPACT	= 0
   206 TCL_USE_STATIC_PACKAGES	= 0
   207 USE_THREAD_ALLOC = 0
   208 UNCHECKED	= 0
   209 !else
   210 !if [nmakehlp -f $(OPTS) "static"]
   211 !message *** Doing static
   212 STATIC_BUILD	= 1
   213 !else
   214 STATIC_BUILD	= 0
   215 !endif
   216 !if [nmakehlp -f $(OPTS) "msvcrt"]
   217 !message *** Doing msvcrt
   218 MSVCRT		= 1
   219 !else
   220 MSVCRT		= 0
   221 !endif
   222 !if [nmakehlp -f $(OPTS) "staticpkg"]
   223 !message *** Doing staticpkg
   224 TCL_USE_STATIC_PACKAGES	= 1
   225 !else
   226 TCL_USE_STATIC_PACKAGES	= 0
   227 !endif
   228 !if [nmakehlp -f $(OPTS) "threads"]
   229 !message *** Doing threads
   230 TCL_THREADS	= 1
   231 !else
   232 TCL_THREADS	= 0
   233 !endif
   234 !if [nmakehlp -f $(OPTS) "symbols"]
   235 !message *** Doing symbols
   236 DEBUG		= 1
   237 !else
   238 DEBUG		= 0
   239 !endif
   240 !if [nmakehlp -f $(OPTS) "profile"]
   241 !message *** Doing profile
   242 PROFILE		= 1
   243 !else
   244 PROFILE		= 0
   245 !endif
   246 !if [nmakehlp -f $(OPTS) "loimpact"]
   247 !message *** Doing loimpact
   248 LOIMPACT	= 1
   249 !else
   250 LOIMPACT	= 0
   251 !endif
   252 !if [nmakehlp -f $(OPTS) "thrdalloc"]
   253 !message *** Doing thrdalloc
   254 USE_THREAD_ALLOC = 1
   255 !else
   256 USE_THREAD_ALLOC = 0
   257 !endif
   258 !if [nmakehlp -f $(OPTS) "unchecked"]
   259 !message *** Doing unchecked
   260 UNCHECKED = 1
   261 !else
   262 UNCHECKED = 0
   263 !endif
   264 !endif
   265 
   266 
   267 !if !$(STATIC_BUILD)
   268 # Make sure we don't build overly fat DLLs.
   269 MSVCRT		= 1
   270 # We shouldn't statically put the extensions inside the shell when dynamic.
   271 TCL_USE_STATIC_PACKAGES = 0
   272 !endif
   273 
   274 
   275 #----------------------------------------------------------
   276 # Figure-out how to name our intermediate and output directories.
   277 # We wouldn't want different builds to use the same .obj files
   278 # by accident.
   279 #----------------------------------------------------------
   280 
   281 #----------------------------------------
   282 # Naming convention:
   283 #   t = full thread support.
   284 #   s = static library (as opposed to an
   285 #	import library)
   286 #   g = linked to the debug enabled C
   287 #	run-time.
   288 #   x = special static build when it
   289 #	links to the dynamic C run-time.
   290 #----------------------------------------
   291 SUFX	    = tsgx
   292 
   293 !if $(DEBUG)
   294 BUILDDIRTOP = Debug
   295 DBGX	    = g
   296 !else
   297 BUILDDIRTOP = Release
   298 DBGX	    =
   299 SUFX	    = $(SUFX:g=)
   300 !endif
   301 
   302 !if "$(MACHINE)" != "IX86"
   303 BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
   304 !endif
   305 !if $(VCVER) > 6
   306 BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
   307 !endif
   308 
   309 TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX
   310 
   311 !if !$(STATIC_BUILD)
   312 TMP_DIRFULL = $(TMP_DIRFULL:Static=)
   313 SUFX	    = $(SUFX:s=)
   314 EXT	    = dll
   315 !if $(MSVCRT)
   316 TMP_DIRFULL = $(TMP_DIRFULL:X=)
   317 SUFX	    = $(SUFX:x=)
   318 !endif
   319 !else
   320 TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
   321 EXT	    = lib
   322 !if !$(MSVCRT)
   323 TMP_DIRFULL = $(TMP_DIRFULL:X=)
   324 SUFX	    = $(SUFX:x=)
   325 !endif
   326 !endif
   327 
   328 !if !$(TCL_THREADS)
   329 TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
   330 SUFX	    = $(SUFX:t=)
   331 !endif
   332 
   333 !ifndef TMP_DIR
   334 TMP_DIR	    = $(TMP_DIRFULL)
   335 !ifndef OUT_DIR
   336 OUT_DIR	    = .\$(BUILDDIRTOP)
   337 !endif
   338 !else
   339 !ifndef OUT_DIR
   340 OUT_DIR	    = $(TMP_DIR)
   341 !endif
   342 !endif
   343 
   344 
   345 #----------------------------------------------------------
   346 # Decode the statistics requested.
   347 #----------------------------------------------------------
   348 
   349 !if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"]
   350 TCL_MEM_DEBUG	    = 0
   351 TCL_COMPILE_DEBUG   = 0
   352 !else
   353 !if [nmakehlp -f $(STATS) "memdbg"]
   354 !message *** Doing memdbg
   355 TCL_MEM_DEBUG	    = 1
   356 !else
   357 TCL_MEM_DEBUG	    = 0
   358 !endif
   359 !if [nmakehlp -f $(STATS) "compdbg"]
   360 !message *** Doing compdbg
   361 TCL_COMPILE_DEBUG   = 1
   362 !else
   363 TCL_COMPILE_DEBUG   = 0
   364 !endif
   365 !endif
   366 
   367 #----------------------------------------------------------
   368 # Decode the checks requested.
   369 #----------------------------------------------------------
   370 
   371 !if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
   372 TCL_NO_DEPRECATED	    = 0
   373 FULLWARNINGS		    = 0
   374 !else
   375 !if [nmakehlp -f $(CHECKS) "nodep"]
   376 !message *** Doing nodep check
   377 TCL_NO_DEPRECATED	    = 1
   378 !else
   379 TCL_NO_DEPRECATED	    = 0
   380 !endif
   381 !if [nmakehlp -f $(CHECKS) "fullwarn"]
   382 !message *** Doing full warnings check
   383 FULLWARNINGS		    = 1
   384 !else
   385 FULLWARNINGS		    = 0
   386 !endif
   387 !endif
   388 
   389 
   390 #----------------------------------------------------------
   391 # Set our defines now armed with our options.
   392 #----------------------------------------------------------
   393 
   394 OPTDEFINES	=
   395 !if $(TCL_MEM_DEBUG)
   396 OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
   397 !endif
   398 !if $(TCL_COMPILE_DEBUG)
   399 OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
   400 !endif
   401 !if $(TCL_THREADS)
   402 OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
   403 !if $(USE_THREAD_ALLOC)
   404 OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
   405 !endif
   406 !endif
   407 !if $(STATIC_BUILD)
   408 OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
   409 !endif
   410 
   411 !if $(DEBUG)
   412 OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DEBUG
   413 !elseif $(OPTIMIZING)
   414 OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
   415 !endif
   416 !if $(PROFILE)
   417 OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
   418 !endif
   419 !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
   420 OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
   421 !endif
   422 
   423 
   424 #----------------------------------------------------------
   425 # Get common info used when building extensions.
   426 #----------------------------------------------------------
   427 
   428 !if "$(PROJECT)" != "tcl"
   429 
   430 !if !defined(TCLDIR)
   431 !if exist("$(_INSTALLDIR)\include\tcl.h")
   432 TCLH		= "$(_INSTALLDIR)\include\tcl.h"
   433 TCLINSTALL	= 1
   434 _TCLDIR		= $(_INSTALLDIR)
   435 !else
   436 MSG=^
   437 Failed to find tcl.h.  Set the TCLDIR macro.
   438 !error $(MSG)
   439 !endif
   440 !else
   441 _TCLDIR	= $(TCLDIR:/=\)
   442 !if exist("$(_TCLDIR)\include\tcl.h")
   443 TCLH		= "$(_TCLDIR)\include\tcl.h"
   444 TCLINSTALL	= 1
   445 !elseif exist("$(_TCLDIR)\generic\tcl.h")
   446 TCLH		= "$(_TCLDIR)\generic\tcl.h"
   447 TCLINSTALL	= 0
   448 !else
   449 MSG =^
   450 Failed to find tcl.h.  The TCLDIR macro does not appear correct.
   451 !error $(MSG)
   452 !endif
   453 !endif
   454 
   455 ### TODO: add a command to nmakehlp.c to grep for Tcl's version from tcl.h.
   456 ### Because nmake can't return a string, we'll need to play games with return
   457 ### codes.  It might look something like this:
   458 #!if [nmakehlp -g $(TCL.H)] == 81
   459 #TCL_DOTVERSION	= 8.1
   460 #!elseif [nmakehlp -g $(TCL.H)] == 82
   461 #TCL_DOTVERSION	= 8.2
   462 #...
   463 #!endif
   464 
   465 TCL_DOTVERSION	= 8.4
   466 TCL_VERSION	= $(TCL_DOTVERSION:.=)
   467 
   468 !if $(TCLINSTALL)
   469 TCLSH		= "$(_INSTALLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
   470 TCLSTUBLIB	= "$(_INSTALLDIR)\lib\tclstub$(TCL_VERSION).lib"
   471 TCLIMPLIB	= "$(_INSTALLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
   472 TCL_LIBRARY	= $(_INSTALLDIR)\lib
   473 TCLREGLIB	= "$(_INSTALLDIR)\lib\tclreg11$(SUFX:t=).lib"
   474 TCLDDELIB	= "$(_INSTALLDIR)\lib\tcldde12$(SUFX:t=).lib"
   475 COFFBASE	= \must\have\tcl\sources\to\build\this\target
   476 TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
   477 !else
   478 TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
   479 TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
   480 TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
   481 TCL_LIBRARY	= $(_TCLDIR)\library
   482 TCLREGLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg11$(SUFX:t=).lib"
   483 TCLDDELIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde12$(SUFX:t=).lib"
   484 COFFBASE	= "$(_TCLDIR)\win\coffbase.txt"
   485 TCLTOOLSDIR	= $(_TCLDIR)\tools
   486 !endif
   487 
   488 !endif
   489 
   490 
   491 #----------------------------------------------------------
   492 # Display stats being used.
   493 #----------------------------------------------------------
   494 
   495 !message *** Intermediate directory will be '$(TMP_DIR)'
   496 !message *** Output directory will be '$(OUT_DIR)'
   497 !message *** Suffix for binaries will be '$(SUFX)'
   498 !message *** Optional defines are '$(OPTDEFINES)'
   499 !message *** Compiler version $(VCVER)
   500 !message *** Compiler options '$(OPTIMIZATIONS) $(DEBUGFLAGS)'
   501 !message *** Link options '$(LINKERFLAGS)'
   502 
   503 !endif
   504