Tcl UDP

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

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

Overview
Comment:First cut at building with new rules.vc
Timelines: family | ancestors | descendants | both | vc-reform
Files: files | file ages | folders
SHA1:4442f2b1bbb3a01530a2e83e6ea050acfcf3bbd6
User & Date: apnadkarni 2017-09-30 13:37:27
Context
2017-10-08
16:05
Get rid of tcludp.rc and use the default rc template instead check-in: b43da5b57b user: apnadkarni tags: vc-reform
2017-09-30
13:37
First cut at building with new rules.vc check-in: 4442f2b1bb user: apnadkarni tags: vc-reform
03:47
Create new branch named "vc-reform" check-in: 63d7979801 user: apnadkarni tags: vc-reform
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to win/makefile.vc.

   171    171   PRJDOCS = \
   172    172   	$(OUT_DIR)\udp.html
   173    173   
   174    174   #-------------------------------------------------------------------------
   175    175   # Target names and paths ( shouldn't need changing )
   176    176   #-------------------------------------------------------------------------
   177    177   
   178         -BINROOT		= .
   179         -ROOT            = ..
   180         -
   181         -PRJIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
   182    178   PRJLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
   183    179   PRJLIB		= $(OUT_DIR)\$(PRJLIBNAME)
   184    180   
   185         -PRJSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
   186         -PRJSTUBLIB	= $(OUT_DIR)\$(PRJSTUBLIBNAME)
   187         -
   188         -### Make sure we use backslash only.
   189         -PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
   190         -LIB_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   191         -BIN_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   192         -DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   193         -SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)
   194         -DEMO_INSTALL_DIR	= $(PRJ_INSTALL_DIR)\demos
   195         -INCLUDE_INSTALL_DIR	= $(_TCLDIR)\include
   196         -
   197         -### The following paths CANNOT have spaces in them.
   198         -GENERICDIR	= $(ROOT)\generic
   199         -WINDIR		= $(ROOT)\win
   200         -LIBDIR          = $(ROOT)\library
   201         -DOCDIR		= $(ROOT)\doc
   202         -DEMODIR		= $(ROOT)\demos
   203         -TOOLSDIR	= $(ROOT)\tools
   204         -COMPATDIR	= $(ROOT)\compat
   205         -EXPATDIR        = $(ROOT)\expat
   206         -
   207         -
   208         -#---------------------------------------------------------------------
   209         -# Compile flags
   210         -#---------------------------------------------------------------------
   211         -
   212         -!if !$(DEBUG)
   213         -!if $(OPTIMIZING)
   214         -### This cranks the optimization level to maximize speed
   215         -cdebug	= $(OPTIMIZATIONS)
   216         -!else
   217         -cdebug	=
   218         -!endif
   219         -!else if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
   220         -### Warnings are too many, can't support warnings into errors.
   221         -cdebug	= -Zi -Od $(DEBUGFLAGS)
   222         -!else
   223         -cdebug	= -Zi -WX $(DEBUGFLAGS)
   224         -!endif
   225         -
   226         -### Declarations common to all compiler options
   227         -cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE -D _WINSOCK_DEPRECATED_NO_WARNINGS
   228         -cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\
   229         -
   230         -!if $(MSVCRT)
   231         -!if $(DEBUG) && !$(UNCHECKED)
   232         -crt = -MDd
   233         -!else
   234         -crt = -MD
   235         -!endif
   236         -!else
   237         -!if $(DEBUG) && !$(UNCHECKED)
   238         -crt = -MTd
   239         -!else
   240         -crt = -MT
   241         -!endif
   242         -!endif
   243         -
   244         -!if !$(STATIC_BUILD)
   245         -cflags = $(cflags) -DUSE_TCL_STUBS
   246         -!if defined(TKSTUBLIB)
   247         -cflags = $(cflags) -DUSE_TK_STUBS
   248         -!endif
   249         -!endif
   250         -
   251         -DEFS            =-DHAVE_MEMMOVE=1 
   252         -DEFS_EXPAT	=-DXMLIMPORT=__declspec(dllexport)
   253         -INCLUDES	= -I"$(WINDIR)" -I"$(GENERICDIR)" -I"$(EXPATDIR)" $(TCL_INCLUDES)
   254         -BASE_CFLAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
   255         -CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE
   256         -TCL_CFLAGS      = -DPACKAGE_NAME="\"$(PROJECT)\"" \
          181  +PRJ_DEFINES     = -DPACKAGE_NAME="\"$(PROJECT)\"" \
   257    182   		  -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
   258         -		  $(BASE_CFLAGS) $(OPTDEFINES) $(DEFS)
   259         -
   260         -#---------------------------------------------------------------------
   261         -# Link flags
   262         -#---------------------------------------------------------------------
   263         -
   264         -!if $(DEBUG)
   265         -ldebug	= -debug:full -debugtype:cv
   266         -!if $(MSVCRT)
   267         -ldebug = $(ldebug) -nodefaultlib:msvcrt
   268         -!endif
   269         -!else
   270         -ldebug	= -release -opt:ref -opt:icf,3
   271         -!endif
   272         -
   273         -### Declarations common to all linker options
   274         -lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
   275         -
   276         -!if $(PROFILE)
   277         -lflags	= $(lflags) -profile
   278         -!endif
   279         -
   280         -!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
   281         -### Align sections for PE size savings.
   282         -lflags	= $(lflags) -opt:nowin98
   283         -!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
   284         -### Align sections for speed in loading by choosing the virtual page size.
   285         -lflags	= $(lflags) -align:4096
   286         -!endif
   287         -
   288         -!if $(LOIMPACT)
   289         -lflags	= $(lflags) -ws:aggressive
   290         -!endif
   291         -
   292         -dlllflags = $(lflags) -dll
   293         -conlflags = $(lflags) -subsystem:console
   294         -guilflags = $(lflags) -subsystem:windows
   295         -!if !$(STATIC_BUILD)
   296         -baselibs  = $(TCLSTUBLIB)
   297         -!if defined(TKSTUBLIB)
   298         -baselibs  = $(baselibs) $(TKSTUBLIB)
   299         -!endif
   300         -!endif
   301         -
   302         -baselibs = $(baselibs) ws2_32.lib
   303         -
   304         -# Avoid 'unresolved external symbol __security_cookie' errors.
   305         -# c.f. http://support.microsoft.com/?id=894573
   306         -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
   307         -baselibs   = $(baselibs) bufferoverflowU.lib
   308         -!endif
          183  +		  -D_CRT_SECURE_NO_WARNINGS \
          184  +		  -D_WINSOCK_DEPRECATED_NO_WARNINGS
          185  +PRJ_LIBS	= ws2_32.lib
   309    186   
   310    187   #---------------------------------------------------------------------
   311    188   # TclTest flags
   312    189   #---------------------------------------------------------------------
   313    190   
   314    191   !IF "$(TESTPAT)" != ""
   315    192   TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
................................................................................
   349    226   !endif
   350    227   
   351    228   setup:
   352    229   	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
   353    230   	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
   354    231   
   355    232   $(PRJLIB): $(DLLOBJS)
   356         -!if $(STATIC_BUILD)
   357         -	$(lib32) -nologo -out:$@ @<<
   358         -$**
   359         -<<
   360         -!else
   361         -	$(link32) $(dlllflags) -base:0x109E0000 -out:$@ $(baselibs) @<<
   362         -$**
   363         -<<
          233  +	$(MAKEBINCMD) $** 
   364    234   	$(_VC_MANIFEST_EMBED_DLL)
   365         -	-@del $*.exp
   366         -!endif
          235  +	@if exist $*.exp del $*.exp
   367    236   
   368    237   #---------------------------------------------------------------------
   369    238   # Implicit rules
   370    239   #---------------------------------------------------------------------
   371    240   
   372         -{$(WINDIR)}.c{$(TMP_DIR)}.obj::
   373         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   374         -$<
   375         -<<
   376         -
   377         -{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
   378         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   379         -$<
   380         -<<
   381         -
   382         -{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
   383         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   384         -$<
   385         -<<
   386         -
   387    241   {$(WINDIR)}.rc{$(TMP_DIR)}.res:
   388    242   	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -D__WIN32__ \
   389    243                   -DCOMMAVERSION=$(DOTVERSION:.=,),0 \
   390    244                   -DDOTVERSION=\"$(DOTVERSION)\" \
   391    245                   -DVERSION=\"$(VERSION)$(SUFX)\" \
   392    246   !if $(DEBUG)
   393    247   	-d DEBUG \
................................................................................
   408    262   set name $(@:\=/)
   409    263   set f [open $$name r]; set d [read $$f]; close $$f
   410    264   set d [regsub {</head>} $$d {<link rel="stylesheet" href="manpage.css" type="text/css"></head>}]
   411    265   set f [open $$name w]; puts -nonewline $$f $$d; close $$f
   412    266   <<
   413    267   
   414    268   .SUFFIXES:
   415         -.SUFFIXES:.c .rc .man
          269  +.SUFFIXES: .man
   416    270   
   417    271   #---------------------------------------------------------------------
   418    272   # Installation. (EDIT)
   419    273   #
   420    274   # You may need to modify this section to reflect the final distribution
   421    275   # of your files and possibly to generate documentation.
   422    276   #
................................................................................
   446    300   	@if not exist $(DEMO_INSTALL_DIR)\nul mkdir "$(DEMO_INSTALL_DIR)"
   447    301   	@$(CPY) $(DEMODIR)\*.tcl "$(DEMO_INSTALL_DIR)" >NUL
   448    302   
   449    303   #---------------------------------------------------------------------
   450    304   # Clean up
   451    305   #---------------------------------------------------------------------
   452    306   
   453         -clean:
   454         -	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
   455         -	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
   456         -	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
   457         -	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
   458         -	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
   459         -
   460         -realclean: clean
   461         -	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
   462         -
   463    307   distclean: realclean
   464    308   	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
   465    309   	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj

Changes to win/rules.vc.

     1         -
            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   # See the file "license.terms" for information on usage and redistribution
     8      8   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
     9      9   #
    10     10   # Copyright (c) 2001-2003 David Gravereaux.
    11     11   # Copyright (c) 2003-2008 Patrick Thoyts
           12  +# Copyright (c) 2017      Ashok P. Nadkarni
    12     13   #------------------------------------------------------------------------------
    13     14   
    14     15   !ifndef _RULES_VC
    15     16   _RULES_VC = 1
    16     17   
    17         -cc32		= $(CC)   # built-in default.
    18         -link32		= link
    19         -lib32		= lib
    20         -rc32		= $(RC)   # built-in default.
    21         -
    22         -!ifndef INSTALLDIR
    23         -### Assume the normal default.
    24         -_INSTALLDIR	= C:\Program Files\Tcl
    25         -!else
    26         -### Fix the path separators.
    27         -_INSTALLDIR	= $(INSTALLDIR:/=\)
    28         -!endif
           18  +################################################################
           19  +# Nmake is a pretty weak environment in syntax and capabilities
           20  +# so this file is necessarily verbose. It's broken down into
           21  +# the following parts.
           22  +#
           23  +# 0. Sanity check that compiler environment is set up.
           24  +# 1. First define the external tools used for compiling, copying etc.
           25  +#    as this is independent of everything else.
           26  +# 2. Figure out our build structure in terms of the directory, whether
           27  +#    we are building Tcl or an extension, etc.
           28  +# 3. Determine the compiler and linker versions
           29  +# 4. Build the nmakehlp helper application
           30  +# 5. Determine the supported compiler options and features
           31  +# 6. Parse the OPTS macro value for user-specified build configuration
           32  +# 7. Parse the STATS macro value for statistics instrumentation
           33  +# 8. Parse the CHECKS macro for additional compilation checks
           34  +# 9. Extract Tcl, and possibly Tk, version numbers from the headers
           35  +# 10. Based on this selected configuration, construct the output
           36  +#     directory and file paths
           37  +# 11. Construct the paths where the package is to be installed
           38  +# 12. Set up the actual options passed to compiler and linker based
           39  +#     on the information gathered above.
           40  +# 13. Define some standard build targets and implicit rules. These may
           41  +#     be optionally disabled by the parent makefile.
           42  +# 14. (For extensions only.) Compare the configuration of the target
           43  +#     Tcl and the extensions and warn against discrepancies.
           44  +#
           45  +# One final note about the macro names used. They are as they are
           46  +# for historical reasons. We would like legacy extensions to
           47  +# continue to work with this make include file so be wary of
           48  +# changing them for consistency or clarity.
           49  +
           50  +# 0. Sanity check compiler environment
           51  +# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
           52  +# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
           53  +
           54  +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
           55  +MSG = ^
           56  +Visual C++ compiler environment not initialized.
           57  +!error $(MSG)
           58  +!endif
           59  +
           60  +################################################################
           61  +# 1. Define external programs being used
    29     62   
    30     63   #----------------------------------------------------------
    31     64   # Set the proper copy method to avoid overwrite questions
    32     65   # to the user when copying files and selecting the right
    33     66   # "delete all" method.
    34     67   #----------------------------------------------------------
    35     68   
    36         -!if "$(OS)" == "Windows_NT"
    37     69   RMDIR	= rmdir /S /Q
    38     70   ERRNULL  = 2>NUL
    39         -!if ![ver | find "4.0" > nul]
    40         -CPY	= echo y | xcopy /i >NUL
    41         -COPY	= copy >NUL
    42         -!else
    43     71   CPY	= xcopy /i /y >NUL
    44     72   COPY	= copy /y >NUL
    45         -!endif
    46         -!else # "$(OS)" != "Windows_NT"
    47         -CPY	= xcopy /i >_JUNK.OUT # On Win98 NUL does not work here.
    48         -COPY	= copy >_JUNK.OUT # On Win98 NUL does not work here.
    49         -RMDIR	= deltree /Y
    50         -NULL    = \NUL # Used in testing directory existence
    51         -ERRNULL = >NUL # Win9x shell cannot redirect stderr
    52         -!endif
    53     73   MKDIR   = mkdir
    54     74   
    55         -#------------------------------------------------------------------------------
    56         -# Determine the host and target architectures and compiler version.
    57         -#------------------------------------------------------------------------------
           75  +# The ProgramFiles(x86) environment variable is not accessible
           76  +# from nmake since it has the parenthesis which nmake does not like
           77  +# within a macro name. So define our own in terms of the
           78  +# ProgramFiles environment variable.
           79  +# Note: env variables are always UPPER CASE in nmake
           80  +!if defined(PROCESSOR_ARCHITECTURE) && "$(PROCESSOR_ARCHITECTURE)" == "AMD64"
           81  +PROGRAMFILES_X86 = $(PROGRAMFILES) (x86)
           82  +!else
           83  +PROGRAMFILES_X86 = $(PROGRAMFILES)
           84  +!endif
           85  +
           86  +
           87  +######################################################################
           88  +# 2. Figure out our build environment in terms of what we're building.
           89  +#
           90  +# (a) Tcl itself
           91  +# (b) Tk
           92  +# (c) a Tcl extension using libraries/includes from an *installed* Tcl
           93  +# (d) a Tcl extension using libraries/includes from Tcl source directory
           94  +#
           95  +# This last is needed because some extensions still need
           96  +# some Tcl interfaces that are not publicly exposed.
           97  +#
           98  +# The fragment will set the following macros:
           99  +# ROOT - root of this module sources
          100  +# COMPATDIR - source directory that holds compatibility sources
          101  +# DOCDIR - source directory containing documentation files
          102  +# GENERICDIR - platform-independent source directory
          103  +# WINDIR - Windows-specific source directory
          104  +# TOOLSDIR - directory containing build tools
          105  +# _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set
          106  +#    when building Tcl itself.
          107  +# _INSTALLDIR - native form of the installation path. For Tcl
          108  +#    this will be the root of the Tcl installation. For extensions
          109  +#    this will be the lib directory under the root.
          110  +# TCLINSTALL  - set to 1 if _TCLDIR refers to
          111  +#    headers and libraries from an installed Tcl, and 0 if built against
          112  +#    Tcl sources. Not set when building Tcl itself. Yes, not very well
          113  +#    named.
          114  +# _TCL_H - native path to the tcl.h file
          115  +#
          116  +# If Tk is involved, also sets the following
          117  +# _TKDIR - native form Tk installation OR Tk source. Not set if building
          118  +#    Tk itself.
          119  +# TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources
          120  +# _TK_H - native path to the tk.h file
          121  +
          122  +# Root directory for sources and assumed subdirectories
          123  +ROOT = $(MAKEDIR)\..
          124  +# The following paths CANNOT have spaces in them as they appear on the
          125  +# left side of implicit rules.
          126  +!ifndef COMPATDIR
          127  +COMPATDIR	= $(ROOT)\compat
          128  +!endif
          129  +!ifndef DOCDIR
          130  +DOCDIR		= $(ROOT)\doc
          131  +!endif
          132  +!ifndef GENERICDIR
          133  +GENERICDIR	= $(ROOT)\generic
          134  +!endif
          135  +!ifndef TOOLSDIR
          136  +TOOLSDIR	= $(ROOT)\tools
          137  +!endif
          138  +!ifndef LIBDIR
          139  +LIBDIR          = $(ROOT)\library
          140  +!endif
          141  +!ifndef DEMODIR
          142  +!if exist("$(LIBDIR)\demos")
          143  +DEMODIR		= $(LIBDIR)\demos
          144  +!else
          145  +DEMODIR		= $(ROOT)\demos
          146  +!endif
          147  +!endif # ifndef DEMODIR
          148  +# Do NOT enclose WINDIR in a !ifndef because Windows always defines
          149  +# WINDIR env var to point to c:\windows!
          150  +# TBD - This is a potentially dangerous conflict, rename WINDIR to
          151  +# something else
          152  +WINDIR		= $(ROOT)\win
          153  +!ifndef RCDIR
          154  +RCDIR           = $(WINDIR)\rc
          155  +!endif
          156  +
          157  +# The target directory where the built packages and binaries will be installed.
          158  +# INSTALLDIR is the (optional) path specified by the user.
          159  +# _INSTALLDIR is INSTALLDIR using the backslash separator syntax
          160  +!ifdef INSTALLDIR
          161  +### Fix the path separators.
          162  +_INSTALLDIR	= $(INSTALLDIR:/=\)
          163  +!else
          164  +### Assume the normal default.
          165  +_INSTALLDIR	= C:\Program Files\Tcl
          166  +!endif
          167  +
          168  +!if "$(PROJECT)" == "tcl" 
          169  +
          170  +# BEGIN Case 2(a) - Building Tcl itself
          171  +
          172  +# Only need to define _TCL_H
          173  +_TCL_H = ..\generic\tcl.h
          174  +
          175  +# END Case 2(a) - Building Tcl itself
          176  +
          177  +!elseif "$(PROJECT)" == "tk"
          178  +
          179  +# BEGIN Case 2(b) - Building Tk
          180  +
          181  +TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl
          182  +!ifndef TCLDIR
          183  +TCLDIR  = ../../tcl
          184  +!endif
          185  +_TCLDIR	= $(TCLDIR:/=\)
          186  +_TCL_H  = $(_TCLDIR)\generic\tcl.h
          187  +!if !exist("$(_TCL_H)")
          188  +!error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory.
          189  +!endif
          190  +
          191  +_TK_H = ..\generic\tk.h
          192  +
          193  +# END Case 2(b) - Building Tk
          194  +
          195  +!else
          196  +
          197  +# BEGIN Case 2(c) or (d) - Building an extension other than Tk
          198  +
          199  +# If command line has specified Tcl location through TCLDIR, use it
          200  +# else default to the INSTALLDIR setting
          201  +!ifdef TCLDIR
          202  +
          203  +_TCLDIR	= $(TCLDIR:/=\)
          204  +!if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined
          205  +TCLINSTALL	= 1
          206  +_TCL_H          = $(_TCLDIR)\include\tcl.h
          207  +!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined
          208  +TCLINSTALL	= 0
          209  +_TCL_H          = $(_TCLDIR)\generic\tcl.h
          210  +!endif
          211  +
          212  +!else  # TCLDIR is not defined
          213  +
          214  +!if exist("$(_INSTALLDIR)\include\tcl.h") # Case 2(c) for extensions with TCLDIR undefined
          215  +TCLINSTALL	= 1
          216  +TCLDIR          = $(_INSTALLDIR)\..
          217  +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions
          218  +# later so the \.. accounts for the /lib
          219  +_TCLDIR		= $(_INSTALLDIR)\..
          220  +_TCL_H          = $(_TCLDIR)\include\tcl.h
          221  +!elseif exist("..\..\tcl\generic\tcl.h")
          222  +TCLINSTALL      = 0
          223  +TCLDIR          = ..\..\tcl
          224  +_TCLDIR         = $(TCLDIR)
          225  +_TCL_H          = $(_TCLDIR)\generic\tcl.h
          226  +!endif
          227  +
          228  +!endif # TCLDIR
          229  +
          230  +!ifndef _TCL_H
          231  +MSG =^
          232  +Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h.
          233  +!error $(MSG)
          234  +!endif
          235  +
          236  +# Now do the same to locate Tk headers and libs if project requires Tk
          237  +!ifdef PROJECT_REQUIRES_TK
          238  +
          239  +!ifdef TKDIR
          240  +
          241  +_TKDIR = $(TKDIR:/=\)
          242  +!if exist("$(_TKDIR)\include\tk.h")
          243  +TKINSTALL      = 1
          244  +_TK_H          = $(_TKDIR)\include\tk.h
          245  +!elseif exist("$(_TKDIR)\generic\tk.h")
          246  +TKINSTALL      = 0
          247  +_TK_H          = $(_TKDIR)\generic\tk.h
          248  +!endif
          249  +
          250  +!else # TKDIR not defined
          251  +
          252  +!if exist("$(_INSTALLDIR)\..\include\tk.h")
          253  +TKINSTALL      = 1
          254  +_TKDIR         = $(_INSTALLDIR)\..
          255  +_TK_H          = $(_TKDIR)\include\tk.h
          256  +TKDIR          = $(_TKDIR)
          257  +!elseif exist("$(_TCLDIR)\include\tk.h")
          258  +TKINSTALL      = 1
          259  +_TKDIR         = $(_TCLDIR)
          260  +_TK_H          = $(_TKDIR)\include\tk.h
          261  +TKDIR          = $(_TKDIR)
          262  +!endif
          263  +
          264  +!endif # TKDIR
          265  +
          266  +!ifndef _TK_H
          267  +MSG =^
          268  +Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and default path does not contain tk.h.
          269  +!error $(MSG)
          270  +!endif
          271  +
          272  +!endif # PROJECT_REQUIRES_TK
          273  +
          274  +# If INSTALLDIR set to tcl installation root dir then reset to the
          275  +# lib dir for installing extensions 
          276  +!if exist("$(_INSTALLDIR)\include\tcl.h")
          277  +_INSTALLDIR=$(_INSTALLDIR)\lib
          278  +!endif
          279  +
          280  +# END Case 2(c) or (d) - Building an extension
          281  +!endif # if $(PROJECT) == "tcl"
          282  +
          283  +################################################################
          284  +# 3. Determine compiler version and architecture
          285  +# In this section, we figure out the compiler version and the
          286  +# architecture for which we are building. This sets the
          287  +# following macros:
          288  +# VCVERSION - the internal compiler version as 1200, 1400, 1910 etc.
          289  +#     This is also printed by the compiler in dotted form 19.10 etc.
          290  +# VCVER - the "marketing version", for example Visual C++ 6 for internal
          291  +#     compiler version 1200. This is kept only for legacy reasons as it
          292  +#     does not make sense for recent Microsoft compilers. Only used for
          293  +#     output directory names.
          294  +# ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target
          295  +# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
          296  +# MACHINE - same as $(ARCH) - legacy
          297  +# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
          298  +# CFG_ENCODING - set to an character encoding.
          299  +#   TBD - this is passed to compiler as TCL_CFGVAL_ENCODING but can't
          300  +#   see where it is used
          301  +
          302  +cc32		= $(CC)   # built-in default.
          303  +link32		= link
          304  +lib32		= lib
          305  +rc32		= $(RC)   # built-in default.
          306  +
          307  +#----------------------------------------------------------------
          308  +# Figure out the compiler architecture and version by writing
          309  +# the C macros to a file, preprocessing them with the C
          310  +# preprocessor and reading back the created file
    58    311   
    59    312   _HASH=^#
    60    313   _VC_MANIFEST_EMBED_EXE=
    61    314   _VC_MANIFEST_EMBED_DLL=
    62    315   VCVER=0
    63    316   !if ![echo VCVERSION=_MSC_VER > vercl.x] \
    64    317       && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
    65    318       && ![echo ARCH=IX86 >> vercl.x] \
    66    319       && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
    67    320       && ![echo ARCH=AMD64 >> vercl.x] \
    68    321       && ![echo $(_HASH)endif >> vercl.x] \
    69         -    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
          322  +    && ![$(cc32) -nologo -TC -P vercl.x $(ERRNULL)]
    70    323   !include vercl.i
          324  +!if $(VCVERSION) < 1900
    71    325   !if ![echo VCVER= ^\> vercl.vc] \
    72    326       && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
    73    327   !include vercl.vc
    74    328   !endif
          329  +!else
          330  +# The simple calculation above does not apply to new Visual Studio releases
          331  +# Keep the compiler version in its native form.
          332  +VCVER = $(VCVERSION)
    75    333   !endif
          334  +!endif
          335  +
    76    336   !if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
    77    337   !endif
          338  +
          339  +#----------------------------------------------------------------
          340  +# The MACHINE macro is used by legacy makefiles so set it as well
          341  +!ifdef MACHINE
          342  +!if "$(MACHINE)" == "x86"
          343  +!undef MACHINE
          344  +MACHINE = IX86
          345  +!elseif "$(MACHINE)" == "x64"
          346  +!undef MACHINE
          347  +MACHINE = AMD64
          348  +!endif
          349  +!if "$(MACHINE)" != "$(ARCH)"
          350  +!error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH).
          351  +!endif
          352  +!else
          353  +MACHINE=$(ARCH)
          354  +!endif
          355  +
          356  +#------------------------------------------------------------
          357  +# Figure out the *host* architecture by reading the registry
    78    358   
    79    359   !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
    80    360   NATIVE_ARCH=IX86
    81    361   !else
    82    362   NATIVE_ARCH=AMD64
    83    363   !endif
    84    364   
    85    365   # Since MSVC8 we must deal with manifest resources.
    86    366   !if $(VCVERSION) >= 1400
    87    367   _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
    88    368   _VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
    89    369   !endif
    90    370   
    91         -!ifndef MACHINE
    92         -MACHINE=$(ARCH)
    93         -!endif
    94         -
    95    371   !ifndef CFG_ENCODING
    96    372   CFG_ENCODING	= \"cp1252\"
    97    373   !endif
    98    374   
    99         -!message ===============================================================================
   100         -
   101         -#----------------------------------------------------------
   102         -# build the helper app we need to overcome nmake's limiting
   103         -# environment.
   104         -#----------------------------------------------------------
   105         -
   106         -!if !exist(nmakehlp.exe)
   107         -!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul]
   108         -!endif
   109         -!endif
   110         -
   111         -#----------------------------------------------------------
   112         -# Test for compiler features
   113         -#----------------------------------------------------------
   114         -
   115         -### test for optimizations
   116         -!if [nmakehlp -c -O2]
   117         -!message *** Compiler has 'Optimizations'
   118         -OPTIMIZING	= 1
   119         -!else
   120         -!message *** Compiler does not have 'Optimizations'
   121         -OPTIMIZING	= 0
   122         -!endif
   123         -
          375  +!message =====================================================================
          376  +
          377  +################################################################
          378  +# 4. Build the nmakehlp program
          379  +# This is a helper app we need to overcome nmake's limiting
          380  +# environment. We will call out to it to get various bits of
          381  +# information about supported compiler options etc.
          382  +#
          383  +# Tcl itself will always use the nmakehlp.c program which is
          384  +# in its own source. This is the "master" copy and kept updated.
          385  +#
          386  +# Extensions built against an installed Tcl will use the installed
          387  +# copy of Tcl's nmakehlp.c if there is one and their own version
          388  +# otherwise. In the latter case, they would also be using their own
          389  +# rules.vc. Note that older versions of Tcl do not install nmakehlp.c
          390  +# or rules.vc.
          391  +#
          392  +# Extensions built against Tcl sources will use the one from the Tcl source.
          393  +#
          394  +# This can all be overridden by defining the NMAKEHLPC macro to point
          395  +# to the nmakehlp.c file to be used, either from the command line or
          396  +# the containing makefile.
          397  +
          398  +!ifndef NMAKEHLPC
          399  +# Default to the one in the current directory (the extension's own nmakehlp.c)
          400  +NMAKEHLPC = nmakehlp.c
          401  +
          402  +!if "$(PROJECT)" != "tcl"
          403  +!if $(TCLINSTALL)
          404  +!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c")
          405  +NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c
          406  +!endif
          407  +!else # ! $(TCLINSTALL)
          408  +!if exist("$(_TCLDIR)\win\nmakehlp.c")
          409  +NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
          410  +!endif
          411  +!endif # $(TCLINSTALL)
          412  +!endif # $(PROJECT) != "tcl"
          413  +
          414  +!endif # NMAKEHLPC
          415  +
          416  +# We always build nmakehlp even if it exists since we do not know
          417  +# what source it was built from.
          418  +!message *** Using $(NMAKEHLPC)
          419  +!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
          420  +!endif
          421  +
          422  +################################################################
          423  +# 5. Test for compiler features
          424  +# Visual C++ compiler options have changed over the years. Check
          425  +# which options are supported by the compiler in use.
          426  +#
          427  +# The following macros are set:
          428  +# OPTIMIZATIONS - the compiler flags to be used for optimized builds
          429  +# DEBUGFLAGS - the compiler flags to be used for debug builds
          430  +# LINKERFLAGS - Flags passed to the linker 
          431  +#
          432  +# Note that these are the compiler settings *available*, not those
          433  +# that will be *used*. The latter depends on the OPTS macro settings
          434  +# which we have not yet parsed.
          435  +#
          436  +# Also note that some of the flags in OPTIMIZATIONS are not really
          437  +# related to optimization. They are placed there only for legacy reasons
          438  +# as some extensions expect them to be included in that macro.
          439  +
          440  +# -Op improves float consistency. Note only needed for older compilers
          441  +# Newer compilers do not need or support this option.
          442  +!if [nmakehlp -c -Op]
          443  +FPOPTS  = -Op
          444  +!endif
          445  +
          446  +# Strict floating point semantics - present in newer compilers in lieu of -Op
          447  +!if [nmakehlp -c -fp:strict]
          448  +FPOPTS  = $(FPOPTS) -fp:strict
          449  +!endif
          450  +
          451  +!if "$(MACHINE)" == "IX86"
          452  +### test for pentium errata
          453  +!if [nmakehlp -c -QI0f]
          454  +!message *** Compiler has 'Pentium 0x0f fix'
          455  +FPOPTS  = $(FPOPTS) -QI0f
          456  +!else
          457  +!message *** Compiler does not have 'Pentium 0x0f fix'
          458  +!endif
          459  +!endif
          460  +
          461  +### test for optimizations
   124    462   # /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per
   125    463   # documentation. Note we do NOT want /Gs as that inserts a _chkstk
   126    464   # stack probe at *every* function entry, not just those with more than
   127    465   # a page of stack allocation resulting in a performance hit.  However,
   128    466   # /O2 documentation is misleading as its stack probes are simply the
   129    467   # default page size locals allocation probes and not what is implied
   130    468   # by an explicit /Gs option.
   131    469   
   132         -OPTIMIZATIONS   = -O2
          470  +OPTIMIZATIONS = $(FPOPTS)
   133    471   
   134         -# -Op improves float consistency. Note only needed for older compilers
   135         -# Newer compilers do not need or support this option.
   136         -!if [nmakehlp -c -Op]
   137         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Op
          472  +!if [nmakehlp -c -O2]
          473  +!message *** Compiler has 'Optimizations'
          474  +OPTIMIZING = 1
          475  +OPTIMIZATIONS   = $(OPTIMIZATIONS) -O2
          476  +!else
          477  +# Legacy, really. All modern compilers support this
          478  +!message *** Compiler does not have 'Optimizations'
          479  +OPTIMIZING = 0
   138    480   !endif
   139    481   
   140         -# Strict floating point semantics
   141         -!if [nmakehlp -c -fp:strict]
   142         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -fp:strict
   143         -!endif
   144         -
   145         -# Enable security checks for buffer overflows
          482  +# Checks for buffer overflows in local arrays
   146    483   !if [nmakehlp -c -GS]
   147    484   OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
   148    485   !endif
   149    486   
   150         -# Whole program optimization. Note this makes the generated libraries
   151         -# potentially incompatible with other versions of Visual C++
          487  +# Link time optimization. Note that this option (potentially) makes
          488  +# generated libraries only usable by the specific VC++ version that
          489  +# created it. Requires /LTCG linker option
   152    490   !if [nmakehlp -c -GL]
   153    491   OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
          492  +CC_GL_OPT_ENABLED = 1
          493  +!else
          494  +# In newer compilers -GL and -YX are incompatible.
          495  +!if [nmakehlp -c -YX]
          496  +OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
   154    497   !endif
          498  +!endif # [nmakehlp -c -GL]
   155    499   
   156         -DEBUGFLAGS     =
          500  +DEBUGFLAGS     = $(FPOPTS)
   157    501   
          502  +# Run time error checks. Not available or valid in a release, non-debug build
          503  +# RTC is for modern compilers, -GZ is legacy
   158    504   !if [nmakehlp -c -RTC1]
   159    505   DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
   160    506   !elseif [nmakehlp -c -GZ]
   161    507   DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
   162    508   !endif
   163    509   
   164         -COMPILERFLAGS  =-W3 /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING
          510  +#----------------------------------------------------------------
          511  +# Linker flags
   165    512   
   166         -# In v13 -GL and -YX are incompatible.
   167         -!if [nmakehlp -c -YX]
   168         -!if ![nmakehlp -c -GL]
   169         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
   170         -!endif
   171         -!endif
   172         -
   173         -!if "$(MACHINE)" == "IX86"
   174         -### test for pentium errata
   175         -!if [nmakehlp -c -QI0f]
   176         -!message *** Compiler has 'Pentium 0x0f fix'
   177         -COMPILERFLAGS  = $(COMPILERFLAGS) -QI0f
   178         -!else
   179         -!message *** Compiler does not have 'Pentium 0x0f fix'
   180         -!endif
   181         -!endif
   182         -
   183         -!if "$(MACHINE)" == "IA64"
   184         -### test for Itanium errata
   185         -!if [nmakehlp -c -QIA64_Bx]
   186         -!message *** Compiler has 'B-stepping errata workarounds'
   187         -COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
   188         -!else
   189         -!message *** Compiler does not have 'B-stepping errata workarounds'
   190         -!endif
   191         -!endif
   192         -
   193         -# Prevents "LNK1561: entry point must be defined" error compiling from VS-IDE:
          513  +# LINKER_TESTFLAGS are for internal use when we call nmakehlp to test
          514  +# if the linker supports a specific option. Without these flags link will
          515  +# return "LNK1561: entry point must be defined" error compiling from VS-IDE:
          516  +# They are not passed through to the actual application / extension
          517  +# link rules.
   194    518   !ifndef LINKER_TESTFLAGS
   195    519   LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmhlp-out.txt
   196    520   !endif
   197    521   
   198         -!if "$(MACHINE)" == "IX86"
   199         -### test for -align:4096, when align:512 will do.
   200         -!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)]
   201         -!message *** Linker has 'Win98 alignment problem'
   202         -ALIGN98_HACK	= 1
   203         -!else
   204         -!message *** Linker does not have 'Win98 alignment problem'
   205         -ALIGN98_HACK	= 0
   206         -!endif
   207         -!else
   208         -ALIGN98_HACK	= 0
   209         -!endif
   210         -
   211    522   LINKERFLAGS     =
   212    523   
          524  +# If compiler has enabled link time optimization, linker must too with -ltcg
          525  +!ifdef CC_GL_OPT_ENABLED
   213    526   !if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)]
   214         -LINKERFLAGS     =-ltcg
          527  +LINKERFLAGS     = $(LINKERFLAGS) -ltcg
          528  +!endif
   215    529   !endif
   216    530   
   217         -#----------------------------------------------------------
   218         -# Decode the options requested.
   219         -#----------------------------------------------------------
          531  +########################################################################
          532  +# 6. Parse the OPTS macro to work out the requested build configuration.
          533  +# Based on this, we will construct the actual switches to be passed to the
          534  +# compiler and linker using the macros defined in the previous section.
          535  +# The following macros are defined by this section based on OPTS
          536  +# STATIC_BUILD - 0 -> Tcl is to be built as a shared library
          537  +#                1 -> build as a static library and shell
          538  +# TCL_THREADS - legacy but always 1 on Windows since winsock requires it.
          539  +# DEBUG - 1 -> debug build, 0 -> release builds
          540  +# SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's
          541  +# PROFILE - 1 -> generate profiling info, 0 -> no profiling
          542  +# PGO     - 1 -> profile based optimization, 0 -> no
          543  +# MSVCRT  - 1 -> link to dynamic C runtime even when building static Tcl build
          544  +#           0 -> link to static C runtime for static Tcl build.
          545  +#           Does not impact shared Tcl builds (STATIC_BUILD == 0)
          546  +# LOIMPACT - 1 -> Ask Windows loader to aggressively trim the working set.
          547  +#           Will reduce physical memory use at cost of performance.
          548  +# TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions
          549  +#           in the Tcl shell. 0 -> keep them as shared libraries
          550  +#           Does not impact shared Tcl builds.
          551  +# USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation.
          552  +#           0 -> Use the non-thread allocator.
          553  +# UNCHECKED - 1 -> when doing a debug build with symbols, use the release
          554  +#           C runtime, 0 -> use the debug C runtime.
          555  +# USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking
          556  +# CONFIG_CHECK - 1 -> check current build configuration against Tcl
          557  +#           configuration (ignored for Tcl itself)
          558  +# Further, LINKERFLAGS are modified based on above.
   220    559   
   221         -!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
          560  +# Default values for all the above
   222    561   STATIC_BUILD	= 0
   223    562   TCL_THREADS	= 1
   224    563   DEBUG		= 0
   225    564   SYMBOLS		= 0
   226    565   PROFILE		= 0
   227    566   PGO		= 0
   228    567   MSVCRT		= 1
   229    568   LOIMPACT	= 0
   230    569   TCL_USE_STATIC_PACKAGES	= 0
   231    570   USE_THREAD_ALLOC = 1
   232    571   UNCHECKED	= 0
          572  +CONFIG_CHECK    = 1
          573  +!if "$(PROJECT)" == "tcl"
          574  +USE_STUBS       = 0
   233    575   !else
          576  +USE_STUBS       = 1
          577  +!endif
          578  +
          579  +# If OPTS is not empty AND does not contain "none" which turns off all OPTS
          580  +# set the above macros based on OPTS content
          581  +!if "$(OPTS)" != "" && ![nmakehlp -f "$(OPTS)" "none"]
          582  +
          583  +# OPTS are specified, parse them
          584  +
   234    585   !if [nmakehlp -f $(OPTS) "static"]
   235    586   !message *** Doing static
   236    587   STATIC_BUILD	= 1
   237         -!else
   238         -STATIC_BUILD	= 0
   239    588   !endif
          589  +
          590  +!if [nmakehlp -f $(OPTS) "nostubs"]
          591  +!message *** Not using stubs
          592  +USE_STUBS	= 0
          593  +!endif
          594  +
   240    595   !if [nmakehlp -f $(OPTS) "nomsvcrt"]
   241    596   !message *** Doing nomsvcrt
   242    597   MSVCRT		= 0
   243    598   !else
   244    599   !if [nmakehlp -f $(OPTS) "msvcrt"]
   245    600   !message *** Doing msvcrt
   246    601   MSVCRT		= 1
................................................................................
   247    602   !else
   248    603   !if !$(STATIC_BUILD)
   249    604   MSVCRT		= 1
   250    605   !else
   251    606   MSVCRT		= 0
   252    607   !endif
   253    608   !endif
   254         -!endif
          609  +!endif # [nmakehlp -f $(OPTS) "nomsvcrt"]
          610  +
   255    611   !if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
   256    612   !message *** Doing staticpkg
   257    613   TCL_USE_STATIC_PACKAGES	= 1
   258    614   !else
   259    615   TCL_USE_STATIC_PACKAGES	= 0
   260    616   !endif
          617  +
   261    618   !if [nmakehlp -f $(OPTS) "nothreads"]
   262         -!message *** Compile explicitly for non-threaded tcl
   263         -TCL_THREADS	= 0
   264         -USE_THREAD_ALLOC= 0
   265         -!else
   266         -TCL_THREADS	= 1
   267         -USE_THREAD_ALLOC= 1
          619  +!error Option "nothreads" no longer supported. Threads required for sockets, registry and dde to work.
   268    620   !endif
          621  +
   269    622   !if [nmakehlp -f $(OPTS) "symbols"]
   270    623   !message *** Doing symbols
   271    624   DEBUG		= 1
   272    625   !else
   273    626   DEBUG		= 0
   274    627   !endif
          628  +
   275    629   !if [nmakehlp -f $(OPTS) "pdbs"]
   276    630   !message *** Doing pdbs
   277    631   SYMBOLS		= 1
   278    632   !else
   279    633   SYMBOLS		= 0
   280    634   !endif
          635  +
   281    636   !if [nmakehlp -f $(OPTS) "profile"]
   282    637   !message *** Doing profile
   283    638   PROFILE		= 1
   284    639   !else
   285    640   PROFILE		= 0
   286    641   !endif
          642  +
   287    643   !if [nmakehlp -f $(OPTS) "pgi"]
   288    644   !message *** Doing profile guided optimization instrumentation
   289    645   PGO		= 1
   290    646   !elseif [nmakehlp -f $(OPTS) "pgo"]
   291    647   !message *** Doing profile guided optimization
   292    648   PGO		= 2
   293    649   !else
   294    650   PGO		= 0
   295    651   !endif
          652  +
   296    653   !if [nmakehlp -f $(OPTS) "loimpact"]
   297    654   !message *** Doing loimpact
   298    655   LOIMPACT	= 1
   299    656   !else
   300    657   LOIMPACT	= 0
   301    658   !endif
          659  +
          660  +# TBD - should get rid of this option
   302    661   !if [nmakehlp -f $(OPTS) "thrdalloc"]
   303    662   !message *** Doing thrdalloc
   304    663   USE_THREAD_ALLOC = 1
   305    664   !endif
          665  +
          666  +# TBD - should get rid of this option
   306    667   !if [nmakehlp -f $(OPTS) "tclalloc"]
   307    668   !message *** Doing tclalloc
   308    669   USE_THREAD_ALLOC = 0
   309    670   !endif
          671  +
   310    672   !if [nmakehlp -f $(OPTS) "unchecked"]
   311    673   !message *** Doing unchecked
   312    674   UNCHECKED = 1
   313    675   !else
   314    676   UNCHECKED = 0
   315    677   !endif
   316         -!endif
   317         -
   318         -#----------------------------------------------------------
          678  +
          679  +!if [nmakehlp -f $(OPTS) "noconfigcheck"]
          680  +CONFIG_CHECK = 1
          681  +!else
          682  +CONFIG_CHECK = 0
          683  +!endif
          684  +
          685  +!endif # "$(OPTS)" != ""  && ... parsing of OPTS
          686  +
          687  +# Set linker flags based on above
          688  +
          689  +!if $(PGO) > 1
          690  +!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)]
          691  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
          692  +!else
          693  +MSG=^
          694  +This compiler does not support profile guided optimization.
          695  +!error $(MSG)
          696  +!endif
          697  +!elseif $(PGO) > 0
          698  +!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)]
          699  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
          700  +!else
          701  +MSG=^
          702  +This compiler does not support profile guided optimization.
          703  +!error $(MSG)
          704  +!endif
          705  +!endif
          706  +
          707  +################################################################
          708  +# 7. Parse the STATS macro to configure code instrumentation
          709  +# The following macros are set by this section:
          710  +# TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation
          711  +#                 0 -> disables
          712  +# TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging
          713  +#                     0 -> disables
          714  +
          715  +# Default both are off
          716  +TCL_MEM_DEBUG	    = 0
          717  +TCL_COMPILE_DEBUG   = 0
          718  +
          719  +!if "$(STATS)" != "" && ![nmakehlp -f "$(STATS)" "none"]
          720  +
          721  +!if [nmakehlp -f $(STATS) "memdbg"]
          722  +!message *** Doing memdbg
          723  +TCL_MEM_DEBUG	    = 1
          724  +!else
          725  +TCL_MEM_DEBUG	    = 0
          726  +!endif
          727  +
          728  +!if [nmakehlp -f $(STATS) "compdbg"]
          729  +!message *** Doing compdbg
          730  +TCL_COMPILE_DEBUG   = 1
          731  +!else
          732  +TCL_COMPILE_DEBUG   = 0
          733  +!endif
          734  +
          735  +!endif
          736  +
          737  +####################################################################
          738  +# 8. Parse the CHECKS macro to configure additional compiler checks
          739  +# The following macros are set by this section:
          740  +# WARNINGS - compiler switches that control the warnings level
          741  +# TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions
          742  +#                     0 -> enable deprecated functions
          743  +
          744  +# Defaults - Permit deprecated functions and warning level 3
          745  +TCL_NO_DEPRECATED	    = 0
          746  +WARNINGS		    = -W3
          747  +
          748  +!if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"]
          749  +
          750  +!if [nmakehlp -f $(CHECKS) "nodep"]
          751  +!message *** Doing nodep check
          752  +TCL_NO_DEPRECATED	    = 1
          753  +!endif
          754  +
          755  +!if [nmakehlp -f $(CHECKS) "fullwarn"]
          756  +!message *** Doing full warnings check
          757  +WARNINGS		    = -W4
          758  +!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)]
          759  +LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
          760  +!endif
          761  +!endif
          762  +
          763  +!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
          764  +!message *** Doing 64bit portability warnings
          765  +WARNINGS		    = $(WARNINGS) -Wp64
          766  +!endif
          767  +
          768  +!endif
          769  +
          770  +################################################################
          771  +# 9. Extract various version numbers from tcl headers
          772  +# Sets the following macros:
          773  +# TCL_MAJOR_VERSION
          774  +# TCL_MINOR_VERSION
          775  +# TCL_PATCH_LEVEL
          776  +# TCL_VERSION
          777  +# TK_MAJOR_VERSION
          778  +# TK_MINOR_VERSION
          779  +# TK_PATCH_LEVEL
          780  +# TK_VERSION
          781  +#--------------------------------------------------------------
          782  +
          783  +!if [echo REM = This file is generated from rules.vc > versions.vc]
          784  +!endif
          785  +!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
          786  +   && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
          787  +!endif
          788  +!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
          789  +   && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
          790  +!endif
          791  +!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
          792  +   && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
          793  +!endif
          794  +
          795  +!if defined(_TK_H)
          796  +!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
          797  +   && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
          798  +!endif
          799  +!if [echo TK_MINOR_VERSION = \>> versions.vc] \
          800  +   && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
          801  +!endif
          802  +!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
          803  +   && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
          804  +!endif
          805  +!endif # _TK_H
          806  +
          807  +!include versions.vc
          808  +
          809  +TCL_VERSION	= $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
          810  +!if defined(_TK_H)
          811  +TK_VERSION	= $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
          812  +!endif
          813  +
          814  +
          815  +################################################################
          816  +# 10. Construct output directory and file paths
   319    817   # Figure-out how to name our intermediate and output directories.
   320         -# We wouldn't want different builds to use the same .obj files
   321         -# by accident.
   322         -#----------------------------------------------------------
   323         -
   324         -#----------------------------------------
   325         -# Naming convention:
          818  +# In order to avoid inadvertent mixing of object files built using
          819  +# different compilers, build configurations etc.,
          820  +#
          821  +# Naming convention (suffixes):
   326    822   #   t = full thread support.
   327         -#   s = static library (as opposed to an
   328         -#	import library)
   329         -#   g = linked to the debug enabled C
   330         -#	run-time.
   331         -#   x = special static build when it
   332         -#	links to the dynamic C run-time.
   333         -#----------------------------------------
          823  +#   s = static library (as opposed to an import library)
          824  +#   g = linked to the debug enabled C run-time.
          825  +#   x = special static build when it links to the dynamic C run-time.
          826  +#
          827  +# The following macros are set in this section:
          828  +# SUFX - the suffix to use for binaries based on above naming convention
          829  +# BUILDDIRTOP - the toplevel default output directory
          830  +#      is of the form {Release,Debug}[_AMD64][_COMPILERVERSION]
          831  +# TMP_DIR - directory where object files are created
          832  +# OUT_DIR - directory where output executables are created
          833  +# STUBPREFIX - name of the stubs library for this project
          834  +# Both TMP_DIR and OUT_DIR are defaulted only if not defined by the
          835  +# parent makefile (or command line). The default values are
          836  +# based on BUILDDIRTOP.
          837  +
   334    838   SUFX	    = tsgx
   335    839   
   336    840   !if $(DEBUG)
   337    841   BUILDDIRTOP = Debug
   338    842   !else
   339    843   BUILDDIRTOP = Release
   340    844   !endif
................................................................................
   379    883   !endif
   380    884   !else
   381    885   !ifndef OUT_DIR
   382    886   OUT_DIR	    = $(TMP_DIR)
   383    887   !endif
   384    888   !endif
   385    889   
   386         -
   387         -#----------------------------------------------------------
   388         -# Decode the statistics requested.
   389         -#----------------------------------------------------------
   390         -
   391         -!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"]
   392         -TCL_MEM_DEBUG	    = 0
   393         -TCL_COMPILE_DEBUG   = 0
   394         -!else
   395         -!if [nmakehlp -f $(STATS) "memdbg"]
   396         -!message *** Doing memdbg
   397         -TCL_MEM_DEBUG	    = 1
   398         -!else
   399         -TCL_MEM_DEBUG	    = 0
   400         -!endif
   401         -!if [nmakehlp -f $(STATS) "compdbg"]
   402         -!message *** Doing compdbg
   403         -TCL_COMPILE_DEBUG   = 1
          890  +# The name of the stubs library for the project being built
          891  +STUBPREFIX      = $(PROJECT)stub
          892  +
          893  +# Set up paths to various Tcl executables and libraries needed by extensions
          894  +!if "$(PROJECT)" == "tcl"
          895  +
          896  +TCLSHNAME       = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe
          897  +TCLSH		= $(OUT_DIR)\$(TCLSHNAME)
          898  +TCLIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
          899  +TCLLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
          900  +TCLLIB		= $(OUT_DIR)\$(TCLLIBNAME)
          901  +
          902  +TCLSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
          903  +TCLSTUBLIB	= $(OUT_DIR)\$(TCLSTUBLIBNAME)
          904  +TCL_INCLUDES    = -I"$(WINDIR)" -I"$(GENERICDIR)"
          905  +
          906  +!else # $(PROJECT) is not "tcl"
          907  +
          908  +!if $(TCLINSTALL) # Building against an installed Tcl
          909  +
          910  +TCLSH		= $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe
          911  +!if !exist("$(TCLSH)") && $(TCL_THREADS)
          912  +TCLSH           = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe
          913  +!endif
          914  +TCLSTUBLIB	= $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib
          915  +TCLIMPLIB	= $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib
          916  +TCL_LIBRARY	= $(_TCLDIR)\lib
          917  +TCLREGLIB	= $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib
          918  +TCLDDELIB	= $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib
          919  +TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
          920  +TCL_INCLUDES    = -I"$(_TCLDIR)\include"
          921  +
          922  +!else # Building against Tcl sources
          923  +
          924  +TCLSH		= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe
          925  +!if !exist($(TCLSH)) && $(TCL_THREADS)
          926  +TCLSH		= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe
          927  +!endif
          928  +TCLSTUBLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib
          929  +TCLIMPLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib
          930  +TCL_LIBRARY	= $(_TCLDIR)\library
          931  +TCLREGLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib
          932  +TCLDDELIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib
          933  +TCLTOOLSDIR	= $(_TCLDIR)\tools
          934  +TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
          935  +
          936  +!endif # TCLINSTALL
          937  +
          938  +tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)"
          939  +
          940  +!endif $(PROJECT) != "tcl"
          941  +
          942  +# We need a tclsh that will run on the host machine as part of the build.
          943  +# IX86 runs on all architectures.
          944  +!ifndef TCLSH_NATIVE
          945  +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
          946  +TCLSH_NATIVE	= $(TCLSH)
   404    947   !else
   405         -TCL_COMPILE_DEBUG   = 0
   406         -!endif
   407         -!endif
   408         -
   409         -
   410         -#----------------------------------------------------------
   411         -# Decode the checks requested.
   412         -#----------------------------------------------------------
   413         -
   414         -!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
   415         -TCL_NO_DEPRECATED	    = 0
   416         -WARNINGS		    = -W3
          948  +!error You must explicitly set TCLSH_NATIVE for cross-compilation
          949  +!endif
          950  +!endif
          951  +
          952  +# Do the same for Tk and Tk extensions that require the Tk libraries
          953  +!if "$(PROJECT)" == "tk" || defined(PROJECT_REQUIRES_TK)
          954  +WISHNAMEPREFIX = wish
          955  +WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
          956  +TKLIBNAME	= $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
          957  +TKSTUBLIBNAME	= tkstub$(TK_VERSION).lib
          958  +TKIMPLIBNAME	= tk$(TK_VERSION)$(SUFX).lib
          959  +
          960  +!if "$(PROJECT)" == "tk"
          961  +WISH 		= $(OUT_DIR)\$(WISHNAME)
          962  +TKSTUBLIB	= $(OUT_DIR)\$(TKSTUBLIBNAME)
          963  +TKIMPLIB	= $(OUT_DIR)\$(TKIMPLIBNAME)
          964  +TKLIB		= $(OUT_DIR)\$(TKLIBNAME)
          965  +TK_INCLUDES    = -I"$(WINDIR)" -I"$(GENERICDIR)"
          966  +
          967  +!else # effectively PROJECT_REQUIRES_TK
          968  +
          969  +!if $(TKINSTALL) # Building against installed Tk
          970  +WISH		= $(_TKDIR)\bin\$(WISHNAME)
          971  +TKSTUBLIB	= $(_TKDIR)\lib\$(TKSTUBLIBNAME)
          972  +TKIMPLIB	= $(_TKDIR)\lib\$(TKIMPLIBNAME)
          973  +TK_INCLUDES     = -I"$(_TKDIR)\include"
          974  +!else # Building against Tk sources
          975  +WISH		= $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME)
          976  +TKSTUBLIB	= $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME)
          977  +TKIMPLIB	= $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
          978  +TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
          979  +!endif # TKINSTALL
          980  +
          981  +!endif # $(PROJECT) == tk
          982  +!endif # $(PROJECT) == tk || PROJECT_REQUIRES_TK
          983  +
          984  +###################################################################
          985  +# 11. Construct the paths for the installation directories
          986  +# The following macros get defined in this section:
          987  +# LIB_INSTALL_DIR - where libraries should be installed
          988  +# BIN_INSTALL_DIR - where the executables should be installed
          989  +# DOC_INSTALL_DIR - where documentation should be installed
          990  +# SCRIPT_INSTALL_DIR - where scripts should be installed
          991  +# INCLUDE_INSTALL_DIR - where C include files should be installed
          992  +# DEMO_INSTALL_DIR - where demos should be installed
          993  +# PRJ_INSTALL_DIR - where package will be installed (not set for tcl and tk)
          994  +
          995  +!if "$(PROJECT)" == "tcl" || "$(PROJECT)" == "tk"
          996  +LIB_INSTALL_DIR		= $(_INSTALLDIR)\lib
          997  +BIN_INSTALL_DIR		= $(_INSTALLDIR)\bin
          998  +DOC_INSTALL_DIR		= $(_INSTALLDIR)\doc
          999  +!if "$(PROJECT)" == "tcl"
         1000  +SCRIPT_INSTALL_DIR	= $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
   417   1001   !else
   418         -!if [nmakehlp -f $(CHECKS) "nodep"]
   419         -!message *** Doing nodep check
   420         -TCL_NO_DEPRECATED	    = 1
   421         -!else
   422         -TCL_NO_DEPRECATED	    = 0
         1002  +SCRIPT_INSTALL_DIR	= $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
   423   1003   !endif
   424         -!if [nmakehlp -f $(CHECKS) "fullwarn"]
   425         -!message *** Doing full warnings check
   426         -WARNINGS		    = -W4
   427         -!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)]
   428         -LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
   429         -!endif
         1004  +DEMO_INSTALL_DIR	= $(SCRIPT_INSTALL_DIR)\demos
         1005  +INCLUDE_INSTALL_DIR	= $(_INSTALLDIR)\include
         1006  +
   430   1007   !else
   431         -WARNINGS		    = -W3
   432         -!endif
   433         -!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
   434         -!message *** Doing 64bit portability warnings
   435         -WARNINGS		    = $(WARNINGS) -Wp64
   436         -!endif
   437         -!endif
   438         -
   439         -!if $(PGO) > 1
   440         -!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)]
   441         -LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
   442         -!else
   443         -MSG=^
   444         -This compiler does not support profile guided optimization.
   445         -!error $(MSG)
   446         -!endif
   447         -!elseif $(PGO) > 0
   448         -!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)]
   449         -LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
   450         -!else
   451         -MSG=^
   452         -This compiler does not support profile guided optimization.
   453         -!error $(MSG)
   454         -!endif
   455         -!endif
   456         -
   457         -#----------------------------------------------------------
   458         -# Set our defines now armed with our options.
   459         -#----------------------------------------------------------
         1008  +
         1009  +PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
         1010  +LIB_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1011  +BIN_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1012  +DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1013  +SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)
         1014  +DEMO_INSTALL_DIR	= $(PRJ_INSTALL_DIR)\demos
         1015  +INCLUDE_INSTALL_DIR	= $(_TCLDIR)\include
         1016  +
         1017  +!endif
         1018  +
         1019  +###################################################################
         1020  +# 12. Set up actual options to be passed to the compiler and linker
         1021  +# Now we have all the information we need, set up the actual flags and
         1022  +# options that we will pass to the compiler and linker. The main
         1023  +# makefile should use these in combination with whatever other flags
         1024  +# and switches are specific to it.
         1025  +# The following macros are defined, names are for historical compatibility:
         1026  +# OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS
         1027  +# COMPILERFLAGS - /Dxxx C macro flags independent of any configuration opttions
         1028  +# crt - Compiler switch that selects the appropriate C runtime
         1029  +# cdebug - Compiler switches related to debug AND optimizations
         1030  +# cwarn - Compiler switches that set warning levels
         1031  +# cflags - complete compiler switches (subsumes cdebug and cwarn)
         1032  +# ldebug - Linker switches controlling debug information and optimization
         1033  +# lflags - complete linker switches (subsumes ldebug) except subsystem type
         1034  +# dlllflags - complete linker switches to build DLLs (subsumes lflags)
         1035  +# conlflags - complete linker switches for console program (subsumes lflags)
         1036  +# guilflags - complete linker switches for GUI program (subsumes lflags)
         1037  +# baselibs - minimum Windows libraries required. Parent makefile can
         1038  +#    define PRJ_LIBS before including rules.rc if additional libs are needed
   460   1039   
   461   1040   OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
   462   1041   
   463   1042   !if $(TCL_MEM_DEBUG)
   464   1043   OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
   465   1044   !endif
   466   1045   !if $(TCL_COMPILE_DEBUG)
................................................................................
   475   1054   !if $(STATIC_BUILD)
   476   1055   OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
   477   1056   !endif
   478   1057   !if $(TCL_NO_DEPRECATED)
   479   1058   OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
   480   1059   !endif
   481   1060   
         1061  +!if $(USE_STUBS)
         1062  +# Note we do not define USE_TCL_STUBS even when building tk since some
         1063  +# test targets in tk do not use stubs
         1064  +!if "$(PROJECT)" != "tcl"
         1065  +USE_STUBS_DEFS  = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS
         1066  +!ifdef PROJECT_REQUIRES_TK
         1067  +USE_STUBS_DEFS  = $(USE_STUBS_DEFS) -DUSE_TK_STUBS
         1068  +!endif
         1069  +!endif
         1070  +!endif # USE_STUBS
         1071  +
   482   1072   !if !$(DEBUG)
   483   1073   OPTDEFINES	= $(OPTDEFINES) -DNDEBUG
   484   1074   !if $(OPTIMIZING)
   485   1075   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
   486   1076   !endif
   487   1077   !endif
   488   1078   !if $(PROFILE)
   489   1079   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
   490   1080   !endif
   491         -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
         1081  +!if "$(MACHINE)" == "AMD64"
   492   1082   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
   493   1083   !endif
   494   1084   !if $(VCVERSION) < 1300
   495   1085   OPTDEFINES	= $(OPTDEFINES) -DNO_STRTOI64
   496   1086   !endif
   497   1087   
   498         -#----------------------------------------------------------
   499         -# Locate the Tcl headers to build against
   500         -#----------------------------------------------------------
   501         -
   502         -!if "$(PROJECT)" == "tcl"
   503         -
   504         -_TCL_H          = ..\generic\tcl.h
   505         -
         1088  +# UNICODE - Use the wide char Windows API.
         1089  +# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
         1090  +COMPILERFLAGS  = /DUNICODE /D_UNICODE /D_ATL_XP_TARGETING
         1091  +
         1092  +# crt picks the C run time based on selected OPTS
         1093  +!if $(MSVCRT)
         1094  +!if $(DEBUG) && !$(UNCHECKED)
         1095  +crt = -MDd
         1096  +!else
         1097  +crt = -MD
         1098  +!endif
         1099  +!else
         1100  +!if $(DEBUG) && !$(UNCHECKED)
         1101  +crt = -MTd
         1102  +!else
         1103  +crt = -MT
         1104  +!endif
         1105  +!endif
         1106  +
         1107  +# cdebug includes compiler options for debugging as well as optimization.
         1108  +!if $(DEBUG)
         1109  +
         1110  +# In debugging mode, optimizations need to be disabled
         1111  +cdebug = -Zi -Od $(DEBUGFLAGS)
         1112  +
         1113  +!else
         1114  +
         1115  +cdebug = $(OPTIMIZATIONS)
         1116  +!if $(SYMBOLS)
         1117  +cdebug = $(cdebug) -Zi
         1118  +!endif
         1119  +
         1120  +!endif # $(DEBUG)
         1121  +
         1122  +# cwarn includes default warning levels.
         1123  +cwarn = $(WARNINGS)
         1124  +
         1125  +!if "$(MACHINE)" == "AMD64"
         1126  +# Disable pointer<->int warnings related to cast between different sizes
         1127  +# There are a gadzillion of these due to use of ClientData and
         1128  +# clutter up compiler
         1129  +# output increasing chance of a real warning getting lost. So disable them.
         1130  +# Eventually some day, Tcl will be 64-bit clean.
         1131  +cwarn = $(cwarn) -wd4311 -wd4312
         1132  +!endif
         1133  +
         1134  +!if $(DEBUG)
         1135  +# Turn warnings into errors
         1136  +cwarn = $(cwarn) -WX
         1137  +!endif
         1138  +
         1139  +# These flags are defined roughly in the order of the pre-reform
         1140  +# rules.vc/makefile.vc to help visually compare that the pre- and
         1141  +# post-reform build logs
         1142  +
         1143  +# cflags contains generic flags used for building practically all object files
         1144  +cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug)
         1145  +
         1146  +# appcflags contains $(cflags) and flags for building the application
         1147  +# object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus
         1148  +# flags used for building shared object files The two differ in the
         1149  +# BUILD_$(PROJECT) macro which should be defined only for the shared
         1150  +# library *implementation* and not for its caller interface
         1151  +
         1152  +appcflags = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS)
         1153  +appcflags_nostubs = $(cflags) $(crt) $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES)
         1154  +pkgcflags = $(appcflags) -DBUILD_$(PROJECT)
         1155  +pkgcflags_nostubs = $(appcflags_nostubs) -DBUILD_$(PROJECT)
         1156  +
         1157  +# stubscflags contains $(cflags) plus flags used for building a stubs
         1158  +# library for the package.  Note: -DSTATIC_BUILD is defined in
         1159  +# $(OPTDEFINES) only if the OPTS configuration indicates a static
         1160  +# library. However the stubs library is ALWAYS static hence included
         1161  +# here irrespective of the OPTS setting.
         1162  +
         1163  +stubscflags = $(cflags) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES)
         1164  +
         1165  +# Link flags 
         1166  +
         1167  +!if $(DEBUG)
         1168  +ldebug	= -debug -debugtype:cv
         1169  +!else
         1170  +ldebug	= -release -opt:ref -opt:icf,3
         1171  +!if $(SYMBOLS)
         1172  +ldebug	= $(ldebug) -debug -debugtype:cv
         1173  +!endif
         1174  +!endif
         1175  +
         1176  +# Note: Profiling is currently only possible with the Visual Studio Enterprise
         1177  +!if $(PROFILE)
         1178  +ldebug= $(ldebug) -profile
         1179  +!endif
         1180  +
         1181  +### Declarations common to all linker versions 
         1182  +lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
         1183  +
         1184  +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
         1185  +lflags	= $(lflags) -nodefaultlib:libucrt.lib
         1186  +!endif
         1187  +
         1188  +# Old linkers (Visual C++ 6 in particular) will link for fast loading
         1189  +# on Win98. Since we do not support Win98 any more, we specify nowin98
         1190  +# as recommended for NT and later. However, this is only required by
         1191  +# IX86 on older compilers and only needed if we are not doing a static build.
         1192  +
         1193  +!if "$(MACHINE)" == "IX86" && !$(STATIC_BUILD)
         1194  +!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)]
         1195  +# Align sections for PE size savings.
         1196  +lflags	= $(lflags) -opt:nowin98
         1197  +!endif
         1198  +!endif
         1199  +
         1200  +!if $(LOIMPACT)
         1201  +lflags	= $(lflags) -ws:aggressive
         1202  +!endif
         1203  +
         1204  +dlllflags = $(lflags) -dll
         1205  +conlflags = $(lflags) -subsystem:console
         1206  +guilflags = $(lflags) -subsystem:windows
         1207  +
         1208  +# Libraries that are required for every image.
         1209  +# Extensions should define any additional libraries with $(PRJ_LIBS)
         1210  +winlibs   = kernel32.lib advapi32.lib
         1211  +
         1212  +# Avoid 'unresolved external symbol __security_cookie' errors.
         1213  +# c.f. http://support.microsoft.com/?id=894573
         1214  +!if "$(MACHINE)" == "AMD64"
         1215  +!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
         1216  +winlibs   = $(winlibs) bufferoverflowU.lib
         1217  +!endif
         1218  +!endif
         1219  +
         1220  +baselibs = $(winlibs) $(PRJ_LIBS)
         1221  +
         1222  +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
         1223  +baselibs   = $(baselibs) ucrt.lib
         1224  +!endif
         1225  +
         1226  +################################################################
         1227  +# 3. Define standard commands, common make targets and implicit rules
         1228  +
         1229  +MAKELIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@
         1230  +MAKEDLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) 
         1231  +
         1232  +!if $(STATIC_BUILD)
         1233  +MAKEBINCMD = $(MAKELIBCMD)
   506   1234   !else
         1235  +MAKEBINCMD = $(MAKEDLLCMD)
         1236  +!endif
         1237  +MAKECONCMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs)
         1238  +MAKEGUICMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs)
         1239  +MAKERESCMD  = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
         1240  +	    $(TCL_INCLUDES) \
         1241  +	    -d DEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
         1242  +	    -d TCL_THREADS=$(TCL_THREADS) \
         1243  +	    -d STATIC_BUILD=$(STATIC_BUILD) \
         1244  +	    $<
   507   1245   
   508         -# If INSTALLDIR set to tcl root dir then reset to the lib dir.
   509         -!if exist("$(_INSTALLDIR)\include\tcl.h")
   510         -_INSTALLDIR=$(_INSTALLDIR)\lib
         1246  +!ifndef DISABLE_DEFAULT_TARGETS
         1247  +
         1248  +!ifndef DEFAULT_BUILD_TARGET
         1249  +DEFAULT_BUILD_TARGET = all
   511   1250   !endif
   512   1251   
   513         -!if !defined(TCLDIR)
   514         -!if exist("$(_INSTALLDIR)\..\include\tcl.h")
   515         -TCLINSTALL	= 1
   516         -_TCLDIR		= $(_INSTALLDIR)\..
   517         -_TCL_H          = $(_INSTALLDIR)\..\include\tcl.h
   518         -TCLDIR          = $(_INSTALLDIR)\..
   519         -!else
   520         -MSG=^
   521         -Failed to find tcl.h.  Set the TCLDIR macro.
   522         -!error $(MSG)
   523         -!endif
   524         -!else
   525         -_TCLDIR	= $(TCLDIR:/=\)
   526         -!if exist("$(_TCLDIR)\include\tcl.h")
   527         -TCLINSTALL	= 1
   528         -_TCL_H          = $(_TCLDIR)\include\tcl.h
   529         -!elseif exist("$(_TCLDIR)\generic\tcl.h")
   530         -TCLINSTALL	= 0
   531         -_TCL_H          = $(_TCLDIR)\generic\tcl.h
   532         -!else
   533         -MSG =^
   534         -Failed to find tcl.h.  The TCLDIR macro does not appear correct.
   535         -!error $(MSG)
   536         -!endif
   537         -!endif
         1252  +default_target: $(DEFAULT_BUILD_TARGET)
         1253  +
         1254  +setup:
         1255  +	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
         1256  +	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
         1257  +
         1258  +clean:
         1259  +	@echo Cleaning $(TMP_DIR)\* ...
         1260  +	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
         1261  +	@echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ...
         1262  +	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
         1263  +	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
         1264  +	@echo Cleaning $(WINDIR)\_junk.pch ...
         1265  +	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
         1266  +	@echo Cleaning $(WINDIR)\vercl.x, vercl.i ...
         1267  +	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
         1268  +	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
         1269  +	@echo Cleaning $(WINDIR)\versions.vc, version.vc ...
         1270  +	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
         1271  +	@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
         1272  +
         1273  +realclean: hose
         1274  +
         1275  +hose:
         1276  +	@echo Hosing $(OUT_DIR)\* ...
         1277  +	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
         1278  +
   538   1279   !endif
   539   1280   
   540         -#--------------------------------------------------------------
   541         -# Extract various version numbers from tcl headers
   542         -# The generated file is then included in the makefile.
   543         -#--------------------------------------------------------------
         1281  +!ifndef DISABLE_IMPLICIT_RULES
         1282  +# Implicit rule definitions - only for building library objects. For stubs and
         1283  +# main application, the master makefile should define explicit rules.
         1284  +
         1285  +{$(WINDIR)}.c{$(TMP_DIR)}.obj::
         1286  +	$(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
         1287  +$<
         1288  +<<
         1289  +
         1290  +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
         1291  +	$(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
         1292  +$<
         1293  +<<
         1294  +
         1295  +{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
         1296  +	$(cc32) $(pkgcflags) -Fo$(TMP_DIR)\ @<<
         1297  +$<
         1298  +<<
         1299  +
         1300  +{$(RCDIR)}.rc{$(TMP_DIR)}.res:
         1301  +	$(MAKERESCMD)
         1302  +	
         1303  +{$(WINDIR)}.rc{$(TMP_DIR)}.res:
         1304  +	$(MAKERESCMD)
   544   1305   
   545         -!if [echo REM = This file is generated from rules.vc > versions.vc]
   546         -!endif
   547         -!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
   548         -   && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
   549         -!endif
   550         -!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
   551         -   && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
   552         -!endif
   553         -!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
   554         -   && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
         1306  +.SUFFIXES:
         1307  +.SUFFIXES:.c .rc
         1308  +
   555   1309   !endif
   556   1310   
   557         -# If building the tcl core then we need additional package versions
   558         -!if "$(PROJECT)" == "tcl"
   559         -!if [echo PKG_HTTP_VER = \>> versions.vc] \
   560         -   && [nmakehlp -V ..\library\http\pkgIndex.tcl http >> versions.vc]
   561         -!endif
   562         -!if [echo PKG_TCLTEST_VER = \>> versions.vc] \
   563         -   && [nmakehlp -V ..\library\tcltest\pkgIndex.tcl tcltest >> versions.vc]
   564         -!endif
   565         -!if [echo PKG_MSGCAT_VER = \>> versions.vc] \
   566         -   && [nmakehlp -V ..\library\msgcat\pkgIndex.tcl msgcat >> versions.vc]
   567         -!endif
   568         -!if [echo PKG_PLATFORM_VER = \>> versions.vc] \
   569         -   && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform " >> versions.vc]
   570         -!endif
   571         -!if [echo PKG_SHELL_VER = \>> versions.vc] \
   572         -   && [nmakehlp -V ..\library\platform\pkgIndex.tcl "platform::shell" >> versions.vc]
   573         -!endif
   574         -!if [echo PKG_DDE_VER = \>> versions.vc] \
   575         -   && [nmakehlp -V ..\library\dde\pkgIndex.tcl "dde " >> versions.vc]
   576         -!endif
   577         -!if [echo PKG_REG_VER =\>> versions.vc] \
   578         -   && [nmakehlp -V ..\library\reg\pkgIndex.tcl registry >> versions.vc]
   579         -!endif
   580         -!endif
   581         -
   582         -!include versions.vc
   583         -
   584         -#--------------------------------------------------------------
   585         -# Setup tcl version dependent stuff headers
   586         -#--------------------------------------------------------------
   587         -
         1311  +################################################################
         1312  +# 14. Sanity check selected options against Tcl build options
         1313  +# When building an extension, certain configuration options should
         1314  +# match the ones used when Tcl was built. Here we check and
         1315  +# warn on a mismatch.
   588   1316   !if "$(PROJECT)" != "tcl"
   589   1317   
   590         -TCL_VERSION	= $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
         1318  +!if $(TCLINSTALL) # Building against an installed Tcl
         1319  +!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake")
         1320  +TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake"
         1321  +!endif
         1322  +!else # ! $(TCLINSTALL) - building against Tcl source
         1323  +!if exist("$(OUT_DIR)\tcl.nmake")
         1324  +TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake"
         1325  +!endif
         1326  +!endif # TCLINSTALL
         1327  +
         1328  +!if $(CONFIG_CHECK)
         1329  +!ifdef TCLNMAKECONFIG
         1330  +!include $(TCLNMAKECONFIG)
   591   1331   
   592         -!if $(TCLINSTALL)
   593         -TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
   594         -!if !exist($(TCLSH)) && $(TCL_THREADS)
   595         -TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION).exe"
         1332  +!if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)"
         1333  +!error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)).
   596   1334   !endif
   597         -TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
   598         -TCLIMPLIB	= "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
   599         -TCL_LIBRARY	= $(_TCLDIR)\lib
   600         -TCLREGLIB	= "$(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib"
   601         -TCLDDELIB	= "$(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib"
   602         -COFFBASE	= \must\have\tcl\sources\to\build\this\target
   603         -TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
   604         -TCL_INCLUDES    = -I"$(_TCLDIR)\include"
   605         -!else
   606         -TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
   607         -!if !exist($(TCLSH)) && $(TCL_THREADS)
   608         -TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION).exe"
         1335  +!if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC)
         1336  +!message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)).
   609   1337   !endif
   610         -TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
   611         -TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
   612         -TCL_LIBRARY	= $(_TCLDIR)\library
   613         -TCLREGLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib"
   614         -TCLDDELIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib"
   615         -COFFBASE	= "$(_TCLDIR)\win\coffbase.txt"
   616         -TCLTOOLSDIR	= $(_TCLDIR)\tools
   617         -TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
   618         -!endif
   619         -
   620         -!endif
   621         -
   622         -#-------------------------------------------------------------------------
   623         -# Locate the Tk headers to build against
   624         -#-------------------------------------------------------------------------
   625         -
   626         -!if "$(PROJECT)" == "tk"
   627         -_TK_H          = ..\generic\tk.h
   628         -_INSTALLDIR    = $(_INSTALLDIR)\..
   629         -!endif
   630         -
   631         -!ifdef PROJECT_REQUIRES_TK
   632         -!if !defined(TKDIR)
   633         -!if exist("$(_INSTALLDIR)\..\include\tk.h")
   634         -TKINSTALL      = 1
   635         -_TKDIR         = $(_INSTALLDIR)\..
   636         -_TK_H          = $(_TKDIR)\include\tk.h
   637         -TKDIR          = $(_TKDIR)
   638         -!elseif exist("$(_TCLDIR)\include\tk.h")
   639         -TKINSTALL      = 1
   640         -_TKDIR         = $(_TCLDIR)
   641         -_TK_H          = $(_TKDIR)\include\tk.h
   642         -TKDIR          = $(_TKDIR)
   643         -!endif
   644         -!else
   645         -_TKDIR = $(TKDIR:/=\)
   646         -!if exist("$(_TKDIR)\include\tk.h")
   647         -TKINSTALL      = 1
   648         -_TK_H          = $(_TKDIR)\include\tk.h
   649         -!elseif exist("$(_TKDIR)\generic\tk.h")
   650         -TKINSTALL      = 0
   651         -_TK_H          = $(_TKDIR)\generic\tk.h
   652         -!else
   653         -MSG =^
   654         -Failed to find tk.h. The TKDIR macro does not appear correct.
   655         -!error $(MSG)
   656         -!endif
         1338  +!if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG)
         1339  +!message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)).
   657   1340   !endif
   658   1341   !endif
   659   1342   
   660         -#-------------------------------------------------------------------------
   661         -# Extract Tk version numbers
   662         -#-------------------------------------------------------------------------
         1343  +!endif # TCLNMAKECONFIG
   663   1344   
   664         -!if defined(PROJECT_REQUIRES_TK) || "$(PROJECT)" == "tk"
         1345  +!endif # $(PROJECT) ==  "tcl"
   665   1346   
   666         -!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
   667         -   && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
   668         -!endif
   669         -!if [echo TK_MINOR_VERSION = \>> versions.vc] \
   670         -   && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
   671         -!endif
   672         -!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
   673         -   && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
   674         -!endif
   675         -
   676         -!include versions.vc
   677         -
   678         -TK_DOTVERSION	= $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
   679         -TK_VERSION	= $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
   680         -
   681         -!if "$(PROJECT)" != "tk"
   682         -!if $(TKINSTALL)
   683         -WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe"
   684         -TKSTUBLIB	= "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib"
   685         -TKIMPLIB	= "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib"
   686         -TK_INCLUDES     = -I"$(_TKDIR)\include"
   687         -!else
   688         -WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe"
   689         -TKSTUBLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib"
   690         -TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib"
   691         -TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
   692         -!endif
   693         -!endif
   694         -
   695         -!endif
   696   1347   
   697   1348   #----------------------------------------------------------
   698   1349   # Display stats being used.
   699   1350   #----------------------------------------------------------
   700   1351   
   701   1352   !message *** Intermediate directory will be '$(TMP_DIR)'
   702   1353   !message *** Output directory will be '$(OUT_DIR)'
   703   1354   !message *** Suffix for binaries will be '$(SUFX)'
   704   1355   !message *** Optional defines are '$(OPTDEFINES)'
   705   1356   !message *** Compiler version $(VCVER). Target machine is $(MACHINE)
   706   1357   !message *** Host architecture is $(NATIVE_ARCH)
   707         -!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
   708         -!message *** Link options '$(LINKERFLAGS)'
   709   1358   
   710         -!endif
         1359  +!endif # ifdef _RULES_VC