Tcl Extension Architecture (TEA) Sample Extension

Check-in [4ec49d5620]
Login
Bounty program for improvements to Tcl and certain Tcl packages.
Tcl 2019 Conference, Houston/TX, US, Nov 4-8
Send your abstracts to [email protected]
or submit via the online form by Sep 9.

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Sync with latest Tcl 8.6 updates
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 4ec49d5620437d01e5de70231ee362116903804d
User & Date: jan 2012-07-31 23:19:31
Context
2012-08-01
19:48
Tidy: Whitespace, formatting, spelling. No functional change. check-in: 3a392bec00 user: stwo tags: trunk
2012-07-31
23:19
Sync with latest Tcl 8.6 updates check-in: 4ec49d5620 user: jan tags: trunk
2012-07-27
20:38
merge check-in: 95c2476b13 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to ChangeLog.

            1  +2012-08-01  Jan Nijtmans <[email protected]>
            2  +
            3  +	* win/makefile.vc: Sync with latest Tcl 8.6 updates
            4  +	* win/rules.vc:
            5  +	* win/pkg.vc:
            6  +
     1      7   2012-02-27  Jan Nijtmans <[email protected]>
     2      8   
     3      9   	* configure:	Regenerated to use latest TEA tcl.m4.
     4     10   	* <all>:        Purge RCS keywords.
     5     11   
     6     12   2010-12-15  Stuart Cassoff  <[email protected]>
     7     13   

Changes to win/makefile.vc.

     1         -# makefile.vc --                                               -*- Makefile -*-
            1  +#------------------------------------------------------------- -*- makefile -*-
            2  +# makefile.vc --
     2      3   #
     3         -# Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
            4  +#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
     4      5   #
     5         -# This makefile is based upon the Tcl 8.4 Makefile.vc and modified to 
            6  +# This makefile is based upon the Tcl 8.6 Makefile.vc and modified to 
     6      7   # make it suitable as a general package makefile. Look for the word EDIT
     7      8   # which marks sections that may need modification. As a minumum you will
     8      9   # need to change the PROJECT, DOTVERSION and DLLOBJS variables to values
     9     10   # relevant to your package.
    10     11   #
    11     12   # See the file "license.terms" for information on usage and redistribution
    12     13   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    13         -# 
           14  +#
    14     15   # Copyright (c) 1995-1996 Sun Microsystems, Inc.
    15     16   # Copyright (c) 1998-2000 Ajuba Solutions.
    16         -# Copyright (c) 2001 ActiveState Corporation.
    17         -# Copyright (c) 2001-2002 David Gravereaux.
    18         -# Copyright (c) 2003-2006 Pat Thoyts
    19         -#
    20         -#-------------------------------------------------------------------------
           17  +# Copyright (c) 2001-2005 ActiveState Corporation.
           18  +# Copyright (c) 2001-2004 David Gravereaux.
           19  +# Copyright (c) 2003-2008 Pat Thoyts.
           20  +#------------------------------------------------------------------------------
    21     21   
    22         -# Check to see we are configured to build with MSVC (MSDEVDIR or MSVCDIR)
    23         -# or with the MS Platform SDK (MSSDK). Visual Studio .NET 2003 and 2005 define
    24         -# VCINSTALLDIR instead. The MSVC Toolkit release defines yet another.
    25         -!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(MSSDK) && !defined(VCINSTALLDIR) && !defined(VCToolkitInstallDir)
           22  +# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
           23  +# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
           24  +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
    26     25   MSG = ^
    27     26   You need to run vcvars32.bat from Developer Studio or setenv.bat from the^
    28     27   Platform SDK first to setup the environment.  Jump to this line to read^
    29     28   the build instructions.
    30     29   !error $(MSG)
    31     30   !endif
    32     31   
    33     32   #------------------------------------------------------------------------------
    34     33   # HOW TO USE this makefile:
    35     34   #
    36         -# 1)  It is now necessary to have %MSVCDir% set in the environment.  This is
    37         -#     used  as a check to see if vcvars32.bat had been run prior to running
    38         -#     nmake or during the installation of Microsoft Visual C++, MSVCDir had
    39         -#     been set globally and the PATH adjusted.  Either way is valid.
           35  +# 1)  It is now necessary to have MSVCDir, MSDevDir or MSSDK set in the
           36  +#     environment.  This is used as a check to see if vcvars32.bat had been
           37  +#     run prior to running nmake or during the installation of Microsoft
           38  +#     Visual C++, MSVCDir had been set globally and the PATH adjusted.
           39  +#     Either way is valid.
    40     40   #
    41     41   #     You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
    42         -#     directory to setup the proper environment, if needed, for your current
    43         -#     setup.  This is a needed bootstrap requirement and allows the swapping of
    44         -#     different environments to be easier.
           42  +#     directory to setup the proper environment, if needed, for your
           43  +#     current setup.  This is a needed bootstrap requirement and allows the
           44  +#     swapping of different environments to be easier.
    45     45   #
    46     46   # 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
    47         -#     vcvars32.bat according to the instructions for it.  This can also turn on
    48         -#     the 64-bit compiler, if your SDK has it.
           47  +#     vcvars32.bat according to the instructions for it.  This can also
           48  +#     turn on the 64-bit compiler, if your SDK has it.
    49     49   #
    50     50   # 3)  Targets are:
    51     51   #	all       -- Builds everything.
    52         -#       <project> -- Builds the project (eg: nmake sample)
           52  +#	<project> -- Builds the project (eg: nmake sample)
    53     53   #	test      -- Builds and runs the test suite.
    54     54   #	install   -- Installs the built binaries and libraries to $(INSTALLDIR)
    55     55   #		     in an appropriate subdirectory.
    56     56   #	clean/realclean/distclean -- varying levels of cleaning.
    57     57   #
    58     58   # 4)  Macros usable on the commandline:
    59     59   #	INSTALLDIR=<path>
    60     60   #		Sets where to install Tcl from the built binaries.
    61     61   #		C:\Progra~1\Tcl is assumed when not specified.
    62     62   #
    63         -#	OPTS=static,msvcrt,staticpkg,threads,symbols,profile,loimpact,none
           63  +#	OPTS=loimpact,msvcrt,nothreads,pdbs,profile,static,symbols,unchecked,none
    64     64   #		Sets special options for the core.  The default is for none.
    65     65   #		Any combination of the above may be used (comma separated).
    66     66   #		'none' will over-ride everything to nothing.
    67     67   #
    68         -#		static  =  Builds a static library of the core instead of a
    69         -#			   dll.  The shell will be static (and large), as well.
    70         -#		msvcrt  =  Effects the static option only to switch it from
           68  +#		loimpact = Adds a flag for how NT treats the heap to keep memory
           69  +#			   in use, low.  This is said to impact alloc performance.
           70  +#		msvcrt  =  Affects the static option only to switch it from
    71     71   #			   using libcmt(d) as the C runtime [by default] to
    72     72   #			   msvcrt(d). This is useful for static embedding
    73     73   #			   support.
    74         -#		staticpkg = Effects the static option only to switch
    75         -#			   tclshXX.exe to have the dde and reg extension linked
    76         -#			   inside it.
    77     74   #		nothreads = Turns off multithreading support (not recommended)
    78         -#		thrdalloc = Use the thread allocator (shared global free pool).
    79         -#		symbols =  Adds symbols for step debugging.
    80         -#		profile =  Adds profiling hooks.  Map file is assumed.
    81         -#		loimpact =  Adds a flag for how NT treats the heap to keep memory
    82         -#			   in use, low.  This is said to impact alloc performance.
           75  +#		static  =  Builds a static library of the core instead of a
           76  +#			   dll.  The shell will be static (and large), as well.
           77  +#		pdbs     = Build detached symbols for release builds.
           78  +#		profile  = Adds profiling hooks.  Map file is assumed.
           79  +#		symbols  = Debug build. Links to the debug C runtime, disables
           80  +#			   optimizations and creates pdb symbols files.
           81  +#		unchecked = Allows a symbols build to not use the debug
           82  +#			   enabled runtime (msvcrt.dll not msvcrtd.dll
           83  +#			   or libcmt.lib not libcmtd.lib).
    83     84   #
    84     85   #	STATS=memdbg,compdbg,none
    85     86   #		Sets optional memory and bytecode compiler debugging code added
    86     87   #		to the core.  The default is for none.  Any combination of the
    87     88   #		above may be used (comma separated).  'none' will over-ride
    88     89   #		everything to nothing.
    89     90   #
    90     91   #		memdbg   = Enables the debugging memory allocator.
    91     92   #		compdbg  = Enables byte compilation logging.
    92     93   #
    93         -#	MACHINE=(IX86|IA64|ALPHA|AMD64)
           94  +#	CHECKS=64bit,fullwarn,nodep,none
           95  +#		Sets special macros for checking compatability.
           96  +#
           97  +#		64bit    = Enable 64bit portability warnings (if available)
           98  +#		fullwarn = Builds with full compiler and link warnings enabled.
           99  +#			    Very verbose.
          100  +#		nodep	 = Turns off compatability macros to ensure Tk isn't
          101  +#			    being built with deprecated functions.
          102  +#
          103  +#	MACHINE=(ALPHA|AMD64|IA64|IX86)
    94    104   #		Set the machine type used for the compiler, linker, and
    95    105   #		resource compiler.  This hook is needed to tell the tools
    96    106   #		when alternate platforms are requested.  IX86 is the default
    97    107   #		when not specified. If the CPU environment variable has been
    98    108   #		set (ie: recent Platform SDK) then MACHINE is set from CPU.
    99    109   #
   100    110   #	TMP_DIR=<path>
   101    111   #	OUT_DIR=<path>
   102    112   #		Hooks to allow the intermediate and output directories to be
   103         -#		changed.  $(OUT_DIR) is assumed to be 
          113  +#		changed.  $(OUT_DIR) is assumed to be
   104    114   #		$(BINROOT)\(Release|Debug) based on if symbols are requested.
   105    115   #		$(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
   106    116   #
   107    117   #	TESTPAT=<file>
   108    118   #		Reads the tests requested to be run from this file.
   109    119   #
   110         -#	CFG_ENCODING=encoding
   111         -#		name of encoding for configuration information. Defaults
   112         -#		to cp1252
   113         -#
   114    120   # 5)  Examples:
   115    121   #
   116    122   #	Basic syntax of calling nmake looks like this:
   117    123   #	nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
   118    124   #
   119    125   #                        Standard (no frills)
   120    126   #       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
................................................................................
   127    133   #       Setting environment for using Microsoft Visual C++ tools.
   128    134   #       c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
   129    135   #       Targeting Windows pre64 RETAIL
   130    136   #       c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64
   131    137   #
   132    138   #------------------------------------------------------------------------------
   133    139   #==============================================================================
   134         -###############################################################################
   135    140   #------------------------------------------------------------------------------
   136    141   
   137    142   !if !exist("makefile.vc")
   138    143   MSG = ^
   139    144   You must run this makefile only from the directory it is in.^
   140    145   Please `cd` to its location first.
   141    146   !error $(MSG)
................................................................................
   158    163   
   159    164   PROJECT = sample
   160    165   
   161    166   # Uncomment the following line if this is a Tk extension.
   162    167   #PROJECT_REQUIRES_TK=1
   163    168   !include "rules.vc"
   164    169   
   165         -DOTVERSION      = 0.5
   166         -VERSION         = $(DOTVERSION:.=)
          170  +!include "pkg.vc"
          171  +
          172  +DOTVERSION      = $(PACKAGE_VERSION:"=) #"
          173  +VERSION         = $(PACKAGE_MAJOR)$(PACKAGE_MINOR)
   167    174   STUBPREFIX      = $(PROJECT)stub
   168    175   
   169    176   DLLOBJS = \
   170    177   	$(TMP_DIR)\tclsample.obj \
   171    178   	$(TMP_DIR)\sample.obj \
   172    179   !if !$(STATIC_BUILD)
   173    180   	$(TMP_DIR)\sample.res
   174    181   !endif
          182  +
          183  +PRJHEADERS = 
   175    184   
   176    185   #-------------------------------------------------------------------------
   177    186   # Target names and paths ( shouldn't need changing )
   178    187   #-------------------------------------------------------------------------
   179    188   
   180    189   BINROOT		= .
   181    190   ROOT            = ..
................................................................................
   210    219   !if !$(DEBUG)
   211    220   !if $(OPTIMIZING)
   212    221   ### This cranks the optimization level to maximize speed
   213    222   cdebug	= $(OPTIMIZATIONS)
   214    223   !else
   215    224   cdebug	=
   216    225   !endif
   217         -!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
          226  +!else if "$(MACHINE)" == "IA64"
   218    227   ### Warnings are too many, can't support warnings into errors.
   219    228   cdebug	= -Zi -Od $(DEBUGFLAGS)
   220    229   !else
   221    230   cdebug	= -Zi -WX $(DEBUGFLAGS)
   222    231   !endif
   223    232   
   224    233   ### Declarations common to all compiler options
................................................................................
   235    244   !if $(DEBUG) && !$(UNCHECKED)
   236    245   crt = -MTd
   237    246   !else
   238    247   crt = -MT
   239    248   !endif
   240    249   !endif
   241    250   
          251  +cflags = $(cflags) -DMODULE_SCOPE=extern
          252  +
   242    253   !if !$(STATIC_BUILD)
   243    254   cflags = $(cflags) -DUSE_TCL_STUBS
   244    255   !if defined(TKSTUBLIB)
   245    256   cflags = $(cflags) -DUSE_TK_STUBS
   246    257   !endif
   247    258   !endif
   248    259   
................................................................................
   255    266   		  $(BASE_CFLAGS) $(OPTDEFINES)
   256    267   
   257    268   #---------------------------------------------------------------------
   258    269   # Link flags
   259    270   #---------------------------------------------------------------------
   260    271   
   261    272   !if $(DEBUG)
   262         -ldebug	= -debug:full -debugtype:cv
          273  +ldebug	= -debug -debugtype:cv
   263    274   !if $(MSVCRT)
   264    275   ldebug = $(ldebug) -nodefaultlib:msvcrt
   265    276   !endif
   266    277   !else
   267    278   ldebug	= -release -opt:ref -opt:icf,3
   268    279   !endif
   269    280   
................................................................................
   295    306   baselibs  = $(baselibs) $(TKSTUBLIB)
   296    307   !endif
   297    308   !endif
   298    309   
   299    310   # Avoid 'unresolved external symbol __security_cookie' errors.
   300    311   # c.f. http://support.microsoft.com/?id=894573
   301    312   !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
   302         -!if $(VCVERSION) >= 1400 && $(VCVERSION) < 1500
          313  +!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
   303    314   baselibs   = $(baselibs) bufferoverflowU.lib
   304    315   !endif
   305    316   !endif
   306    317   
   307    318   baselibs   = $(baselibs) user32.lib gdi32.lib
   308    319   
   309    320   #---------------------------------------------------------------------
   310    321   # TclTest flags
   311    322   #---------------------------------------------------------------------
   312    323   
   313         -!IF "$(TESTPAT)" != ""
          324  +!if "$(TESTPAT)" != ""
   314    325   TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
   315         -!ENDIF
          326  +!endif
   316    327   
   317    328   #---------------------------------------------------------------------
   318    329   # Project specific targets (EDIT)
   319    330   #---------------------------------------------------------------------
   320    331   
   321    332   all:	    setup $(PROJECT)
   322    333   $(PROJECT): setup pkgIndex $(PRJLIB)
................................................................................
   357    368   # See <tcl>/win/coffbase.txt for extension base addresses.
   358    369   $(PRJLIB): $(DLLOBJS)
   359    370   !if $(STATIC_BUILD)
   360    371   	$(lib32) -nologo -out:[email protected] @<<
   361    372   $**
   362    373   <<
   363    374   !else
   364         -	$(link32) $(dlllflags) -base:0x10000000 -out:[email protected] $(baselibs) @<<
          375  +	$(link32) $(dlllflags) -base:@$(COFFBASE),thread -out:[email protected] $(baselibs) @<<
   365    376   $**
   366    377   <<
   367    378   	$(_VC_MANIFEST_EMBED_DLL)
   368    379   	[email protected] $*.exp
   369    380   !endif
   370    381   
   371    382   $(PRJSTUBLIB): $(PRJSTUBOBJS)
................................................................................
   388    399   {$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
   389    400       $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   390    401   $<
   391    402   <<
   392    403   
   393    404   {$(WINDIR)}.rc{$(TMP_DIR)}.res:
   394    405   	$(rc32) -fo [email protected] -r -i "$(GENERICDIR)" -D__WIN32__ \
   395         -		-DCOMMAVERSION=$(DOTVERSION:.=,),0,0 \
          406  +		-DCOMMAVERSION=$(DOTVERSION:.=,),0 \
   396    407   		-DDOTVERSION=\"$(DOTVERSION)\" \
   397    408   		-DVERSION=\"$(VERSION)$(SUFX)\" \
   398    409   !if $(DEBUG)
   399    410   	-d DEBUG \
   400    411   !endif
   401    412   !if $(TCL_THREADS)
   402    413   	-d TCL_THREADS \

Added win/pkg.vc.

            1  +# remember to change configure.in as well when these change
            2  +# (then re-autoconf)
            3  +
            4  +PACKAGE_MAJOR	= 0
            5  +PACKAGE_MINOR	= 5
            6  +PACKAGE_VERSION	= "0.5"

Changes to win/rules.vc.

     1         -#------------------------------------------------------------- -*- Makefile -*-
            1  +#------------------------------------------------------------------------------
     2      2   # rules.vc --
     3      3   #
     4      4   #	Microsoft Visual C++ makefile include for decoding the commandline
     5      5   #	macros.  This file does not need editing to build Tcl.
     6      6   #
     7      7   #	This version is modified from the Tcl source version to support
     8      8   #	building extensions using nmake.
     9      9   #
    10     10   # See the file "license.terms" for information on usage and redistribution
    11     11   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    12         -# 
    13         -# Copyright (c) 2001-2002 David Gravereaux.
    14         -# Copyright (c) 2003-2008 Patrick Thoyts
    15     12   #
           13  +# Copyright (c) 2001-2003 David Gravereaux.
           14  +# Copyright (c) 2003-2008 Patrick Thoyts
    16     15   #------------------------------------------------------------------------------
    17     16   
    18     17   !ifndef _RULES_VC
    19     18   _RULES_VC = 1
    20     19   
    21     20   cc32		= $(CC)   # built-in default.
    22     21   link32		= link
................................................................................
    27     26   ### Assume the normal default.
    28     27   _INSTALLDIR	= C:\Program Files\Tcl
    29     28   !else
    30     29   ### Fix the path separators.
    31     30   _INSTALLDIR	= $(INSTALLDIR:/=\)
    32     31   !endif
    33     32   
    34         -!ifndef MACHINE
    35         -!if "$(CPU)" == "" || "$(CPU)" == "i386"
    36         -MACHINE         = IX86
    37         -!else
    38         -MACHINE         = $(CPU)
    39         -!endif
    40         -!endif
    41         -
    42         -!ifndef CFG_ENCODING
    43         -CFG_ENCODING	= \"cp1252\"
    44         -!endif
    45         -
    46     33   #----------------------------------------------------------
    47     34   # Set the proper copy method to avoid overwrite questions
    48     35   # to the user when copying files and selecting the right
    49     36   # "delete all" method.
    50     37   #----------------------------------------------------------
    51     38   
    52     39   !if "$(OS)" == "Windows_NT"
................................................................................
    63     50   CPY	= xcopy /i >_JUNK.OUT # On Win98 NUL does not work here.
    64     51   COPY	= copy >_JUNK.OUT # On Win98 NUL does not work here.
    65     52   RMDIR	= deltree /Y
    66     53   NULL    = \NUL # Used in testing directory existence
    67     54   ERRNULL = >NUL # Win9x shell cannot redirect stderr
    68     55   !endif
    69     56   MKDIR   = mkdir
           57  +
           58  +#------------------------------------------------------------------------------
           59  +# Determine the host and target architectures and compiler version.
           60  +#------------------------------------------------------------------------------
           61  +
           62  +_HASH=^#
           63  +_VC_MANIFEST_EMBED_EXE=
           64  +_VC_MANIFEST_EMBED_DLL=
           65  +VCVER=0
           66  +!if ![echo VCVERSION=_MSC_VER > vercl.x] \
           67  +    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
           68  +    && ![echo ARCH=IX86 >> vercl.x] \
           69  +    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
           70  +    && ![echo ARCH=AMD64 >> vercl.x] \
           71  +    && ![echo $(_HASH)endif >> vercl.x] \
           72  +    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
           73  +!include vercl.i
           74  +!if ![echo VCVER= ^\> vercl.vc] \
           75  +    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
           76  +!include vercl.vc
           77  +!endif
           78  +!endif
           79  +!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
           80  +!endif
           81  +
           82  +!if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
           83  +NATIVE_ARCH=IX86
           84  +!else
           85  +NATIVE_ARCH=AMD64
           86  +!endif
           87  +
           88  +# Since MSVC8 we must deal with manifest resources.
           89  +!if $(VCVERSION) >= 1400
           90  +_VC_MANIFEST_EMBED_EXE=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:[email protected];1
           91  +_VC_MANIFEST_EMBED_DLL=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:[email protected];2
           92  +!endif
           93  +
           94  +!ifndef MACHINE
           95  +MACHINE=$(ARCH)
           96  +!endif
           97  +
           98  +!ifndef CFG_ENCODING
           99  +CFG_ENCODING	= \"cp1252\"
          100  +!endif
    70    101   
    71    102   !message ===============================================================================
    72    103   
    73    104   #----------------------------------------------------------
    74    105   # build the helper app we need to overcome nmake's limiting
    75    106   # environment.
    76    107   #----------------------------------------------------------
................................................................................
    89    120   !message *** Compiler has 'Optimizations'
    90    121   OPTIMIZING	= 1
    91    122   !else
    92    123   !message *** Compiler does not have 'Optimizations'
    93    124   OPTIMIZING	= 0
    94    125   !endif
    95    126   
    96         -OPTIMIZATIONS  =
          127  +OPTIMIZATIONS   =
    97    128   
    98    129   !if [nmakehlp -c -Ot]
    99    130   OPTIMIZATIONS  = $(OPTIMIZATIONS) -Ot
   100    131   !endif
   101    132   
   102    133   !if [nmakehlp -c -Oi]
   103    134   OPTIMIZATIONS  = $(OPTIMIZATIONS) -Oi
................................................................................
   140    171   !endif
   141    172   !endif
   142    173   
   143    174   !if "$(MACHINE)" == "IX86"
   144    175   ### test for pentium errata
   145    176   !if [nmakehlp -c -QI0f]
   146    177   !message *** Compiler has 'Pentium 0x0f fix'
   147         -COMPILERFLAGS  = $(COMPILERFLAGSS) -QI0f
          178  +COMPILERFLAGS  = $(COMPILERFLAGS) -QI0f
   148    179   !else
   149    180   !message *** Compiler does not have 'Pentium 0x0f fix'
   150    181   !endif
   151    182   !endif
   152    183   
   153    184   !if "$(MACHINE)" == "IA64"
   154    185   ### test for Itanium errata
................................................................................
   175    206   
   176    207   LINKERFLAGS     =
   177    208   
   178    209   !if [nmakehlp -l -ltcg]
   179    210   LINKERFLAGS     =-ltcg
   180    211   !endif
   181    212   
   182         -#----------------------------------------------------------
   183         -# MSVC8 (ships with Visual Studio 2005) generates a manifest
   184         -# file that we should link into the binaries. This is how.
   185         -#----------------------------------------------------------
   186         -
   187         -_VC_MANIFEST_EMBED_EXE=
   188         -_VC_MANIFEST_EMBED_DLL=
   189         -VCVER=0
   190         -!if ![echo VCVERSION=_MSC_VER > vercl.x] \
   191         -    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
   192         -!include vercl.i
   193         -!if $(VCVERSION) >= 1500
   194         -VCVER=9
   195         -!elseif $(VCVERSION) >= 1400
   196         -VCVER=8
   197         -!elseif $(VCVERSION) >= 1300
   198         -VCVER=7
   199         -!elseif $(VCVERSION) >= 1200
   200         -VCVER=6
   201         -!endif
   202         -!endif
   203         -
   204         -# Since MSVC8 we must deal with manifest resources.
   205         -!if $(VCVERSION) >= 1400
   206         -_VC_MANIFEST_EMBED_EXE=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:[email protected];1
   207         -_VC_MANIFEST_EMBED_DLL=if exist [email protected] mt -nologo -manifest [email protected] -outputresource:[email protected];2
   208         -!endif
   209         -
   210    213   #----------------------------------------------------------
   211    214   # Decode the options requested.
   212    215   #----------------------------------------------------------
   213    216   
   214    217   !if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
   215    218   STATIC_BUILD	= 0
   216    219   TCL_THREADS	= 1
   217    220   DEBUG		= 0
          221  +SYMBOLS		= 0
   218    222   PROFILE		= 0
          223  +PGO		= 0
   219    224   MSVCRT		= 0
   220    225   LOIMPACT	= 0
   221         -TCL_USE_STATIC_PACKAGES	= 0
   222         -USE_THREAD_ALLOC = 1
   223         -USE_THREAD_STORAGE = 1
   224    226   UNCHECKED       = 0
   225    227   !else
   226    228   !if [nmakehlp -f $(OPTS) "static"]
   227    229   !message *** Doing static
   228    230   STATIC_BUILD	= 1
   229    231   !else
   230    232   STATIC_BUILD	= 0
................................................................................
   231    233   !endif
   232    234   !if [nmakehlp -f $(OPTS) "msvcrt"]
   233    235   !message *** Doing msvcrt
   234    236   MSVCRT		= 1
   235    237   !else
   236    238   MSVCRT		= 0
   237    239   !endif
   238         -!if [nmakehlp -f $(OPTS) "staticpkg"]
   239         -!message *** Doing staticpkg
   240         -TCL_USE_STATIC_PACKAGES	= 1
   241         -!else
   242         -TCL_USE_STATIC_PACKAGES	= 0
   243         -!endif
   244    240   !if [nmakehlp -f $(OPTS) "nothreads"]
   245    241   !message *** Compile explicitly for non-threaded tcl
   246    242   TCL_THREADS	= 0
   247    243   !else
   248    244   TCL_THREADS     = 1
   249    245   !endif
   250    246   !if [nmakehlp -f $(OPTS) "symbols"]
   251    247   !message *** Doing symbols
   252    248   DEBUG		= 1
   253    249   !else
   254    250   DEBUG		= 0
          251  +!endif
          252  +!if [nmakehlp -f $(OPTS) "pdbs"]
          253  +!message *** Doing pdbs
          254  +SYMBOLS		= 1
          255  +!else
          256  +SYMBOLS		= 0
   255    257   !endif
   256    258   !if [nmakehlp -f $(OPTS) "profile"]
   257    259   !message *** Doing profile
   258    260   PROFILE		= 1
   259    261   !else
   260    262   PROFILE		= 0
          263  +!endif
          264  +!if [nmakehlp -f $(OPTS) "pgi"]
          265  +!message *** Doing profile guided optimization instrumentation
          266  +PGO		= 1
          267  +!elseif [nmakehlp -f $(OPTS) "pgo"]
          268  +!message *** Doing profile guided optimization
          269  +PGO		= 2
          270  +!else
          271  +PGO		= 0
   261    272   !endif
   262    273   !if [nmakehlp -f $(OPTS) "loimpact"]
   263    274   !message *** Doing loimpact
   264    275   LOIMPACT	= 1
   265    276   !else
   266    277   LOIMPACT	= 0
   267    278   !endif
   268         -!if [nmakehlp -f $(OPTS) "thrdalloc"]
   269         -!message *** Doing thrdalloc
   270         -USE_THREAD_ALLOC = 1
   271         -!else
   272         -USE_THREAD_ALLOC = 0
   273         -!endif
   274         -!if [nmakehlp -f $(OPTS) "thrdstorage"]
   275         -!message *** Doing thrdstorage
   276         -USE_THREAD_STORAGE = 1
   277         -!else
   278         -USE_THREAD_STORAGE = 0
   279         -!endif
   280    279   !if [nmakehlp -f $(OPTS) "unchecked"]
   281    280   !message *** Doing unchecked
   282    281   UNCHECKED = 1
   283    282   !else
   284    283   UNCHECKED = 0
   285    284   !endif
   286    285   !endif
................................................................................
   412    411   WARNINGS		    = -W3
   413    412   !endif
   414    413   !if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
   415    414   !message *** Doing 64bit portability warnings
   416    415   WARNINGS		    = $(WARNINGS) -Wp64
   417    416   !endif
   418    417   !endif
          418  +
          419  +!if $(PGO) > 1
          420  +!if [nmakehlp -l -ltcg:pgoptimize]
          421  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
          422  +!else
          423  +MSG=^
          424  +This compiler does not support profile guided optimization.
          425  +!error $(MSG)
          426  +!endif
          427  +!elseif $(PGO) > 0
          428  +!if [nmakehlp -l -ltcg:pginstrument]
          429  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
          430  +!else
          431  +MSG=^
          432  +This compiler does not support profile guided optimization.
          433  +!error $(MSG)
          434  +!endif
          435  +!endif
   419    436   
   420    437   #----------------------------------------------------------
   421    438   # Set our defines now armed with our options.
   422    439   #----------------------------------------------------------
   423    440   
   424    441   OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
   425    442   
................................................................................
   427    444   OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
   428    445   !endif
   429    446   !if $(TCL_COMPILE_DEBUG)
   430    447   OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
   431    448   !endif
   432    449   !if $(TCL_THREADS)
   433    450   OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
   434         -!if $(USE_THREAD_ALLOC)
   435         -OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
   436         -!endif
   437         -!if $(USE_THREAD_STORAGE)
   438         -OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_STORAGE=1
   439         -!endif
   440    451   !endif
   441    452   !if $(STATIC_BUILD)
   442    453   OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
   443    454   !endif
   444    455   !if $(TCL_NO_DEPRECATED)
   445    456   OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
   446    457   !endif
   447    458   
   448         -!if $(DEBUG)
   449         -OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DEBUG
   450         -!elseif $(OPTIMIZING)
          459  +!if !$(DEBUG)
          460  +OPTDEFINES	= $(OPTDEFINES) -DNDEBUG
          461  +!if $(OPTIMIZING)
   451    462   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
          463  +!endif
   452    464   !endif
   453    465   !if $(PROFILE)
   454    466   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
   455    467   !endif
   456    468   !if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
   457    469   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
   458    470   !endif
................................................................................
   509    521   TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
   510    522   !if !exist($(TCLSH)) && $(TCL_THREADS)
   511    523   TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe"
   512    524   !endif
   513    525   TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
   514    526   TCLIMPLIB	= "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
   515    527   TCL_LIBRARY	= $(_TCLDIR)\lib
          528  +COFFBASE	= \must\have\tcl\sources\to\build\this\target
          529  +TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
   516    530   TCL_INCLUDES    = -I"$(_TCLDIR)\include"
   517    531   !else
   518    532   TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
   519    533   !if !exist($(TCLSH)) && $(TCL_THREADS)
   520    534   TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe"
   521    535   !endif
   522    536   TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
   523    537   TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
   524    538   TCL_LIBRARY	= $(_TCLDIR)\library
          539  +COFFBASE	= "$(_TCLDIR)\win\coffbase.txt"
          540  +TCLTOOLSDIR	= $(_TCLDIR)\tools
   525    541   TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
   526    542   !endif
   527    543   
   528    544   !endif
   529    545   
   530    546   #----------------------------------------------------------
   531    547   # Optionally check for Tk info for building extensions.
................................................................................
   610    626   #----------------------------------------------------------
   611    627   
   612    628   !message *** Intermediate directory will be '$(TMP_DIR)'
   613    629   !message *** Output directory will be '$(OUT_DIR)'
   614    630   !message *** Suffix for binaries will be '$(SUFX)'
   615    631   !message *** Optional defines are '$(OPTDEFINES)'
   616    632   !message *** Compiler version $(VCVER). Target machine is $(MACHINE)
          633  +!message *** Host architecture is $(NATIVE_ARCH)
   617    634   !message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
   618    635   !message *** Link options '$(LINKERFLAGS)'
   619    636   
   620    637   !endif