3D Canvas

Check-in [6b993a10a9]
Login

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

Overview
Comment:Updated nmake build files to modernized versions.
Timelines: family | ancestors | descendants | both | vc-reform
Files: files | file ages | folders
SHA1: 6b993a10a9d2cb36cd4620aa0d1d03aa84703354
User & Date: apnadkarni 2017-11-19 06:34:19
Context
2017-11-19
06:34
Fix some macro redefinition warnings check-in: 5395703856 user: apnadkarni tags: vc-reform
06:34
Updated nmake build files to modernized versions. check-in: 6b993a10a9 user: apnadkarni tags: vc-reform
2017-11-18
15:22
Create new branch named "vc-reform" check-in: d496187ce5 user: apnadkarni tags: vc-reform
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to win/makefile.vc.

     1      1   #------------------------------------------------------------- -*- makefile -*-
     2         -# makefile.vc --
     3      2   #
     4         -#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
            3  +# Makefile for tktreectrl
     5      4   #
     6         -# This makefile is based upon the Tcl 8.6 Makefile.vc and modified to
     7         -# make it suitable as a general package makefile. Look for the word EDIT
     8         -# which marks sections that may need modification. As a minumum you will
     9         -# need to change the PROJECT, DOTVERSION and DLLOBJS variables to values
    10         -# relevant to your package.
            5  +# Basic build, test and install
            6  +#   nmake /f makefile.vc INSTALLDIR=c:\tcl TCLDIR=c:\path\to\tcl\sources TKDIR=c:\path\to\tk\sources
            7  +#   nmake /f makefile.vc INSTALLDIR=c:\tcl test TCLDIR=c:\path\to\tcl\sources TKDIR=c:\path\to\tk\sources
            8  +#   nmake /f makefile.vc INSTALLDIR=c:\tcl install TCLDIR=c:\path\to\tcl\sources TKDIR=c:\path\to\tk\sources
            9  +# Note this extension needs both Tcl and Tk *source* to build.
    11     10   #
           11  +# For other build options (debug, static etc.),
           12  +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
           13  +# detailed documentation.
           14  +# 
    12     15   # See the file "license.terms" for information on usage and redistribution
    13     16   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    14     17   #
    15         -# Copyright (c) 1995-1996 Sun Microsystems, Inc.
    16         -# Copyright (c) 1998-2000 Ajuba Solutions.
    17         -# Copyright (c) 2001-2005 ActiveState Corporation.
    18         -# Copyright (c) 2001-2004 David Gravereaux.
    19         -# Copyright (c) 2003-2008 Pat Thoyts.
    20     18   #------------------------------------------------------------------------------
    21     19   
    22         -# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
    23         -# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
    24         -!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
    25         -MSG = ^
    26         -You need to run vcvars32.bat from Developer Studio or setenv.bat from the^
    27         -Platform SDK first to setup the environment.  Jump to this line to read^
    28         -the build instructions.
    29         -!error $(MSG)
           20  +
           21  +PROJECT = Canvas3d
           22  +NEED_TK_SOURCE = 1
           23  +NEED_TCL_SOURCE = 1
           24  +DEMODIR = ..\demo
           25  +
           26  +!include "rules-ext.vc"
           27  +
           28  +PRJ_OBJS	=  \
           29  +	$(TMP_DIR)\c3dmain.obj \
           30  +	$(TMP_DIR)\c3dsearch.obj \
           31  +	$(TMP_DIR)\c3dtransform.obj \
           32  +	$(TMP_DIR)\c3ditem.obj \
           33  +	$(TMP_DIR)\c3dpolygon.obj \
           34  +	$(TMP_DIR)\c3dlight.obj \
           35  +	$(TMP_DIR)\c3drectangle.obj \
           36  +	$(TMP_DIR)\c3dtext.obj \
           37  +	$(TMP_DIR)\c3dcamera.obj \
           38  +	$(TMP_DIR)\c3dline.obj \
           39  +	$(TMP_DIR)\c3doptions.obj \
           40  +	$(TMP_DIR)\c3dres.obj \
           41  +	$(TMP_DIR)\c3dWinMain.obj
           42  +
           43  +!if [echo PACKAGE_PATCHLEVEL = \> versions.vc] && \
           44  +    [nmakehlp -V $(ROOT)\configure.ac PACKAGE_PATCHLEVEL >> versions.vc]
    30     45   !endif
           46  +!include versions.vc
           47  +
           48  +PRJ_DEFINES	=  -DHAVE_INTPTR_T=1 -DNO_VIZ=/\*\*/ -DPACKAGE_PATCHLEVEL=\"$(PACKAGE_PATCHLEVEL)\" -D_CRT_SECURE_NO_WARNINGS
           49  +
           50  +PRJ_LIBS = opengl32.lib glu32.lib
           51  +
           52  +!include "$(_RULESDIR)\targets.vc"
    31     53   
    32         -#------------------------------------------------------------------------------
    33         -# HOW TO USE this makefile:
    34         -#
    35         -# 1)  It is now necessary to have MSVCDir, MSDevDir or MSSDK set in the
    36         -#     environment.  This is used as a check to see if vcvars32.bat had been
    37         -#     run prior to running nmake or during the installation of Microsoft
    38         -#     Visual C++, MSVCDir had been set globally and the PATH adjusted.
    39         -#     Either way is valid.
    40         -#
    41         -#     You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
    42         -#     directory to setup the proper environment, if needed, for your
    43         -#     current setup.  This is a needed bootstrap requirement and allows the
    44         -#     swapping of different environments to be easier.
    45         -#
    46         -# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
    47         -#     vcvars32.bat according to the instructions for it.  This can also
    48         -#     turn on the 64-bit compiler, if your SDK has it.
    49         -#
    50         -# 3)  Targets are:
    51         -#	all       -- Builds everything.
    52         -#	<project> -- Builds the project (eg: nmake sample)
    53         -#	test      -- Builds and runs the test suite.
    54         -#	install   -- Installs the built binaries and libraries to $(INSTALLDIR)
    55         -#		     in an appropriate subdirectory.
    56         -#	clean/realclean/distclean -- varying levels of cleaning.
    57         -#
    58         -# 4)  Macros usable on the commandline:
    59         -#	INSTALLDIR=<path>
    60         -#		Sets where to install Tcl from the built binaries.
    61         -#		C:\Progra~1\Tcl is assumed when not specified.
    62         -#
    63         -#	OPTS=loimpact,msvcrt,nothreads,pdbs,profile,static,symbols,unchecked,none
    64         -#		Sets special options for the core.  The default is for none.
    65         -#		Any combination of the above may be used (comma separated).
    66         -#		'none' will over-ride everything to nothing.
    67         -#
    68         -#		loimpact = Adds a flag for how NT treats the heap to keep memory
    69         -#			   in use, low.  This is said to impact alloc performance.
    70         -#		msvcrt   = Affects the static option only to switch it from
    71         -#			   using libcmt(d) as the C runtime [by default] to
    72         -#			   msvcrt(d). This is useful for static embedding
    73         -#			   support.
    74         -#		nothreads = Turns off multithreading support (not recommended)
    75         -#		static  =  Builds a static library of the core instead of a
    76         -#			   dll.  The shell will be static (and large), as well.
    77         -#		pdbs     = Build detached symbols for release builds.
    78         -#		profile  = Adds profiling hooks.  Map file is assumed.
    79         -#		symbols  = Debug build. Links to the debug C runtime, disables
    80         -#			   optimizations and creates pdb symbols files.
    81         -#		unchecked= Allows a symbols build to not use the debug
    82         -#			   enabled runtime (msvcrt.dll not msvcrtd.dll
    83         -#			   or libcmt.lib not libcmtd.lib).
    84         -#
    85         -#	STATS=compdbg,memdbg,none
    86         -#		Sets optional memory and bytecode compiler debugging code added
    87         -#		to the core.  The default is for none.  Any combination of the
    88         -#		above may be used (comma separated).  'none' will over-ride
    89         -#		everything to nothing.
    90         -#
    91         -#		compdbg  = Enables byte compilation logging.
    92         -#		memdbg   = Enables the debugging memory allocator.
    93         -#
    94         -#	CHECKS=64bit,fullwarn,nodep,none
    95         -#		Sets special macros for checking compatability.
    96         -#
    97         -#		64bit    = Enable 64bit portability warnings (if available)
    98         -#		fullwarn = Builds with full compiler and link warnings enabled.
    99         -#			    Very verbose.
   100         -#		nodep	 = Turns off compatability macros to ensure the extension
   101         -#			    isn't being built with deprecated functions.
   102         -#
   103         -#	MACHINE=(ALPHA|AMD64|IA64|IX86)
   104         -#		Set the machine type used for the compiler, linker, and
   105         -#		resource compiler.  This hook is needed to tell the tools
   106         -#		when alternate platforms are requested.  IX86 is the default
   107         -#		when not specified. If the CPU environment variable has been
   108         -#		set (ie: recent Platform SDK) then MACHINE is set from CPU.
   109         -#
   110         -#	TMP_DIR=<path>
   111         -#	OUT_DIR=<path>
   112         -#		Hooks to allow the intermediate and output directories to be
   113         -#		changed.  $(OUT_DIR) is assumed to be
   114         -#		$(BINROOT)\(Release|Debug) based on if symbols are requested.
   115         -#		$(TMP_DIR) will de $(OUT_DIR)\<buildtype> by default.
   116         -#
   117         -#	TESTPAT=<file>
   118         -#		Reads the tests requested to be run from this file.
   119         -#
   120         -# 5)  Examples:
   121         -#
   122         -#	Basic syntax of calling nmake looks like this:
   123         -#	nmake [-nologo] -f makefile.vc [target|macrodef [target|macrodef] [...]]
   124         -#
   125         -#                        Standard (no frills)
   126         -#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
   127         -#       Setting environment for using Microsoft Visual C++ tools.
   128         -#       c:\tcl_src\win\>nmake -f makefile.vc all
   129         -#       c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
   130         -#
   131         -#                         Building for Win64
   132         -#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
   133         -#       Setting environment for using Microsoft Visual C++ tools.
   134         -#       c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
   135         -#       Targeting Windows pre64 RETAIL
   136         -#       c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64
   137         -#
   138         -#------------------------------------------------------------------------------
   139         -#==============================================================================
   140         -#------------------------------------------------------------------------------
           54  +install: default-install-docs-html default-install-demos
   141     55   
   142         -!if !exist("makefile.vc")
   143         -MSG = ^
   144         -You must run this makefile only from the directory it is in.^
   145         -Please `cd` to its location first.
   146         -!error $(MSG)
   147         -!endif
   148         -
   149         -#-------------------------------------------------------------------------
   150         -# Project specific information (EDIT)
   151         -#
   152         -# You should edit this with the name and version of your project. This
   153         -# information is used to generate the name of the package library and
   154         -# it's install location.
   155         -#
   156         -# For example, the sample extension is  going to build sample05.dll and
   157         -# would install it into $(INSTALLDIR)\lib\sample05
   158         -#
   159         -# You need to specify the object files that need to be linked into your
   160         -# binary here.
   161         -#
   162         -#-------------------------------------------------------------------------
   163         -
   164         -PROJECT = sample
   165         -
   166         -# Uncomment the following line if this is a Tk extension.
   167         -PROJECT_REQUIRES_TK=1
   168         -!include "rules.vc"
   169         -
   170         -# nmakehelp -V <file> <tag> will search the file for tag, skips until a
   171         -#	number and returns all character until a character not in [0-9.ab]
   172         -#	is read.
   173         -
   174         -!if [echo REM = This file is generated from Makefile.vc > versions.vc]
   175         -!endif
   176         -# get project version from row "AC_INIT([project], [????])"
   177         -!if [echo DOTVERSION = \>> versions.vc] \
   178         -   && [nmakehlp -V ..\configure.in sample >> versions.vc]
   179         -!endif
   180         -!include "versions.vc"
   181         -
   182         -VERSION         = $(DOTVERSION:.=)
   183         -STUBPREFIX      = $(PROJECT)stub
   184         -
   185         -DLLOBJS = \
   186         -	$(TMP_DIR)\tclsample.obj \
   187         -	$(TMP_DIR)\sample.obj \
   188         -!if !$(STATIC_BUILD)
   189         -	$(TMP_DIR)\sample.res
   190         -!endif
   191         -
   192         -PRJHEADERS =
   193         -
   194         -#-------------------------------------------------------------------------
   195         -# Target names and paths ( shouldn't need changing )
   196         -#-------------------------------------------------------------------------
   197         -
   198         -BINROOT		= $(MAKEDIR)
   199         -ROOT            = $(MAKEDIR)\..
   200         -
   201         -PRJIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
   202         -PRJLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
   203         -PRJLIB		= $(OUT_DIR)\$(PRJLIBNAME)
   204         -
   205         -PRJSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
   206         -PRJSTUBLIB	= $(OUT_DIR)\$(PRJSTUBLIBNAME)
   207         -
   208         -### Make sure we use backslash only.
   209         -PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
   210         -LIB_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   211         -BIN_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   212         -DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
   213         -SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)
   214         -INCLUDE_INSTALL_DIR	= $(_TCLDIR)\include
   215         -
   216         -### The following paths CANNOT have spaces in them.
   217         -GENERICDIR	= $(ROOT)\generic
   218         -WINDIR		= $(ROOT)\win
   219         -LIBDIR          = $(ROOT)\library
   220         -DOCDIR		= $(ROOT)\doc
   221         -TOOLSDIR	= $(ROOT)\tools
   222         -COMPATDIR	= $(ROOT)\compat
   223         -
   224         -#---------------------------------------------------------------------
   225         -# Compile flags
   226         -#---------------------------------------------------------------------
   227         -
   228         -!if !$(DEBUG)
   229         -!if $(OPTIMIZING)
   230         -### This cranks the optimization level to maximize speed
   231         -cdebug	= $(OPTIMIZATIONS)
   232         -!else
   233         -cdebug	=
   234         -!endif
   235         -!else if "$(MACHINE)" == "IA64"
   236         -### Warnings are too many, can't support warnings into errors.
   237         -cdebug	= -Zi -Od $(DEBUGFLAGS)
   238         -!else
   239         -cdebug	= -Zi -WX $(DEBUGFLAGS)
   240         -!endif
   241         -
   242         -### Declarations common to all compiler options
   243         -cwarn = $(WARNINGS) -D _CRT_SECURE_NO_DEPRECATE -D _CRT_NONSTDC_NO_DEPRECATE
   244         -cflags = -nologo -c $(COMPILERFLAGS) $(cwarn) -Fp$(TMP_DIR)^\
   245         -
   246         -!if $(MSVCRT)
   247         -!if $(DEBUG) && !$(UNCHECKED)
   248         -crt = -MDd
   249         -!else
   250         -crt = -MD
   251         -!endif
   252         -!else
   253         -!if $(DEBUG) && !$(UNCHECKED)
   254         -crt = -MTd
   255         -!else
   256         -crt = -MT
   257         -!endif
   258         -!endif
   259         -
   260         -cflags = $(cflags) -DMODULE_SCOPE=extern
   261         -
   262         -!if !$(STATIC_BUILD)
   263         -cflags = $(cflags) -DUSE_TCL_STUBS
   264         -!if defined(TKSTUBLIB)
   265         -cflags = $(cflags) -DUSE_TK_STUBS
   266         -!endif
   267         -!endif
   268         -
   269         -INCLUDES	= $(TCL_INCLUDES) -I"$(WINDIR)" -I"$(GENERICDIR)"
   270         -BASE_CFLAGS	= $(cflags) $(cdebug) $(crt) $(INCLUDES)
   271         -CON_CFLAGS	= $(cflags) $(cdebug) $(crt) -DCONSOLE
   272         -TCL_CFLAGS	= -DPACKAGE_NAME="\"$(PROJECT)\"" \
   273         -		  -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
   274         -		  -DBUILD_$(PROJECT) \
   275         -		  $(BASE_CFLAGS) $(OPTDEFINES)
   276         -
   277         -#---------------------------------------------------------------------
   278         -# Link flags
   279         -#---------------------------------------------------------------------
   280         -
   281         -!if $(DEBUG)
   282         -ldebug	= -debug -debugtype:cv
   283         -!if $(MSVCRT)
   284         -ldebug = $(ldebug) -nodefaultlib:msvcrt
   285         -!endif
   286         -!else
   287         -ldebug	= -release -opt:ref -opt:icf,3
   288         -!endif
   289         -
   290         -### Declarations common to all linker options
   291         -lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
   292         -
   293         -!if $(PROFILE)
   294         -lflags	= $(lflags) -profile
   295         -!endif
   296         -
   297         -!if $(ALIGN98_HACK) && !$(STATIC_BUILD)
   298         -### Align sections for PE size savings.
   299         -lflags	= $(lflags) -opt:nowin98
   300         -!else if !$(ALIGN98_HACK) && $(STATIC_BUILD)
   301         -### Align sections for speed in loading by choosing the virtual page size.
   302         -lflags	= $(lflags) -align:4096
   303         -!endif
   304         -
   305         -!if $(LOIMPACT)
   306         -lflags	= $(lflags) -ws:aggressive
   307         -!endif
   308         -
   309         -dlllflags = $(lflags) -dll
   310         -conlflags = $(lflags) -subsystem:console
   311         -guilflags = $(lflags) -subsystem:windows
   312         -!if !$(STATIC_BUILD)
   313         -baselibs  = $(TCLSTUBLIB)
   314         -!if defined(TKSTUBLIB)
   315         -baselibs  = $(baselibs) $(TKSTUBLIB)
   316         -!endif
   317         -!endif
   318         -
   319         -# Avoid 'unresolved external symbol __security_cookie' errors.
   320         -# c.f. http://support.microsoft.com/?id=894573
   321         -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
   322         -!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
   323         -baselibs   = $(baselibs) bufferoverflowU.lib
   324         -!endif
   325         -!endif
   326         -
   327         -baselibs   = $(baselibs) user32.lib gdi32.lib
   328         -
   329         -#---------------------------------------------------------------------
   330         -# TclTest flags
   331         -#---------------------------------------------------------------------
   332         -
   333         -!if "$(TESTPAT)" != ""
   334         -TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
   335         -!endif
   336         -
   337         -#---------------------------------------------------------------------
   338         -# Project specific targets (EDIT)
   339         -#---------------------------------------------------------------------
   340         -
   341         -all:	    setup $(PROJECT)
   342         -$(PROJECT): setup pkgIndex $(PRJLIB)
   343         -install:    install-binaries install-libraries install-docs
   344         -pkgIndex:   $(OUT_DIR)\pkgIndex.tcl
   345         -
   346         -test: setup $(PROJECT)
   347         -	@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
   348         -	@set TCLLIBPATH=$(OUT_DIR_PATH:\=/)
   349         -!if $(TCLINSTALL)
   350         -	@set PATH=$(_TCLDIR)\bin;$(PATH)
   351         -!else
   352         -	@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
   353         -!endif
   354         -!if "$(OS)" == "Windows_NT"  || "$(MSVCDIR)" == "IDE"
   355         -	$(DEBUGGER) $(TCLSH) "$(ROOT)/tests/all.tcl" $(TESTFLAGS)
   356         -!else
   357         -        @echo Please wait while the tests are collected...
   358         -        $(DEBUGGER) $(TCLSH) "$(ROOT)/tests/all.tcl" $(TESTFLAGS) > tests.log
   359         -	type tests.log | more
   360         -!endif
   361         -
   362         -shell: setup $(PROJECT)
   363         -	@set VLERQ_LIBRARY=$(LIBDIR:\=/)
   364         -	@set TCL_LIBRARY=$(TCL_LIBRARY:\=/)
   365         -	@set TCLLIBPATH=$(OUT_DIR_PATH:\=/)
   366         -!if $(TCLINSTALL)
   367         -	@set PATH=$(_TCLDIR)\bin;$(PATH)
   368         -!else
   369         -	@set PATH=$(_TCLDIR)\win\$(BUILDDIRTOP);$(PATH)
   370         -!endif
   371         -	$(DEBUGGER) $(TCLSH) $(SCRIPT)
   372         -
   373         -setup:
   374         -	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
   375         -	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
   376         -
   377         -# See <tcl>/win/coffbase.txt for extension base addresses.
   378         -$(PRJLIB): $(DLLOBJS)
   379         -!if $(STATIC_BUILD)
   380         -	$(lib32) -nologo -out:$@ @<<
   381         -$**
   382         -<<
   383         -!else
   384         -	$(link32) $(dlllflags) -base:@$(COFFBASE),thread -out:$@ $(baselibs) @<<
   385         -$**
   386         -<<
   387         -	$(_VC_MANIFEST_EMBED_DLL)
   388         -	-@del $*.exp
   389         -!endif
   390         -
   391         -$(PRJSTUBLIB): $(PRJSTUBOBJS)
   392         -	$(lib32) -nologo -out:$@ $(PRJSTUBOBJS)
   393         -
   394         -#---------------------------------------------------------------------
   395         -# Implicit rules
   396         -#---------------------------------------------------------------------
   397         -
   398         -{$(WINDIR)}.c{$(TMP_DIR)}.obj::
   399         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   400         -$<
   401         -<<
   402         -
   403         -{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
   404         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   405         -$<
   406         -<<
   407         -
   408         -{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
   409         -    $(cc32) $(TCL_CFLAGS) -DBUILD_$(PROJECT) -Fo$(TMP_DIR)\ @<<
   410         -$<
   411         -<<
   412         -
   413         -{$(WINDIR)}.rc{$(TMP_DIR)}.res:
   414         -	$(rc32) -fo $@ -r -i "$(GENERICDIR)" -D__WIN32__ \
   415         -		-DCOMMAVERSION=$(DOTVERSION:.=,),0 \
   416         -		-DDOTVERSION=\"$(DOTVERSION)\" \
   417         -		-DVERSION=\"$(VERSION)$(SUFX)\" \
   418         -!if $(DEBUG)
   419         -	-d DEBUG \
   420         -!endif
   421         -!if $(TCL_THREADS)
   422         -	-d TCL_THREADS \
   423         -!endif
   424         -!if $(STATIC_BUILD)
   425         -	-d STATIC_BUILD \
   426         -!endif
   427         -	$<
   428         -
   429         -.SUFFIXES:
   430         -.SUFFIXES:.c .rc
   431         -
   432         -#-------------------------------------------------------------------------
   433         -# Explicit dependency rules
   434         -#
   435         -#-------------------------------------------------------------------------
   436         -
   437         -$(OUT_DIR)\pkgIndex.tcl: $(ROOT)\pkgIndex.tcl.in
   438         -	@nmakehlp -s << $** > $@
   439         -@PACKAGE_VERSION@    $(DOTVERSION)
   440         -@PACKAGE_NAME@       $(PROJECT)
   441         -@PKG_LIB_FILE@       $(PRJLIBNAME)
   442         -<<
   443         -	@echo package ifneeded sample $(DOTVERSION) \
   444         -	    [list load [file join $$dir $(PRJLIBNAME)] Sample] >> $@
   445         -
   446         -#---------------------------------------------------------------------
   447         -# Installation. (EDIT)
   448         -#
   449         -# You may need to modify this section to reflect the final distribution
   450         -# of your files and possibly to generate documentation.
   451         -#
   452         -#---------------------------------------------------------------------
   453         -
   454         -install-binaries:
   455         -	@echo Installing binaries to '$(SCRIPT_INSTALL_DIR)'
   456         -	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
   457         -	@$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
   458         -
   459         -install-libraries: $(OUT_DIR)\pkgIndex.tcl
   460         -	@echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
   461         -	@if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
   462         -	@echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
   463         -	@$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR)
   464         -
   465         -install-docs:
   466         -	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
   467         -	@if exist $(DOCDIR) $(CPY) $(DOCDIR)\*.n "$(DOC_INSTALL_DIR)"
   468         -
   469         -#---------------------------------------------------------------------
   470         -# Clean up
   471         -#---------------------------------------------------------------------
   472         -
   473         -clean:
   474         -	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
   475         -	@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
   476         -	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
   477         -	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
   478         -	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
   479         -	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
   480         -
   481         -realclean: clean
   482         -	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
   483         -
   484         -distclean: realclean
   485         -	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
   486         -	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
           56  +pkgindex: default-pkgindex-tea

Changes to win/nmakehlp.c.

    39     39   #endif
    40     40   
    41     41   
    42     42   
    43     43   /* protos */
    44     44   
    45     45   static int CheckForCompilerFeature(const char *option);
    46         -static int CheckForLinkerFeature(const char *option);
           46  +static int CheckForLinkerFeature(const char **options, int count);
    47     47   static int IsIn(const char *string, const char *substring);
    48     48   static int SubstituteFile(const char *substs, const char *filename);
    49     49   static int QualifyPath(const char *path);
    50     50   static const char *GetVersionFromFile(const char *filename, const char *match, int numdots);
    51     51   static DWORD WINAPI ReadFromPipe(LPVOID args);
    52     52   
    53     53   /* globals */
................................................................................
    70     70   main(
    71     71       int argc,
    72     72       char *argv[])
    73     73   {
    74     74       char msg[300];
    75     75       DWORD dwWritten;
    76     76       int chars;
           77  +    char *s;
    77     78   
    78     79       /*
    79     80        * Make sure children (cl.exe and link.exe) are kept quiet.
    80     81        */
    81     82   
    82     83       SetErrorMode(SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX);
    83     84   
................................................................................
    98     99   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
    99    100   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   100    101   			&dwWritten, NULL);
   101    102   		return 2;
   102    103   	    }
   103    104   	    return CheckForCompilerFeature(argv[2]);
   104    105   	case 'l':
   105         -	    if (argc != 3) {
          106  +	    if (argc < 3) {
   106    107   		chars = snprintf(msg, sizeof(msg) - 1,
   107         -	       		"usage: %s -l <linker option>\n"
          108  +	       		"usage: %s -l <linker option> ?<mandatory option> ...?\n"
   108    109   			"Tests for whether link.exe supports an option\n"
   109    110   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   110    111   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   111    112   			&dwWritten, NULL);
   112    113   		return 2;
   113    114   	    }
   114         -	    return CheckForLinkerFeature(argv[2]);
          115  +	    return CheckForLinkerFeature(&argv[2], argc-2);
   115    116   	case 'f':
   116    117   	    if (argc == 2) {
   117    118   		chars = snprintf(msg, sizeof(msg) - 1,
   118    119   			"usage: %s -f <string> <substring>\n"
   119    120   			"Find a substring within another\n"
   120    121   			"exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   121    122   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
................................................................................
   149    150   		    "Extract a version from a file:\n"
   150    151   		    "eg: pkgIndex.tcl \"package ifneeded http\"",
   151    152   		    argv[0]);
   152    153   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
   153    154   		    &dwWritten, NULL);
   154    155   		return 0;
   155    156   	    }
   156         -	    printf("%s\n", GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0'));
   157         -	    return 0;
          157  +	    s = GetVersionFromFile(argv[2], argv[3], *(argv[1]+2) - '0');
          158  +	    if (s && *s) {
          159  +		printf("%s\n", s);
          160  +		return 0;
          161  +	    } else
          162  +		return 1; /* Version not found. Return non-0 exit code */
          163  +
   158    164   	case 'Q':
   159    165   	    if (argc != 3) {
   160    166   		chars = snprintf(msg, sizeof(msg) - 1,
   161    167   		    "usage: %s -Q path\n"
   162    168   		    "Emit the fully qualified path\n"
   163    169   		    "exitcodes: 0 == no, 1 == yes, 2 == error\n", argv[0]);
   164    170   		WriteFile(GetStdHandle(STD_ERROR_HANDLE), msg, chars,
................................................................................
   309    315                || strstr(Err.buffer, "D9002") != NULL
   310    316                || strstr(Out.buffer, "D2021") != NULL
   311    317                || strstr(Err.buffer, "D2021") != NULL);
   312    318   }
   313    319   
   314    320   static int
   315    321   CheckForLinkerFeature(
   316         -    const char *option)
          322  +    const char **options,
          323  +    int count)
   317    324   {
   318    325       STARTUPINFO si;
   319    326       PROCESS_INFORMATION pi;
   320    327       SECURITY_ATTRIBUTES sa;
   321    328       DWORD threadID;
   322    329       char msg[300];
   323    330       BOOL ok;
   324    331       HANDLE hProcess, h, pipeThreads[2];
   325         -    char cmdline[100];
          332  +    int i;
          333  +    char cmdline[255];
   326    334   
   327    335       hProcess = GetCurrentProcess();
   328    336   
   329    337       ZeroMemory(&pi, sizeof(PROCESS_INFORMATION));
   330    338       ZeroMemory(&si, sizeof(STARTUPINFO));
   331    339       si.cb = sizeof(STARTUPINFO);
   332    340       si.dwFlags   = STARTF_USESTDHANDLES;
................................................................................
   364    372   
   365    373       lstrcpy(cmdline, "link.exe -nologo ");
   366    374   
   367    375       /*
   368    376        * Append our option for testing.
   369    377        */
   370    378   
   371         -    lstrcat(cmdline, option);
          379  +    for (i = 0; i < count; i++) {
          380  +	lstrcat(cmdline, " \"");
          381  +	lstrcat(cmdline, options[i]);
          382  +	lstrcat(cmdline, "\"");
          383  +    }
   372    384   
   373    385       ok = CreateProcess(
   374    386   	    NULL,	    /* Module name. */
   375    387   	    cmdline,	    /* Command line. */
   376    388   	    NULL,	    /* Process handle not inheritable. */
   377    389   	    NULL,	    /* Thread handle not inheritable. */
   378    390   	    TRUE,	    /* yes, inherit handles. */
................................................................................
   429    441       /*
   430    442        * Look for the commandline warning code in the stderr stream.
   431    443        */
   432    444   
   433    445       return !(strstr(Out.buffer, "LNK1117") != NULL ||
   434    446   	    strstr(Err.buffer, "LNK1117") != NULL ||
   435    447   	    strstr(Out.buffer, "LNK4044") != NULL ||
   436         -	    strstr(Err.buffer, "LNK4044") != NULL);
          448  +	    strstr(Err.buffer, "LNK4044") != NULL ||
          449  +	    strstr(Out.buffer, "LNK4224") != NULL ||
          450  +	    strstr(Err.buffer, "LNK4224") != NULL);
   437    451   }
   438    452   
   439    453   static DWORD WINAPI
   440    454   ReadFromPipe(
   441    455       LPVOID args)
   442    456   {
   443    457       pipeinfo *pi = (pipeinfo *) args;

Added win/rules-ext.vc.

            1  +# This file should only be included in makefiles for Tcl extensions,
            2  +# NOT in the makefile for Tcl itself.
            3  +
            4  +!ifndef _RULES_EXT_VC
            5  +
            6  +# We need to run from the directory the parent makefile is located in.
            7  +# nmake does not tell us what makefile was used to invoke it so parent
            8  +# makefile has to set the MAKEFILEVC macro or we just make a guess and
            9  +# warn if we think that is not the case.
           10  +!if "$(MAKEFILEVC)" == ""
           11  +
           12  +!if exist("$(PROJECT).vc")
           13  +MAKEFILEVC = $(PROJECT).vc
           14  +!elseif exist("makefile.vc")
           15  +MAKEFILEVC = makefile.vc
           16  +!endif
           17  +!endif # "$(MAKEFILEVC)" == ""
           18  +
           19  +!if !exist("$(MAKEFILEVC)")
           20  +MSG = ^
           21  +You must run nmake from the directory containing the project makefile.^
           22  +If you are doing that and getting this message, set the MAKEFILEVC^
           23  +macro to the name of the project makefile.
           24  +!message WARNING: $(MSG)
           25  +!endif
           26  +
           27  +!if "$(PROJECT)" == "tcl"
           28  +!error The rules-ext.vc file is not intended for Tcl itself.
           29  +!endif
           30  +
           31  +# First locate the Tcl directory that we are working with.
           32  +!ifdef TCLDIR
           33  +
           34  +_RULESDIR = $(TCLDIR:/=\)
           35  +
           36  +!else
           37  +
           38  +# If an installation path is specified, that is also the Tcl directory.
           39  +# Also, tk never builds against an installed Tcl, it needs Tcl sources
           40  +!if defined(INSTALLDIR) && "$(PROJECT)" != "tk"
           41  +_RULESDIR=$(INSTALLDIR:/=\)
           42  +!else
           43  +_RULESDIR = ..\..\tcl
           44  +!endif
           45  +
           46  +!endif # ifndef TCLDIR
           47  +
           48  +# Now look for the targets.vc file under the Tcl root. Note we check this
           49  +# file and not rules.vc because the latter also exists on older systems.
           50  +!if exist("$(_RULESDIR)\lib\nmake\targets.vc") # Building against installed Tcl
           51  +_RULESDIR = $(_RULESDIR)\lib\nmake
           52  +!elseif exist("$(_RULESDIR)\win\targets.vc")   # Building against Tcl sources
           53  +_RULESDIR = $(_RULESDIR)\win
           54  +!else
           55  +# If we have not located Tcl's targets file, most likely we are compiling
           56  +# against an older version of Tcl and so must use our own support files.
           57  +_RULESDIR = .
           58  +!endif
           59  +
           60  +!if "$(_RULESDIR)" != "."
           61  +# Potentially using Tcl's support files. If this extension has its own
           62  +# nmake support files, need to compare the versions and pick newer.
           63  +
           64  +!if exist("rules.vc") # The extension has its own copy
           65  +
           66  +# We extract version numbers using the nmakehlp program.
           67  +!if [$(CC) -nologo "$(_RULESDIR)\nmakehlp.c" -link -subsystem:console > nul]
           68  +!endif
           69  +
           70  +!if [echo TCL_RULES_MAJOR = \> versions.vc] \
           71  +   && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MAJOR >> versions.vc]
           72  +!endif
           73  +!if [echo TCL_RULES_MINOR = \>> versions.vc] \
           74  +   && [nmakehlp -V "$(_RULESDIR)\rules.vc" RULES_VERSION_MINOR >> versions.vc]
           75  +!endif
           76  +
           77  +!if [echo OUR_RULES_MAJOR = \>> versions.vc] \
           78  +   && [nmakehlp -V "rules.vc" RULES_VERSION_MAJOR >> versions.vc]
           79  +!endif
           80  +!if [echo OUR_RULES_MINOR = \>> versions.vc] \
           81  +   && [nmakehlp -V "rules.vc" RULES_VERSION_MINOR >> versions.vc]
           82  +!endif
           83  +!include versions.vc
           84  +# We have a newer version of the support files, use them
           85  +!if ($(TCL_RULES_MAJOR) != $(OUR_RULES_MAJOR)) || ($(TCL_RULES_MINOR) < $(OUR_RULES_MINOR))
           86  +_RULESDIR = .
           87  +!endif
           88  +
           89  +!endif # if exist("rules.vc")
           90  +
           91  +!endif # if $(_RULESDIR) != "."
           92  +
           93  +# Let rules.vc know what copy of nmakehlp.c to use.
           94  +NMAKEHLPC = $(_RULESDIR)\nmakehlp.c
           95  +
           96  +# Get rid of our internal defines before calling rules.vc
           97  +!undef TCL_RULES_MAJOR
           98  +!undef TCL_RULES_MINOR
           99  +!undef OUR_RULES_MAJOR
          100  +!undef OUR_RULES_MINOR
          101  +
          102  +!if exist("$(_RULESDIR)\rules.vc")
          103  +!message *** Using $(_RULESDIR)\rules.vc
          104  +!include "$(_RULESDIR)\rules.vc"
          105  +!else
          106  +!error *** Could not locate rules.vc in $(_RULESDIR)
          107  +!endif
          108  +
          109  +!endif # _RULES_EXT_VC

Changes to win/rules.vc.

     1         -#------------------------------------------------------------------------------
            1  +#------------------------------------------------------------- -*- makefile -*-
     2      2   # rules.vc --
     3      3   #
     4         -#	Microsoft Visual C++ makefile include for decoding the commandline
     5         -#	macros.  This file does not need editing to build Tcl.
            4  +# Part of the nmake based build system for Tcl and its extensions.
            5  +# This file does all the hard work in terms of parsing build options,
            6  +# compiler switches, defining common targets and macros. The Tcl makefile
            7  +# directly includes this. Extensions include it via "rules-ext.vc".
     6      8   #
     7         -#	This version is modified from the Tcl source version to support
     8         -#	building extensions using nmake.
            9  +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for
           10  +# detailed documentation.
     9     11   #
    10     12   # See the file "license.terms" for information on usage and redistribution
    11     13   # of this file, and for a DISCLAIMER OF ALL WARRANTIES.
    12     14   #
    13     15   # Copyright (c) 2001-2003 David Gravereaux.
    14     16   # Copyright (c) 2003-2008 Patrick Thoyts
           17  +# Copyright (c) 2017      Ashok P. Nadkarni
    15     18   #------------------------------------------------------------------------------
    16     19   
    17     20   !ifndef _RULES_VC
    18     21   _RULES_VC = 1
    19     22   
    20         -cc32		= $(CC)   # built-in default.
    21         -link32		= link
    22         -lib32		= lib
    23         -rc32		= $(RC)   # built-in default.
    24         -
    25         -!ifndef INSTALLDIR
    26         -### Assume the normal default.
    27         -_INSTALLDIR	= C:\Program Files\Tcl
    28         -!else
    29         -### Fix the path separators.
    30         -_INSTALLDIR	= $(INSTALLDIR:/=\)
    31         -!endif
           23  +# The following macros define the version of the rules.vc nmake build system
           24  +# For modifications that are not backward-compatible, you *must* change
           25  +# the major version.
           26  +RULES_VERSION_MAJOR = 1
           27  +RULES_VERSION_MINOR = 0
           28  +
           29  +# The PROJECT macro must be defined by parent makefile.
           30  +!if "$(PROJECT)" == ""
           31  +!error *** Error: Macro PROJECT not defined! Please define it before including rules.vc
           32  +!endif
           33  +
           34  +!if "$(PRJ_PACKAGE_TCLNAME)" == ""
           35  +PRJ_PACKAGE_TCLNAME = $(PROJECT)
           36  +!endif
           37  +
           38  +# Also special case Tcl and Tk to save some typing later
           39  +DOING_TCL = 0
           40  +DOING_TK  = 0
           41  +!if "$(PROJECT)" == "tcl"
           42  +DOING_TCL = 1
           43  +!elseif "$(PROJECT)" == "tk"
           44  +DOING_TK = 1
           45  +!endif
           46  +
           47  +!ifndef NEED_TK
           48  +# Backwards compatibility
           49  +!ifdef PROJECT_REQUIRES_TK
           50  +NEED_TK = $(PROJECT_REQUIRES_TK)
           51  +!else
           52  +NEED_TK = 0
           53  +!endif
           54  +!endif
           55  +
           56  +!ifndef NEED_TCL_SOURCE
           57  +NEED_TCL_SOURCE = 0
           58  +!endif
           59  +
           60  +!ifdef NEED_TK_SOURCE
           61  +!if $(NEED_TK_SOURCE)
           62  +NEED_TK = 1
           63  +!endif
           64  +!else
           65  +NEED_TK_SOURCE = 0
           66  +!endif
           67  +
           68  +################################################################
           69  +# Nmake is a pretty weak environment in syntax and capabilities
           70  +# so this file is necessarily verbose. It's broken down into
           71  +# the following parts.
           72  +#
           73  +# 0. Sanity check that compiler environment is set up and initialize
           74  +#    any built-in settings from the parent makefile
           75  +# 1. First define the external tools used for compiling, copying etc.
           76  +#    as this is independent of everything else.
           77  +# 2. Figure out our build structure in terms of the directory, whether
           78  +#    we are building Tcl or an extension, etc.
           79  +# 3. Determine the compiler and linker versions
           80  +# 4. Build the nmakehlp helper application
           81  +# 5. Determine the supported compiler options and features
           82  +# 6. Parse the OPTS macro value for user-specified build configuration
           83  +# 7. Parse the STATS macro value for statistics instrumentation
           84  +# 8. Parse the CHECKS macro for additional compilation checks
           85  +# 9. Extract Tcl, and possibly Tk, version numbers from the headers
           86  +# 10. Based on this selected configuration, construct the output
           87  +#     directory and file paths
           88  +# 11. Construct the paths where the package is to be installed
           89  +# 12. Set up the actual options passed to compiler and linker based
           90  +#     on the information gathered above.
           91  +# 13. Define some standard build targets and implicit rules. These may
           92  +#     be optionally disabled by the parent makefile.
           93  +# 14. (For extensions only.) Compare the configuration of the target
           94  +#     Tcl and the extensions and warn against discrepancies.
           95  +#
           96  +# One final note about the macro names used. They are as they are
           97  +# for historical reasons. We would like legacy extensions to
           98  +# continue to work with this make include file so be wary of
           99  +# changing them for consistency or clarity.
          100  +
          101  +# 0. Sanity check compiler environment
          102  +
          103  +# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
          104  +# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
          105  +
          106  +!if !defined(MSDEVDIR) && !defined(MSVCDIR) && !defined(VCINSTALLDIR) && !defined(MSSDK) && !defined(WINDOWSSDKDIR)
          107  +MSG = ^
          108  +Visual C++ compiler environment not initialized.
          109  +!error $(MSG)
          110  +!endif
          111  +
          112  +# We need to run from the directory the parent makefile is located in.
          113  +# nmake does not tell us what makefile was used to invoke it so parent
          114  +# makefile has to set the MAKEFILEVC macro or we just make a guess and
          115  +# warn if we think that is not the case.
          116  +!if "$(MAKEFILEVC)" == ""
          117  +
          118  +!if exist("$(PROJECT).vc")
          119  +MAKEFILEVC = $(PROJECT).vc
          120  +!elseif exist("makefile.vc")
          121  +MAKEFILEVC = makefile.vc
          122  +!endif
          123  +!endif # "$(MAKEFILEVC)" == ""
          124  +
          125  +!if !exist("$(MAKEFILEVC)")
          126  +MSG = ^
          127  +You must run nmake from the directory containing the project makefile.^
          128  +If you are doing that and getting this message, set the MAKEFILEVC^
          129  +macro to the name of the project makefile.
          130  +!message WARNING: $(MSG)
          131  +!endif
          132  +
          133  +
          134  +################################################################
          135  +# 1. Define external programs being used
    32    136   
    33    137   #----------------------------------------------------------
    34    138   # Set the proper copy method to avoid overwrite questions
    35    139   # to the user when copying files and selecting the right
    36    140   # "delete all" method.
    37    141   #----------------------------------------------------------
    38    142   
    39         -!if "$(OS)" == "Windows_NT"
    40    143   RMDIR	= rmdir /S /Q
    41         -ERRNULL  = 2>NUL
    42         -!if ![ver | find "4.0" > nul]
    43         -CPY	= echo y | xcopy /i >NUL
    44         -COPY	= copy >NUL
    45         -!else
    46    144   CPY	= xcopy /i /y >NUL
          145  +CPYDIR  = xcopy /e /i /y >NUL
    47    146   COPY	= copy /y >NUL
    48         -!endif
    49         -!else # "$(OS)" != "Windows_NT"
    50         -CPY	= xcopy /i >_JUNK.OUT # On Win98 NUL does not work here.
    51         -COPY	= copy >_JUNK.OUT # On Win98 NUL does not work here.
    52         -RMDIR	= deltree /Y
    53         -NULL    = \NUL # Used in testing directory existence
    54         -ERRNULL = >NUL # Win9x shell cannot redirect stderr
    55         -!endif
    56    147   MKDIR   = mkdir
    57    148   
    58         -#------------------------------------------------------------------------------
    59         -# Determine the host and target architectures and compiler version.
    60         -#------------------------------------------------------------------------------
          149  +######################################################################
          150  +# 2. Figure out our build environment in terms of what we're building.
          151  +#
          152  +# (a) Tcl itself
          153  +# (b) Tk
          154  +# (c) a Tcl extension using libraries/includes from an *installed* Tcl
          155  +# (d) a Tcl extension using libraries/includes from Tcl source directory
          156  +#
          157  +# This last is needed because some extensions still need
          158  +# some Tcl interfaces that are not publicly exposed.
          159  +#
          160  +# The fragment will set the following macros:
          161  +# ROOT - root of this module sources
          162  +# COMPATDIR - source directory that holds compatibility sources
          163  +# DOCDIR - source directory containing documentation files
          164  +# GENERICDIR - platform-independent source directory
          165  +# WINDIR - Windows-specific source directory
          166  +# TESTDIR - directory containing test files
          167  +# TOOLSDIR - directory containing build tools
          168  +# _TCLDIR - root of the Tcl installation OR the Tcl sources. Not set
          169  +#    when building Tcl itself.
          170  +# _INSTALLDIR - native form of the installation path. For Tcl
          171  +#    this will be the root of the Tcl installation. For extensions
          172  +#    this will be the lib directory under the root.
          173  +# TCLINSTALL  - set to 1 if _TCLDIR refers to
          174  +#    headers and libraries from an installed Tcl, and 0 if built against
          175  +#    Tcl sources. Not set when building Tcl itself. Yes, not very well
          176  +#    named.
          177  +# _TCL_H - native path to the tcl.h file
          178  +#
          179  +# If Tk is involved, also sets the following
          180  +# _TKDIR - native form Tk installation OR Tk source. Not set if building
          181  +#    Tk itself.
          182  +# TKINSTALL - set 1 if _TKDIR refers to installed Tk and 0 if Tk sources
          183  +# _TK_H - native path to the tk.h file
          184  +
          185  +# Root directory for sources and assumed subdirectories
          186  +ROOT = $(MAKEDIR)\..
          187  +# The following paths CANNOT have spaces in them as they appear on the
          188  +# left side of implicit rules.
          189  +!ifndef COMPATDIR
          190  +COMPATDIR	= $(ROOT)\compat
          191  +!endif
          192  +!ifndef DOCDIR
          193  +DOCDIR		= $(ROOT)\doc
          194  +!endif
          195  +!ifndef GENERICDIR
          196  +GENERICDIR	= $(ROOT)\generic
          197  +!endif
          198  +!ifndef TOOLSDIR
          199  +TOOLSDIR	= $(ROOT)\tools
          200  +!endif
          201  +!ifndef TESTDIR
          202  +TESTDIR	= $(ROOT)\tests
          203  +!endif
          204  +!ifndef LIBDIR
          205  +!if exist("$(ROOT)\library")
          206  +LIBDIR          = $(ROOT)\library
          207  +!else
          208  +LIBDIR          = $(ROOT)\lib
          209  +!endif
          210  +!endif
          211  +!ifndef DEMODIR
          212  +!if exist("$(LIBDIR)\demos")
          213  +DEMODIR		= $(LIBDIR)\demos
          214  +!else
          215  +DEMODIR		= $(ROOT)\demos
          216  +!endif
          217  +!endif # ifndef DEMODIR
          218  +# Do NOT enclose WINDIR in a !ifndef because Windows always defines
          219  +# WINDIR env var to point to c:\windows!
          220  +# TBD - This is a potentially dangerous conflict, rename WINDIR to
          221  +# something else
          222  +WINDIR		= $(ROOT)\win
          223  +
          224  +!ifndef RCDIR
          225  +!if exist("$(WINDIR)\rc")
          226  +RCDIR           = $(WINDIR)\rc
          227  +!else
          228  +RCDIR           = $(WINDIR)
          229  +!endif
          230  +!endif
          231  +RCDIR = $(RCDIR:/=\)
          232  +
          233  +# The target directory where the built packages and binaries will be installed.
          234  +# INSTALLDIR is the (optional) path specified by the user.
          235  +# _INSTALLDIR is INSTALLDIR using the backslash separator syntax
          236  +!ifdef INSTALLDIR
          237  +### Fix the path separators.
          238  +_INSTALLDIR	= $(INSTALLDIR:/=\)
          239  +!else
          240  +### Assume the normal default.
          241  +_INSTALLDIR	= $(HOMEDRIVE)\Tcl
          242  +!endif
          243  +
          244  +!if $(DOING_TCL)
          245  +
          246  +# BEGIN Case 2(a) - Building Tcl itself
          247  +
          248  +# Only need to define _TCL_H
          249  +_TCL_H = ..\generic\tcl.h
          250  +
          251  +# END Case 2(a) - Building Tcl itself
          252  +
          253  +!elseif $(DOING_TK)
          254  +
          255  +# BEGIN Case 2(b) - Building Tk
          256  +
          257  +TCLINSTALL = 0 # Tk always builds against Tcl source, not an installed Tcl
          258  +!if "$(TCLDIR)" == ""
          259  +TCLDIR  = ../../tcl
          260  +!endif
          261  +_TCLDIR	= $(TCLDIR:/=\)
          262  +_TCL_H  = $(_TCLDIR)\generic\tcl.h
          263  +!if !exist("$(_TCL_H)")
          264  +!error Could not locate tcl.h. Please set the TCLDIR macro to point to the Tcl *source* directory.
          265  +!endif
          266  +
          267  +_TK_H = ..\generic\tk.h
          268  +
          269  +# END Case 2(b) - Building Tk
          270  +
          271  +!else
          272  +
          273  +# BEGIN Case 2(c) or (d) - Building an extension other than Tk
          274  +
          275  +# If command line has specified Tcl location through TCLDIR, use it
          276  +# else default to the INSTALLDIR setting
          277  +!if "$(TCLDIR)" != ""
          278  +
          279  +_TCLDIR	= $(TCLDIR:/=\)
          280  +!if exist("$(_TCLDIR)\include\tcl.h") # Case 2(c) with TCLDIR defined
          281  +TCLINSTALL	= 1
          282  +_TCL_H          = $(_TCLDIR)\include\tcl.h
          283  +!elseif exist("$(_TCLDIR)\generic\tcl.h") # Case 2(d) with TCLDIR defined
          284  +TCLINSTALL	= 0
          285  +_TCL_H          = $(_TCLDIR)\generic\tcl.h
          286  +!endif
          287  +
          288  +!else  # TCLDIR is not defined
          289  +
          290  +!if exist("$(_INSTALLDIR)\include\tcl.h") # Case 2(c) for extensions with TCLDIR undefined
          291  +TCLINSTALL	= 1
          292  +TCLDIR          = $(_INSTALLDIR)\..
          293  +# NOTE: we will be resetting _INSTALLDIR to _INSTALLDIR/lib for extensions
          294  +# later so the \.. accounts for the /lib
          295  +_TCLDIR		= $(_INSTALLDIR)\..
          296  +_TCL_H          = $(_TCLDIR)\include\tcl.h
          297  +!elseif exist("..\..\tcl\generic\tcl.h")
          298  +TCLINSTALL      = 0
          299  +TCLDIR          = ..\..\tcl
          300  +_TCLDIR         = $(TCLDIR)
          301  +_TCL_H          = $(_TCLDIR)\generic\tcl.h
          302  +!endif
          303  +
          304  +!endif # TCLDIR
          305  +
          306  +!ifndef _TCL_H
          307  +MSG =^
          308  +Failed to find tcl.h. The TCLDIR macro is set incorrectly or is not set and default path does not contain tcl.h.
          309  +!error $(MSG)
          310  +!endif
          311  +
          312  +# Now do the same to locate Tk headers and libs if project requires Tk
          313  +!if $(NEED_TK)
          314  +
          315  +!if "$(TKDIR)" != ""
          316  +
          317  +_TKDIR = $(TKDIR:/=\)
          318  +!if exist("$(_TKDIR)\include\tk.h")
          319  +TKINSTALL      = 1
          320  +_TK_H          = $(_TKDIR)\include\tk.h
          321  +!elseif exist("$(_TKDIR)\generic\tk.h")
          322  +TKINSTALL      = 0
          323  +_TK_H          = $(_TKDIR)\generic\tk.h
          324  +!endif
          325  +
          326  +!else # TKDIR not defined
          327  +
          328  +!if exist("$(_INSTALLDIR)\..\include\tk.h")
          329  +TKINSTALL      = 1
          330  +_TKDIR         = $(_INSTALLDIR)\..
          331  +_TK_H          = $(_TKDIR)\include\tk.h
          332  +TKDIR          = $(_TKDIR)
          333  +!elseif exist("$(_TCLDIR)\include\tk.h")
          334  +TKINSTALL      = 1
          335  +_TKDIR         = $(_TCLDIR)
          336  +_TK_H          = $(_TKDIR)\include\tk.h
          337  +TKDIR          = $(_TKDIR)
          338  +!endif
          339  +
          340  +!endif # TKDIR
          341  +
          342  +!ifndef _TK_H
          343  +MSG =^
          344  +Failed to find tk.h. The TKDIR macro is set incorrectly or is not set and default path does not contain tk.h.
          345  +!error $(MSG)
          346  +!endif
          347  +
          348  +!endif # NEED_TK
          349  +
          350  +!if $(NEED_TCL_SOURCE) && $(TCLINSTALL)
          351  +MSG = ^
          352  +*** Warning: This extension requires the source distribution of Tcl.^
          353  +*** Please set the TCLDIR macro to point to the Tcl sources.
          354  +!error $(MSG)
          355  +!endif
          356  +
          357  +!if $(NEED_TK_SOURCE)
          358  +!if $(TKINSTALL)
          359  +MSG = ^
          360  +*** Warning: This extension requires the source distribution of Tk.^
          361  +*** Please set the TKDIR macro to point to the Tk sources.
          362  +!error $(MSG)
          363  +!endif
          364  +!endif
          365  +
          366  +
          367  +# If INSTALLDIR set to tcl installation root dir then reset to the
          368  +# lib dir for installing extensions 
          369  +!if exist("$(_INSTALLDIR)\include\tcl.h")
          370  +_INSTALLDIR=$(_INSTALLDIR)\lib
          371  +!endif
          372  +
          373  +# END Case 2(c) or (d) - Building an extension
          374  +!endif # if $(DOING_TCL)
          375  +
          376  +################################################################
          377  +# 3. Determine compiler version and architecture
          378  +# In this section, we figure out the compiler version and the
          379  +# architecture for which we are building. This sets the
          380  +# following macros:
          381  +# VCVERSION - the internal compiler version as 1200, 1400, 1910 etc.
          382  +#     This is also printed by the compiler in dotted form 19.10 etc.
          383  +# VCVER - the "marketing version", for example Visual C++ 6 for internal
          384  +#     compiler version 1200. This is kept only for legacy reasons as it
          385  +#     does not make sense for recent Microsoft compilers. Only used for
          386  +#     output directory names.
          387  +# ARCH - set to IX86 or AMD64 depending on 32- or 64-bit target
          388  +# NATIVE_ARCH - set to IX86 or AMD64 for the host machine
          389  +# MACHINE - same as $(ARCH) - legacy
          390  +# _VC_MANIFEST_EMBED_{DLL,EXE} - commands for embedding a manifest if needed
          391  +# CFG_ENCODING - set to an character encoding.
          392  +#   TBD - this is passed to compiler as TCL_CFGVAL_ENCODING but can't
          393  +#   see where it is used
          394  +
          395  +cc32		= $(CC)   # built-in default.
          396  +link32		= link
          397  +lib32		= lib
          398  +rc32		= $(RC)   # built-in default.
          399  +
          400  +#----------------------------------------------------------------
          401  +# Figure out the compiler architecture and version by writing
          402  +# the C macros to a file, preprocessing them with the C
          403  +# preprocessor and reading back the created file
    61    404   
    62    405   _HASH=^#
    63    406   _VC_MANIFEST_EMBED_EXE=
    64    407   _VC_MANIFEST_EMBED_DLL=
    65    408   VCVER=0
    66    409   !if ![echo VCVERSION=_MSC_VER > vercl.x] \
    67    410       && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
    68    411       && ![echo ARCH=IX86 >> vercl.x] \
    69    412       && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
    70    413       && ![echo ARCH=AMD64 >> vercl.x] \
    71    414       && ![echo $(_HASH)endif >> vercl.x] \
    72         -    && ![cl -nologo -TC -P vercl.x $(ERRNULL)]
          415  +    && ![$(cc32) -nologo -TC -P vercl.x 2>NUL]
    73    416   !include vercl.i
          417  +!if $(VCVERSION) < 1900
    74    418   !if ![echo VCVER= ^\> vercl.vc] \
    75    419       && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
    76    420   !include vercl.vc
    77    421   !endif
          422  +!else
          423  +# The simple calculation above does not apply to new Visual Studio releases
          424  +# Keep the compiler version in its native form.
          425  +VCVER = $(VCVERSION)
    78    426   !endif
    79         -!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
    80    427   !endif
    81    428   
          429  +!if ![del 2>NUL /q/f vercl.x vercl.i vercl.vc]
          430  +!endif
          431  +
          432  +#----------------------------------------------------------------
          433  +# The MACHINE macro is used by legacy makefiles so set it as well
          434  +!ifdef MACHINE
          435  +!if "$(MACHINE)" == "x86"
          436  +!undef MACHINE
          437  +MACHINE = IX86
          438  +!elseif "$(MACHINE)" == "x64"
          439  +!undef MACHINE
          440  +MACHINE = AMD64
          441  +!endif
          442  +!if "$(MACHINE)" != "$(ARCH)"
          443  +!error Specified MACHINE macro $(MACHINE) does not match detected target architecture $(ARCH).
          444  +!endif
          445  +!else
          446  +MACHINE=$(ARCH)
          447  +!endif
          448  +
          449  +#------------------------------------------------------------
          450  +# Figure out the *host* architecture by reading the registry
          451  +
    82    452   !if ![reg query HKLM\Hardware\Description\System\CentralProcessor\0 /v Identifier | findstr /i x86]
    83    453   NATIVE_ARCH=IX86
    84    454   !else
    85    455   NATIVE_ARCH=AMD64
    86    456   !endif
    87    457   
    88    458   # Since MSVC8 we must deal with manifest resources.
    89    459   !if $(VCVERSION) >= 1400
    90    460   _VC_MANIFEST_EMBED_EXE=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;1
    91    461   _VC_MANIFEST_EMBED_DLL=if exist $@.manifest mt -nologo -manifest $@.manifest -outputresource:$@;2
    92    462   !endif
    93    463   
    94         -!ifndef MACHINE
    95         -MACHINE=$(ARCH)
    96         -!endif
    97         -
    98    464   !ifndef CFG_ENCODING
    99    465   CFG_ENCODING	= \"cp1252\"
   100    466   !endif
   101    467   
   102         -!message ===============================================================================
   103         -
   104         -#----------------------------------------------------------
   105         -# build the helper app we need to overcome nmake's limiting
   106         -# environment.
   107         -#----------------------------------------------------------
   108         -
   109         -!if !exist(nmakehlp.exe)
   110         -!if [$(cc32) -nologo nmakehlp.c -link -subsystem:console > nul]
   111         -!endif
   112         -!endif
   113         -
   114         -#----------------------------------------------------------
   115         -# Test for compiler features
   116         -#----------------------------------------------------------
   117         -
   118         -### test for optimizations
   119         -!if [nmakehlp -c -Ot]
   120         -!message *** Compiler has 'Optimizations'
   121         -OPTIMIZING	= 1
   122         -!else
   123         -!message *** Compiler does not have 'Optimizations'
   124         -OPTIMIZING	= 0
   125         -!endif
   126         -
   127         -OPTIMIZATIONS   =
   128         -
   129         -!if [nmakehlp -c -Ot]
   130         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Ot
   131         -!endif
   132         -
   133         -!if [nmakehlp -c -Oi]
   134         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Oi
   135         -!endif
   136         -
          468  +################################################################
          469  +# 4. Build the nmakehlp program
          470  +# This is a helper app we need to overcome nmake's limiting
          471  +# environment. We will call out to it to get various bits of
          472  +# information about supported compiler options etc.
          473  +#
          474  +# Tcl itself will always use the nmakehlp.c program which is
          475  +# in its own source. This is the "master" copy and kept updated.
          476  +#
          477  +# Extensions built against an installed Tcl will use the installed
          478  +# copy of Tcl's nmakehlp.c if there is one and their own version
          479  +# otherwise. In the latter case, they would also be using their own
          480  +# rules.vc. Note that older versions of Tcl do not install nmakehlp.c
          481  +# or rules.vc.
          482  +#
          483  +# Extensions built against Tcl sources will use the one from the Tcl source.
          484  +#
          485  +# When building an extension using a sufficiently new version of Tcl,
          486  +# rules-ext.vc will define NMAKEHLPC appropriately to point to the
          487  +# copy of nmakehlp.c to be used.
          488  +
          489  +!ifndef NMAKEHLPC
          490  +# Default to the one in the current directory (the extension's own nmakehlp.c)
          491  +NMAKEHLPC = nmakehlp.c
          492  +
          493  +!if !$(DOING_TCL)
          494  +!if $(TCLINSTALL)
          495  +!if exist("$(_TCLDIR)\lib\nmake\nmakehlp.c")
          496  +NMAKEHLPC = $(_TCLDIR)\lib\nmake\nmakehlp.c
          497  +!endif
          498  +!else # ! $(TCLINSTALL)
          499  +!if exist("$(_TCLDIR)\win\nmakehlp.c")
          500  +NMAKEHLPC = $(_TCLDIR)\win\nmakehlp.c
          501  +!endif
          502  +!endif # $(TCLINSTALL)
          503  +!endif # !$(DOING_TCL)
          504  +
          505  +!endif # NMAKEHLPC
          506  +
          507  +# We always build nmakehlp even if it exists since we do not know
          508  +# what source it was built from.
          509  +!message *** Using $(NMAKEHLPC)
          510  +!if [$(cc32) -nologo "$(NMAKEHLPC)" -link -subsystem:console > nul]
          511  +!endif
          512  +
          513  +################################################################
          514  +# 5. Test for compiler features
          515  +# Visual C++ compiler options have changed over the years. Check
          516  +# which options are supported by the compiler in use.
          517  +#
          518  +# The following macros are set:
          519  +# OPTIMIZATIONS - the compiler flags to be used for optimized builds
          520  +# DEBUGFLAGS - the compiler flags to be used for debug builds
          521  +# LINKERFLAGS - Flags passed to the linker 
          522  +#
          523  +# Note that these are the compiler settings *available*, not those
          524  +# that will be *used*. The latter depends on the OPTS macro settings
          525  +# which we have not yet parsed.
          526  +#
          527  +# Also note that some of the flags in OPTIMIZATIONS are not really
          528  +# related to optimization. They are placed there only for legacy reasons
          529  +# as some extensions expect them to be included in that macro.
          530  +
          531  +# -Op improves float consistency. Note only needed for older compilers
          532  +# Newer compilers do not need or support this option.
   137    533   !if [nmakehlp -c -Op]
   138         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Op
          534  +FPOPTS  = -Op
   139    535   !endif
   140    536   
          537  +# Strict floating point semantics - present in newer compilers in lieu of -Op
   141    538   !if [nmakehlp -c -fp:strict]
   142         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -fp:strict
   143         -!endif
   144         -
   145         -!if [nmakehlp -c -Gs]
   146         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -Gs
   147         -!endif
   148         -
   149         -!if [nmakehlp -c -GS]
   150         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
   151         -!endif
   152         -
   153         -!if [nmakehlp -c -GL]
   154         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
   155         -!endif
   156         -
   157         -DEBUGFLAGS     =
   158         -
   159         -!if [nmakehlp -c -RTC1]
   160         -DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
   161         -!elseif [nmakehlp -c -GZ]
   162         -DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
   163         -!endif
   164         -
   165         -COMPILERFLAGS  =-W3
   166         -
   167         -# In v13 -GL and -YX are incompatible.
   168         -!if [nmakehlp -c -YX]
   169         -!if ![nmakehlp -c -GL]
   170         -OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
   171         -!endif
          539  +FPOPTS  = $(FPOPTS) -fp:strict
   172    540   !endif
   173    541   
   174    542   !if "$(MACHINE)" == "IX86"
   175    543   ### test for pentium errata
   176    544   !if [nmakehlp -c -QI0f]
   177    545   !message *** Compiler has 'Pentium 0x0f fix'
   178         -COMPILERFLAGS  = $(COMPILERFLAGS) -QI0f
          546  +FPOPTS  = $(FPOPTS) -QI0f
   179    547   !else
   180    548   !message *** Compiler does not have 'Pentium 0x0f fix'
   181    549   !endif
   182    550   !endif
   183    551   
   184         -!if "$(MACHINE)" == "IA64"
   185         -### test for Itanium errata
   186         -!if [nmakehlp -c -QIA64_Bx]
   187         -!message *** Compiler has 'B-stepping errata workarounds'
   188         -COMPILERFLAGS   = $(COMPILERFLAGS) -QIA64_Bx
   189         -!else
   190         -!message *** Compiler does not have 'B-stepping errata workarounds'
   191         -!endif
   192         -!endif
   193         -
   194         -!if "$(MACHINE)" == "IX86"
   195         -### test for -align:4096, when align:512 will do.
   196         -!if [nmakehlp -l -opt:nowin98]
   197         -!message *** Linker has 'Win98 alignment problem'
   198         -ALIGN98_HACK	= 1
   199         -!else
   200         -!message *** Linker does not have 'Win98 alignment problem'
   201         -ALIGN98_HACK	= 0
   202         -!endif
   203         -!else
   204         -ALIGN98_HACK	= 0
          552  +### test for optimizations
          553  +# /O2 optimization includes /Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy as per
          554  +# documentation. Note we do NOT want /Gs as that inserts a _chkstk
          555  +# stack probe at *every* function entry, not just those with more than
          556  +# a page of stack allocation resulting in a performance hit.  However,
          557  +# /O2 documentation is misleading as its stack probes are simply the
          558  +# default page size locals allocation probes and not what is implied
          559  +# by an explicit /Gs option.
          560  +
          561  +OPTIMIZATIONS = $(FPOPTS)
          562  +
          563  +!if [nmakehlp -c -O2]
          564  +!message *** Compiler has 'Optimizations'
          565  +OPTIMIZING = 1
          566  +OPTIMIZATIONS   = $(OPTIMIZATIONS) -O2
          567  +!else
          568  +# Legacy, really. All modern compilers support this
          569  +!message *** Compiler does not have 'Optimizations'
          570  +OPTIMIZING = 0
          571  +!endif
          572  +
          573  +# Checks for buffer overflows in local arrays
          574  +!if [nmakehlp -c -GS]
          575  +OPTIMIZATIONS  = $(OPTIMIZATIONS) -GS
          576  +!endif
          577  +
          578  +# Link time optimization. Note that this option (potentially) makes
          579  +# generated libraries only usable by the specific VC++ version that
          580  +# created it. Requires /LTCG linker option
          581  +!if [nmakehlp -c -GL]
          582  +OPTIMIZATIONS  = $(OPTIMIZATIONS) -GL
          583  +CC_GL_OPT_ENABLED = 1
          584  +!else
          585  +# In newer compilers -GL and -YX are incompatible.
          586  +!if [nmakehlp -c -YX]
          587  +OPTIMIZATIONS  = $(OPTIMIZATIONS) -YX
          588  +!endif
          589  +!endif # [nmakehlp -c -GL]
          590  +
          591  +DEBUGFLAGS     = $(FPOPTS)
          592  +
          593  +# Run time error checks. Not available or valid in a release, non-debug build
          594  +# RTC is for modern compilers, -GZ is legacy
          595  +!if [nmakehlp -c -RTC1]
          596  +DEBUGFLAGS     = $(DEBUGFLAGS) -RTC1
          597  +!elseif [nmakehlp -c -GZ]
          598  +DEBUGFLAGS     = $(DEBUGFLAGS) -GZ
          599  +!endif
          600  +
          601  +#----------------------------------------------------------------
          602  +# Linker flags
          603  +
          604  +# LINKER_TESTFLAGS are for internal use when we call nmakehlp to test
          605  +# if the linker supports a specific option. Without these flags link will
          606  +# return "LNK1561: entry point must be defined" error compiling from VS-IDE:
          607  +# They are not passed through to the actual application / extension
          608  +# link rules.
          609  +!ifndef LINKER_TESTFLAGS
          610  +LINKER_TESTFLAGS = /DLL /NOENTRY /OUT:nmakehlp.out
   205    611   !endif
   206    612   
   207    613   LINKERFLAGS     =
   208    614   
   209         -!if [nmakehlp -l -ltcg]
   210         -LINKERFLAGS     =-ltcg
          615  +# If compiler has enabled link time optimization, linker must too with -ltcg
          616  +!ifdef CC_GL_OPT_ENABLED
          617  +!if [nmakehlp -l -ltcg $(LINKER_TESTFLAGS)]
          618  +LINKERFLAGS     = $(LINKERFLAGS) -ltcg
          619  +!endif
   211    620   !endif
   212    621   
   213         -#----------------------------------------------------------
   214         -# Decode the options requested.
   215         -#----------------------------------------------------------
          622  +########################################################################
          623  +# 6. Parse the OPTS macro to work out the requested build configuration.
          624  +# Based on this, we will construct the actual switches to be passed to the
          625  +# compiler and linker using the macros defined in the previous section.
          626  +# The following macros are defined by this section based on OPTS
          627  +# STATIC_BUILD - 0 -> Tcl is to be built as a shared library
          628  +#                1 -> build as a static library and shell
          629  +# TCL_THREADS - legacy but always 1 on Windows since winsock requires it.
          630  +# DEBUG - 1 -> debug build, 0 -> release builds
          631  +# SYMBOLS - 1 -> generate PDB's, 0 -> no PDB's
          632  +# PROFILE - 1 -> generate profiling info, 0 -> no profiling
          633  +# PGO     - 1 -> profile based optimization, 0 -> no
          634  +# MSVCRT  - 1 -> link to dynamic C runtime even when building static Tcl build
          635  +#           0 -> link to static C runtime for static Tcl build.
          636  +#           Does not impact shared Tcl builds (STATIC_BUILD == 0)
          637  +# TCL_USE_STATIC_PACKAGES - 1 -> statically link the registry and dde extensions
          638  +#           in the Tcl shell. 0 -> keep them as shared libraries
          639  +#           Does not impact shared Tcl builds.
          640  +# USE_THREAD_ALLOC - 1 -> Use a shared global free pool for allocation.
          641  +#           0 -> Use the non-thread allocator.
          642  +# UNCHECKED - 1 -> when doing a debug build with symbols, use the release
          643  +#           C runtime, 0 -> use the debug C runtime.
          644  +# USE_STUBS - 1 -> compile to use stubs interfaces, 0 -> direct linking
          645  +# CONFIG_CHECK - 1 -> check current build configuration against Tcl
          646  +#           configuration (ignored for Tcl itself)
          647  +# Further, LINKERFLAGS are modified based on above.
   216    648   
   217         -!if "$(OPTS)" == "" || [nmakehlp -f "$(OPTS)" "none"]
          649  +# Default values for all the above
   218    650   STATIC_BUILD	= 0
   219    651   TCL_THREADS	= 1
   220    652   DEBUG		= 0
   221    653   SYMBOLS		= 0
   222    654   PROFILE		= 0
   223    655   PGO		= 0
   224         -MSVCRT		= 0
   225         -LOIMPACT	= 0
          656  +MSVCRT		= 1
          657  +TCL_USE_STATIC_PACKAGES	= 0
          658  +USE_THREAD_ALLOC = 1
   226    659   UNCHECKED	= 0
          660  +CONFIG_CHECK    = 1
          661  +!if $(DOING_TCL)
          662  +USE_STUBS       = 0
   227    663   !else
          664  +USE_STUBS       = 1
          665  +!endif
          666  +
          667  +# If OPTS is not empty AND does not contain "none" which turns off all OPTS
          668  +# set the above macros based on OPTS content
          669  +!if "$(OPTS)" != "" && ![nmakehlp -f "$(OPTS)" "none"]
          670  +
          671  +# OPTS are specified, parse them
          672  +
   228    673   !if [nmakehlp -f $(OPTS) "static"]
   229    674   !message *** Doing static
   230    675   STATIC_BUILD	= 1
          676  +!endif
          677  +
          678  +!if [nmakehlp -f $(OPTS) "nostubs"]
          679  +!message *** Not using stubs
          680  +USE_STUBS	= 0
          681  +!endif
          682  +
          683  +!if [nmakehlp -f $(OPTS) "nomsvcrt"]
          684  +!message *** Doing nomsvcrt
          685  +MSVCRT		= 0
   231    686   !else
   232         -STATIC_BUILD	= 0
   233         -!endif
   234    687   !if [nmakehlp -f $(OPTS) "msvcrt"]
   235    688   !message *** Doing msvcrt
   236    689   MSVCRT		= 1
   237    690   !else
          691  +!if !$(STATIC_BUILD)
          692  +MSVCRT		= 1
          693  +!else
   238    694   MSVCRT		= 0
   239    695   !endif
          696  +!endif
          697  +!endif # [nmakehlp -f $(OPTS) "nomsvcrt"]
          698  +
          699  +!if [nmakehlp -f $(OPTS) "staticpkg"] && $(STATIC_BUILD)
          700  +!message *** Doing staticpkg
          701  +TCL_USE_STATIC_PACKAGES	= 1
          702  +!else
          703  +TCL_USE_STATIC_PACKAGES	= 0
          704  +!endif
          705  +
   240    706   !if [nmakehlp -f $(OPTS) "nothreads"]
   241    707   !message *** Compile explicitly for non-threaded tcl
   242    708   TCL_THREADS	= 0
          709  +USE_THREAD_ALLOC= 0
   243    710   !else
   244    711   TCL_THREADS	= 1
          712  +USE_THREAD_ALLOC= 1
   245    713   !endif
          714  +
   246    715   !if [nmakehlp -f $(OPTS) "symbols"]
   247    716   !message *** Doing symbols
   248    717   DEBUG		= 1
   249    718   !else
   250    719   DEBUG		= 0
   251    720   !endif
          721  +
   252    722   !if [nmakehlp -f $(OPTS) "pdbs"]
   253    723   !message *** Doing pdbs
   254    724   SYMBOLS		= 1
   255    725   !else
   256    726   SYMBOLS		= 0
   257    727   !endif
          728  +
   258    729   !if [nmakehlp -f $(OPTS) "profile"]
   259    730   !message *** Doing profile
   260    731   PROFILE		= 1
   261    732   !else
   262    733   PROFILE		= 0
   263    734   !endif
          735  +
   264    736   !if [nmakehlp -f $(OPTS) "pgi"]
   265    737   !message *** Doing profile guided optimization instrumentation
   266    738   PGO		= 1
   267    739   !elseif [nmakehlp -f $(OPTS) "pgo"]
   268    740   !message *** Doing profile guided optimization
   269    741   PGO		= 2
   270    742   !else
   271    743   PGO		= 0
   272    744   !endif
          745  +
   273    746   !if [nmakehlp -f $(OPTS) "loimpact"]
   274         -!message *** Doing loimpact
   275         -LOIMPACT	= 1
   276         -!else
   277         -LOIMPACT	= 0
          747  +!message *** Warning: ignoring option "loimpact" - deprecated on modern Windows.
   278    748   !endif
          749  +
          750  +# TBD - should get rid of this option
          751  +!if [nmakehlp -f $(OPTS) "thrdalloc"]
          752  +!message *** Doing thrdalloc
          753  +USE_THREAD_ALLOC = 1
          754  +!endif
          755  +
          756  +!if [nmakehlp -f $(OPTS) "tclalloc"]
          757  +USE_THREAD_ALLOC = 0
          758  +!endif
          759  +
   279    760   !if [nmakehlp -f $(OPTS) "unchecked"]
   280    761   !message *** Doing unchecked
   281    762   UNCHECKED = 1
   282    763   !else
   283    764   UNCHECKED = 0
   284    765   !endif
   285         -!endif
   286         -
   287         -
   288         -!if !$(STATIC_BUILD)
   289         -# Make sure we don't build overly fat DLLs.
   290         -MSVCRT		= 1
   291         -# We shouldn't statically put the extensions inside the shell when dynamic.
   292         -TCL_USE_STATIC_PACKAGES = 0
   293         -!endif
   294         -
   295         -
   296         -#----------------------------------------------------------
          766  +
          767  +!if [nmakehlp -f $(OPTS) "noconfigcheck"]
          768  +CONFIG_CHECK = 1
          769  +!else
          770  +CONFIG_CHECK = 0
          771  +!endif
          772  +
          773  +!endif # "$(OPTS)" != ""  && ... parsing of OPTS
          774  +
          775  +# Set linker flags based on above
          776  +
          777  +!if $(PGO) > 1
          778  +!if [nmakehlp -l -ltcg:pgoptimize $(LINKER_TESTFLAGS)]
          779  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
          780  +!else
          781  +MSG=^
          782  +This compiler does not support profile guided optimization.
          783  +!error $(MSG)
          784  +!endif
          785  +!elseif $(PGO) > 0
          786  +!if [nmakehlp -l -ltcg:pginstrument $(LINKER_TESTFLAGS)]
          787  +LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
          788  +!else
          789  +MSG=^
          790  +This compiler does not support profile guided optimization.
          791  +!error $(MSG)
          792  +!endif
          793  +!endif
          794  +
          795  +################################################################
          796  +# 7. Parse the STATS macro to configure code instrumentation
          797  +# The following macros are set by this section:
          798  +# TCL_MEM_DEBUG - 1 -> enables memory allocation instrumentation
          799  +#                 0 -> disables
          800  +# TCL_COMPILE_DEBUG - 1 -> enables byte compiler logging
          801  +#                     0 -> disables
          802  +
          803  +# Default both are off
          804  +TCL_MEM_DEBUG	    = 0
          805  +TCL_COMPILE_DEBUG   = 0
          806  +
          807  +!if "$(STATS)" != "" && ![nmakehlp -f "$(STATS)" "none"]
          808  +
          809  +!if [nmakehlp -f $(STATS) "memdbg"]
          810  +!message *** Doing memdbg
          811  +TCL_MEM_DEBUG	    = 1
          812  +!else
          813  +TCL_MEM_DEBUG	    = 0
          814  +!endif
          815  +
          816  +!if [nmakehlp -f $(STATS) "compdbg"]
          817  +!message *** Doing compdbg
          818  +TCL_COMPILE_DEBUG   = 1
          819  +!else
          820  +TCL_COMPILE_DEBUG   = 0
          821  +!endif
          822  +
          823  +!endif
          824  +
          825  +####################################################################
          826  +# 8. Parse the CHECKS macro to configure additional compiler checks
          827  +# The following macros are set by this section:
          828  +# WARNINGS - compiler switches that control the warnings level
          829  +# TCL_NO_DEPRECATED - 1 -> disable support for deprecated functions
          830  +#                     0 -> enable deprecated functions
          831  +
          832  +# Defaults - Permit deprecated functions and warning level 3
          833  +TCL_NO_DEPRECATED	    = 0
          834  +WARNINGS		    = -W3
          835  +
          836  +!if "$(CHECKS)" != "" && ![nmakehlp -f "$(CHECKS)" "none"]
          837  +
          838  +!if [nmakehlp -f $(CHECKS) "nodep"]
          839  +!message *** Doing nodep check
          840  +TCL_NO_DEPRECATED	    = 1
          841  +!endif
          842  +
          843  +!if [nmakehlp -f $(CHECKS) "fullwarn"]
          844  +!message *** Doing full warnings check
          845  +WARNINGS		    = -W4
          846  +!if [nmakehlp -l -warn:3 $(LINKER_TESTFLAGS)]
          847  +LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
          848  +!endif
          849  +!endif
          850  +
          851  +!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
          852  +!message *** Doing 64bit portability warnings
          853  +WARNINGS		    = $(WARNINGS) -Wp64
          854  +!endif
          855  +
          856  +!endif
          857  +
          858  +################################################################
          859  +# 9. Extract various version numbers
          860  +# For Tcl and Tk, version numbers are extracted from tcl.h and tk.h
          861  +# respectively. For extensions, versions are extracted from the
          862  +# configure.in or configure.ac from the TEA configuration if it
          863  +# exists, and unset otherwise.
          864  +# Sets the following macros:
          865  +# TCL_MAJOR_VERSION
          866  +# TCL_MINOR_VERSION
          867  +# TCL_PATCH_LEVEL
          868  +# TCL_VERSION
          869  +# TK_MAJOR_VERSION
          870  +# TK_MINOR_VERSION
          871  +# TK_PATCH_LEVEL
          872  +# TK_VERSION
          873  +# DOTVERSION - set as (for example) 2.5
          874  +# VERSION - set as (for example 25)
          875  +#--------------------------------------------------------------
          876  +
          877  +!if [echo REM = This file is generated from rules.vc > versions.vc]
          878  +!endif
          879  +!if [echo TCL_MAJOR_VERSION = \>> versions.vc] \
          880  +   && [nmakehlp -V "$(_TCL_H)" TCL_MAJOR_VERSION >> versions.vc]
          881  +!endif
          882  +!if [echo TCL_MINOR_VERSION = \>> versions.vc] \
          883  +   && [nmakehlp -V "$(_TCL_H)" TCL_MINOR_VERSION >> versions.vc]
          884  +!endif
          885  +!if [echo TCL_PATCH_LEVEL = \>> versions.vc] \
          886  +   && [nmakehlp -V "$(_TCL_H)" TCL_PATCH_LEVEL >> versions.vc]
          887  +!endif
          888  +
          889  +!if defined(_TK_H)
          890  +!if [echo TK_MAJOR_VERSION = \>> versions.vc] \
          891  +   && [nmakehlp -V $(_TK_H) TK_MAJOR_VERSION >> versions.vc]
          892  +!endif
          893  +!if [echo TK_MINOR_VERSION = \>> versions.vc] \
          894  +   && [nmakehlp -V $(_TK_H) TK_MINOR_VERSION >> versions.vc]
          895  +!endif
          896  +!if [echo TK_PATCH_LEVEL = \>> versions.vc] \
          897  +   && [nmakehlp -V $(_TK_H) TK_PATCH_LEVEL >> versions.vc]
          898  +!endif
          899  +!endif # _TK_H
          900  +
          901  +!include versions.vc
          902  +
          903  +TCL_VERSION	= $(TCL_MAJOR_VERSION)$(TCL_MINOR_VERSION)
          904  +TCL_DOTVERSION	= $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
          905  +!if defined(_TK_H)
          906  +TK_VERSION	= $(TK_MAJOR_VERSION)$(TK_MINOR_VERSION)
          907  +TK_DOTVERSION	= $(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
          908  +!endif
          909  +
          910  +# Set DOTVERSION and VERSION
          911  +!if $(DOING_TCL)
          912  +
          913  +DOTVERSION = $(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
          914  +VERSION = $(TCL_VERSION)
          915  +
          916  +!elseif $(DOING_TK)
          917  +
          918  +DOTVERSION = $(TK_DOTVERSION)
          919  +VERSION = $(TK_VERSION)
          920  +
          921  +!else # Doing a non-Tk extension
          922  +
          923  +# If parent makefile has not defined DOTVERSION, try to get it from TEA
          924  +# first from a configure.in file, and then from configure.ac
          925  +!ifndef DOTVERSION
          926  +!if [echo DOTVERSION = \> versions.vc] \
          927  +   || [nmakehlp -V $(ROOT)\configure.in ^[$(PROJECT)^] >> versions.vc]
          928  +!if [echo DOTVERSION = \> versions.vc] \
          929  +   || [nmakehlp -V $(ROOT)\configure.ac ^[$(PROJECT)^] >> versions.vc]
          930  +!error *** Could not figure out extension version. Please define DOTVERSION in parent makefile before including rules.vc.
          931  +!endif
          932  +!endif
          933  +!include versions.vc
          934  +!endif # DOTVERSION
          935  +VERSION         = $(DOTVERSION:.=)
          936  +
          937  +!endif # $(DOING_TCL) ... etc.
          938  +
          939  +################################################################
          940  +# 10. Construct output directory and file paths
   297    941   # Figure-out how to name our intermediate and output directories.
   298         -# We wouldn't want different builds to use the same .obj files
   299         -# by accident.
   300         -#----------------------------------------------------------
   301         -
   302         -#----------------------------------------
   303         -# Naming convention:
          942  +# In order to avoid inadvertent mixing of object files built using
          943  +# different compilers, build configurations etc.,
          944  +#
          945  +# Naming convention (suffixes):
   304    946   #   t = full thread support.
   305         -#   s = static library (as opposed to an
   306         -#	import library)
   307         -#   g = linked to the debug enabled C
   308         -#	run-time.
   309         -#   x = special static build when it
   310         -#	links to the dynamic C run-time.
   311         -#----------------------------------------
   312         -SUFX	    = sgx
          947  +#   s = static library (as opposed to an import library)
          948  +#   g = linked to the debug enabled C run-time.
          949  +#   x = special static build when it links to the dynamic C run-time.
          950  +#
          951  +# The following macros are set in this section:
          952  +# SUFX - the suffix to use for binaries based on above naming convention
          953  +# BUILDDIRTOP - the toplevel default output directory
          954  +#      is of the form {Release,Debug}[_AMD64][_COMPILERVERSION]
          955  +# TMP_DIR - directory where object files are created
          956  +# OUT_DIR - directory where output executables are created
          957  +# Both TMP_DIR and OUT_DIR are defaulted only if not defined by the
          958  +# parent makefile (or command line). The default values are
          959  +# based on BUILDDIRTOP.
          960  +# STUBPREFIX - name of the stubs library for this project
          961  +# PRJIMPLIB - output path of the generated project import library
          962  +# PRJLIBNAME - name of generated project library
          963  +# PRJLIB     - output path of generated project library
          964  +# PRJSTUBLIBNAME - name of the generated project stubs library
          965  +# PRJSTUBLIB - output path of the generated project stubs library
          966  +# RESFILE - output resource file (only if not static build)
          967  +
          968  +SUFX	    = tsgx
   313    969   
   314    970   !if $(DEBUG)
   315    971   BUILDDIRTOP = Debug
   316    972   !else
   317    973   BUILDDIRTOP = Release
   318    974   !endif
   319    975   
................................................................................
   320    976   !if "$(MACHINE)" != "IX86"
   321    977   BUILDDIRTOP =$(BUILDDIRTOP)_$(MACHINE)
   322    978   !endif
   323    979   !if $(VCVER) > 6
   324    980   BUILDDIRTOP =$(BUILDDIRTOP)_VC$(VCVER)
   325    981   !endif
   326    982   
   327         -!if !$(DEBUG) || $(UNCHECKED)
          983  +!if !$(DEBUG) || $(DEBUG) && $(UNCHECKED)
   328    984   SUFX	    = $(SUFX:g=)
   329    985   !endif
   330    986   
   331         -TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_DynamicStaticX
          987  +TMP_DIRFULL = .\$(BUILDDIRTOP)\$(PROJECT)_ThreadedDynamicStaticX
   332    988   
   333    989   !if !$(STATIC_BUILD)
   334    990   TMP_DIRFULL = $(TMP_DIRFULL:Static=)
   335    991   SUFX	    = $(SUFX:s=)
   336    992   EXT	    = dll
   337         -!if $(MSVCRT)
   338    993   TMP_DIRFULL = $(TMP_DIRFULL:X=)
   339    994   SUFX	    = $(SUFX:x=)
   340         -!endif
   341    995   !else
   342    996   TMP_DIRFULL = $(TMP_DIRFULL:Dynamic=)
   343    997   EXT	    = lib
   344    998   !if !$(MSVCRT)
   345    999   TMP_DIRFULL = $(TMP_DIRFULL:X=)
   346   1000   SUFX	    = $(SUFX:x=)
   347   1001   !endif
   348   1002   !endif
         1003  +
         1004  +!if !$(TCL_THREADS)
         1005  +TMP_DIRFULL = $(TMP_DIRFULL:Threaded=)
         1006  +SUFX	    = $(SUFX:t=)
         1007  +!endif
   349   1008   
   350   1009   !ifndef TMP_DIR
   351   1010   TMP_DIR	    = $(TMP_DIRFULL)
   352   1011   !ifndef OUT_DIR
   353   1012   OUT_DIR	    = .\$(BUILDDIRTOP)
   354   1013   !endif
   355   1014   !else
   356   1015   !ifndef OUT_DIR
   357   1016   OUT_DIR	    = $(TMP_DIR)
   358   1017   !endif
   359   1018   !endif
   360   1019   
   361         -
   362         -#----------------------------------------------------------
   363         -# Decode the statistics requested.
   364         -#----------------------------------------------------------
   365         -
   366         -!if "$(STATS)" == "" || [nmakehlp -f "$(STATS)" "none"]
   367         -TCL_MEM_DEBUG	    = 0
   368         -TCL_COMPILE_DEBUG   = 0
   369         -!else
   370         -!if [nmakehlp -f $(STATS) "memdbg"]
   371         -!message *** Doing memdbg
   372         -TCL_MEM_DEBUG	    = 1
   373         -!else
   374         -TCL_MEM_DEBUG	    = 0
   375         -!endif
   376         -!if [nmakehlp -f $(STATS) "compdbg"]
   377         -!message *** Doing compdbg
   378         -TCL_COMPILE_DEBUG   = 1
   379         -!else
   380         -TCL_COMPILE_DEBUG   = 0
   381         -!endif
   382         -!endif
   383         -
   384         -
   385         -#----------------------------------------------------------
   386         -# Decode the checks requested.
   387         -#----------------------------------------------------------
   388         -
   389         -!if "$(CHECKS)" == "" || [nmakehlp -f "$(CHECKS)" "none"]
   390         -TCL_NO_DEPRECATED	    = 0
   391         -WARNINGS		    = -W3
         1020  +# Relative paths -> absolute
         1021  +!if [echo OUT_DIR = \> nmakehlp.out] \
         1022  +   || [nmakehlp -Q "$(OUT_DIR)" >> nmakehlp.out]
         1023  +!error *** Could not fully qualify path OUT_DIR=$(OUT_DIR)
         1024  +!endif
         1025  +!if [echo TMP_DIR = \>> nmakehlp.out] \
         1026  +   || [nmakehlp -Q "$(TMP_DIR)" >> nmakehlp.out]
         1027  +!error *** Could not fully qualify path TMP_DIR=$(TMP_DIR)
         1028  +!endif
         1029  +!include nmakehlp.out
         1030  +
         1031  +# The name of the stubs library for the project being built
         1032  +STUBPREFIX      = $(PROJECT)stub
         1033  +
         1034  +# Set up paths to various Tcl executables and libraries needed by extensions
         1035  +!if $(DOING_TCL)
         1036  +
         1037  +TCLSHNAME       = $(PROJECT)sh$(TCL_VERSION)$(SUFX).exe
         1038  +TCLSH		= $(OUT_DIR)\$(TCLSHNAME)
         1039  +TCLIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
         1040  +TCLLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
         1041  +TCLLIB		= $(OUT_DIR)\$(TCLLIBNAME)
         1042  +
         1043  +TCLSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
         1044  +TCLSTUBLIB	= $(OUT_DIR)\$(TCLSTUBLIBNAME)
         1045  +TCL_INCLUDES    = -I"$(WINDIR)" -I"$(GENERICDIR)"
         1046  +
         1047  +!else # ! $(DOING_TCL)
         1048  +
         1049  +!if $(TCLINSTALL) # Building against an installed Tcl
         1050  +
         1051  +TCLSH		= $(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe
         1052  +!if !exist("$(TCLSH)") && $(TCL_THREADS)
         1053  +TCLSH           = $(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe
         1054  +!endif
         1055  +TCLSTUBLIB	= $(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib
         1056  +TCLIMPLIB	= $(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib
         1057  +TCL_LIBRARY	= $(_TCLDIR)\lib
         1058  +TCLREGLIB	= $(_TCLDIR)\lib\tclreg13$(SUFX:t=).lib
         1059  +TCLDDELIB	= $(_TCLDIR)\lib\tcldde14$(SUFX:t=).lib
         1060  +TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
         1061  +TCL_INCLUDES    = -I"$(_TCLDIR)\include"
         1062  +
         1063  +!else # Building against Tcl sources
         1064  +
         1065  +TCLSH		= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe
         1066  +!if !exist($(TCLSH)) && $(TCL_THREADS)
         1067  +TCLSH		= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe
         1068  +!endif
         1069  +TCLSTUBLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib
         1070  +TCLIMPLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib
         1071  +TCL_LIBRARY	= $(_TCLDIR)\library
         1072  +TCLREGLIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tclreg13$(SUFX:t=).lib
         1073  +TCLDDELIB	= $(_TCLDIR)\win\$(BUILDDIRTOP)\tcldde14$(SUFX:t=).lib
         1074  +TCLTOOLSDIR	= $(_TCLDIR)\tools
         1075  +TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
         1076  +
         1077  +!endif # TCLINSTALL
         1078  +
         1079  +tcllibs = "$(TCLSTUBLIB)" "$(TCLIMPLIB)"
         1080  +
         1081  +!endif # $(DOING_TCL)
         1082  +
         1083  +# We need a tclsh that will run on the host machine as part of the build.
         1084  +# IX86 runs on all architectures.
         1085  +!ifndef TCLSH_NATIVE
         1086  +!if "$(MACHINE)" == "IX86" || "$(MACHINE)" == "$(NATIVE_ARCH)"
         1087  +TCLSH_NATIVE	= $(TCLSH)
   392   1088   !else
   393         -!if [nmakehlp -f $(CHECKS) "nodep"]
   394         -!message *** Doing nodep check
   395         -TCL_NO_DEPRECATED	    = 1
   396         -!else
   397         -TCL_NO_DEPRECATED	    = 0
   398         -!endif
   399         -!if [nmakehlp -f $(CHECKS) "fullwarn"]
   400         -!message *** Doing full warnings check
   401         -WARNINGS		    = -W4
   402         -!if [nmakehlp -l -warn:3]
   403         -LINKERFLAGS		    = $(LINKERFLAGS) -warn:3
   404         -!endif
         1089  +!error You must explicitly set TCLSH_NATIVE for cross-compilation
         1090  +!endif
         1091  +!endif
         1092  +
         1093  +# Do the same for Tk and Tk extensions that require the Tk libraries
         1094  +!if $(DOING_TK) || $(NEED_TK)
         1095  +WISHNAMEPREFIX = wish
         1096  +WISHNAME = $(WISHNAMEPREFIX)$(TK_VERSION)$(SUFX).exe
         1097  +TKLIBNAME	= $(PROJECT)$(TK_VERSION)$(SUFX).$(EXT)
         1098  +TKSTUBLIBNAME	= tkstub$(TK_VERSION).lib
         1099  +TKIMPLIBNAME	= tk$(TK_VERSION)$(SUFX).lib
         1100  +
         1101  +!if $(DOING_TK)
         1102  +WISH 		= $(OUT_DIR)\$(WISHNAME)
         1103  +TKSTUBLIB	= $(OUT_DIR)\$(TKSTUBLIBNAME)
         1104  +TKIMPLIB	= $(OUT_DIR)\$(TKIMPLIBNAME)
         1105  +TKLIB		= $(OUT_DIR)\$(TKLIBNAME)
         1106  +TK_INCLUDES    = -I"$(WINDIR)" -I"$(GENERICDIR)"
         1107  +
         1108  +!else # effectively NEED_TK
         1109  +
         1110  +!if $(TKINSTALL) # Building against installed Tk
         1111  +WISH		= $(_TKDIR)\bin\$(WISHNAME)
         1112  +TKSTUBLIB	= $(_TKDIR)\lib\$(TKSTUBLIBNAME)
         1113  +TKIMPLIB	= $(_TKDIR)\lib\$(TKIMPLIBNAME)
         1114  +TK_INCLUDES     = -I"$(_TKDIR)\include"
         1115  +!else # Building against Tk sources
         1116  +WISH		= $(_TKDIR)\win\$(BUILDDIRTOP)\$(WISHNAME)
         1117  +TKSTUBLIB	= $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKSTUBLIBNAME)
         1118  +TKIMPLIB	= $(_TKDIR)\win\$(BUILDDIRTOP)\$(TKIMPLIBNAME)
         1119  +TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
         1120  +!endif # TKINSTALL
         1121  +tklibs = "$(TKSTUBLIB)" "$(TKIMPLIB)"
         1122  +
         1123  +!endif # $(DOING_TK)
         1124  +!endif # $(DOING_TK) || $(NEED_TK)
         1125  +
         1126  +# Various output paths
         1127  +PRJIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
         1128  +PRJLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
         1129  +PRJLIB		= $(OUT_DIR)\$(PRJLIBNAME)
         1130  +
         1131  +PRJSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
         1132  +PRJSTUBLIB	= $(OUT_DIR)\$(PRJSTUBLIBNAME)
         1133  +
         1134  +# If extension parent makefile has not defined a resource definition file,
         1135  +# we will generate one from standard template.
         1136  +!if !$(DOING_TCL) && !$(DOING_TK) && !$(STATIC_BUILD)
         1137  +!ifdef RCFILE
         1138  +RESFILE = $(TMP_DIR)\$(RCFILE:.rc=.res)
   405   1139   !else
   406         -WARNINGS		    = -W3
   407         -!endif
   408         -!if [nmakehlp -f $(CHECKS) "64bit"] && [nmakehlp -c -Wp64]
   409         -!message *** Doing 64bit portability warnings
   410         -WARNINGS		    = $(WARNINGS) -Wp64
   411         -!endif
   412         -!endif
   413         -
   414         -!if $(PGO) > 1
   415         -!if [nmakehlp -l -ltcg:pgoptimize]
   416         -LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pgoptimize
   417         -!else
   418         -MSG=^
   419         -This compiler does not support profile guided optimization.
   420         -!error $(MSG)
   421         -!endif
   422         -!elseif $(PGO) > 0
   423         -!if [nmakehlp -l -ltcg:pginstrument]
   424         -LINKERFLAGS	= $(LINKERFLAGS:-ltcg=) -ltcg:pginstrument
   425         -!else
   426         -MSG=^
   427         -This compiler does not support profile guided optimization.
   428         -!error $(MSG)
   429         -!endif
   430         -!endif
   431         -
   432         -#----------------------------------------------------------
   433         -# Set our defines now armed with our options.
   434         -#----------------------------------------------------------
         1140  +RESFILE = $(TMP_DIR)\$(PROJECT).res
         1141  +!endif
         1142  +!endif
         1143  +
         1144  +###################################################################
         1145  +# 11. Construct the paths for the installation directories
         1146  +# The following macros get defined in this section:
         1147  +# LIB_INSTALL_DIR - where libraries should be installed
         1148  +# BIN_INSTALL_DIR - where the executables should be installed
         1149  +# DOC_INSTALL_DIR - where documentation should be installed
         1150  +# SCRIPT_INSTALL_DIR - where scripts should be installed
         1151  +# INCLUDE_INSTALL_DIR - where C include files should be installed
         1152  +# DEMO_INSTALL_DIR - where demos should be installed
         1153  +# PRJ_INSTALL_DIR - where package will be installed (not set for tcl and tk)
         1154  +
         1155  +!if $(DOING_TCL) || $(DOING_TK)
         1156  +LIB_INSTALL_DIR		= $(_INSTALLDIR)\lib
         1157  +BIN_INSTALL_DIR		= $(_INSTALLDIR)\bin
         1158  +DOC_INSTALL_DIR		= $(_INSTALLDIR)\doc
         1159  +!if $(DOING_TCL)
         1160  +SCRIPT_INSTALL_DIR	= $(_INSTALLDIR)\lib\$(PROJECT)$(TCL_MAJOR_VERSION).$(TCL_MINOR_VERSION)
         1161  +!else # DOING_TK
         1162  +SCRIPT_INSTALL_DIR	= $(_INSTALLDIR)\lib\$(PROJECT)$(TK_MAJOR_VERSION).$(TK_MINOR_VERSION)
         1163  +!endif
         1164  +DEMO_INSTALL_DIR	= $(SCRIPT_INSTALL_DIR)\demos
         1165  +INCLUDE_INSTALL_DIR	= $(_INSTALLDIR)\include
         1166  +
         1167  +!else # extension other than Tk
         1168  +
         1169  +PRJ_INSTALL_DIR         = $(_INSTALLDIR)\$(PROJECT)$(DOTVERSION)
         1170  +LIB_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1171  +BIN_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1172  +DOC_INSTALL_DIR		= $(PRJ_INSTALL_DIR)
         1173  +SCRIPT_INSTALL_DIR	= $(PRJ_INSTALL_DIR)
         1174  +DEMO_INSTALL_DIR	= $(PRJ_INSTALL_DIR)\demos
         1175  +INCLUDE_INSTALL_DIR	= $(_TCLDIR)\include
         1176  +
         1177  +!endif
         1178  +
         1179  +###################################################################
         1180  +# 12. Set up actual options to be passed to the compiler and linker
         1181  +# Now we have all the information we need, set up the actual flags and
         1182  +# options that we will pass to the compiler and linker. The main
         1183  +# makefile should use these in combination with whatever other flags
         1184  +# and switches are specific to it.
         1185  +# The following macros are defined, names are for historical compatibility:
         1186  +# OPTDEFINES - /Dxxx C macro flags based on user-specified OPTS
         1187  +# COMPILERFLAGS - /Dxxx C macro flags independent of any configuration opttions
         1188  +# crt - Compiler switch that selects the appropriate C runtime
         1189  +# cdebug - Compiler switches related to debug AND optimizations
         1190  +# cwarn - Compiler switches that set warning levels
         1191  +# cflags - complete compiler switches (subsumes cdebug and cwarn)
         1192  +# ldebug - Linker switches controlling debug information and optimization
         1193  +# lflags - complete linker switches (subsumes ldebug) except subsystem type
         1194  +# dlllflags - complete linker switches to build DLLs (subsumes lflags)
         1195  +# conlflags - complete linker switches for console program (subsumes lflags)
         1196  +# guilflags - complete linker switches for GUI program (subsumes lflags)
         1197  +# baselibs - minimum Windows libraries required. Parent makefile can
         1198  +#    define PRJ_LIBS before including rules.rc if additional libs are needed
   435   1199   
   436   1200   OPTDEFINES	= -DTCL_CFGVAL_ENCODING=$(CFG_ENCODING) -DSTDC_HEADERS
   437   1201   
   438   1202   !if $(TCL_MEM_DEBUG)
   439   1203   OPTDEFINES	= $(OPTDEFINES) -DTCL_MEM_DEBUG
   440   1204   !endif
   441   1205   !if $(TCL_COMPILE_DEBUG)
   442   1206   OPTDEFINES	= $(OPTDEFINES) -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS
   443   1207   !endif
   444   1208   !if $(TCL_THREADS)
   445         -OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1 -DUSE_THREAD_ALLOC=1
         1209  +OPTDEFINES	= $(OPTDEFINES) -DTCL_THREADS=1
         1210  +!if $(USE_THREAD_ALLOC)
         1211  +OPTDEFINES	= $(OPTDEFINES) -DUSE_THREAD_ALLOC=1
         1212  +!endif
   446   1213   !endif
   447   1214   !if $(STATIC_BUILD)
   448   1215   OPTDEFINES	= $(OPTDEFINES) -DSTATIC_BUILD
   449   1216   !endif
   450   1217   !if $(TCL_NO_DEPRECATED)
   451   1218   OPTDEFINES	= $(OPTDEFINES) -DTCL_NO_DEPRECATED
   452   1219   !endif
   453   1220   
         1221  +!if $(USE_STUBS)
         1222  +# Note we do not define USE_TCL_STUBS even when building tk since some
         1223  +# test targets in tk do not use stubs
         1224  +!if ! $(DOING_TCL)
         1225  +USE_STUBS_DEFS  = -DUSE_TCL_STUBS -DUSE_TCLOO_STUBS
         1226  +!if $(NEED_TK)
         1227  +USE_STUBS_DEFS  = $(USE_STUBS_DEFS) -DUSE_TK_STUBS
         1228  +!endif
         1229  +!endif
         1230  +!endif # USE_STUBS
         1231  +
   454   1232   !if !$(DEBUG)
   455   1233   OPTDEFINES	= $(OPTDEFINES) -DNDEBUG
   456   1234   !if $(OPTIMIZING)
   457   1235   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_OPTIMIZED
   458   1236   !endif
   459   1237   !endif
   460   1238   !if $(PROFILE)
   461   1239   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_PROFILED
   462   1240   !endif
   463         -!if "$(MACHINE)" == "IA64" || "$(MACHINE)" == "AMD64"
         1241  +!if "$(MACHINE)" == "AMD64"
   464   1242   OPTDEFINES	= $(OPTDEFINES) -DTCL_CFG_DO64BIT
   465   1243   !endif
   466         -
   467         -
   468         -#----------------------------------------------------------
   469         -# Get common info used when building extensions.
   470         -#----------------------------------------------------------
   471         -
   472         -!if "$(PROJECT)" != "tcl"
   473         -
   474         -# If INSTALLDIR set to tcl root dir then reset to the lib dir.
   475         -!if exist("$(_INSTALLDIR)\include\tcl.h")
   476         -_INSTALLDIR=$(_INSTALLDIR)\lib
         1244  +!if $(VCVERSION) < 1300
         1245  +OPTDEFINES	= $(OPTDEFINES) -DNO_STRTOI64
         1246  +!endif
         1247  +
         1248  +# _ATL_XP_TARGETING - Newer SDK's need this to build for XP
         1249  +COMPILERFLAGS  = /D_ATL_XP_TARGETING
         1250  +
         1251  +# Following is primarily for the benefit of extensions. Tcl 8.5 builds
         1252  +# Tcl without /DUNICODE, while 8.6 builds with it defined. When building
         1253  +# an extension, it is advisable (but not mandated) to use the same Windows
         1254  +# API as the Tcl build. This is accordingly defaulted below. A particular
         1255  +# extension can override this by pre-definining USE_WIDECHAR_API.
         1256  +!ifndef USE_WIDECHAR_API
         1257  +!if $(TCL_VERSION) > 85
         1258  +USE_WIDECHAR_API = 1
         1259  +!else
         1260  +USE_WIDECHAR_API = 0
         1261  +!endif
         1262  +!endif
         1263  +
         1264  +!if $(USE_WIDECHAR_API)
         1265  +COMPILERFLAGS = $(COMPILERFLAGS) /DUNICODE /D_UNICODE 
         1266  +!endif
         1267  +
         1268  +# Like the TEA system only set this non empty for non-Tk extensions
         1269  +!if !$(DOING_TCL) && !$(DOING_TK)
         1270  +PKGNAMEFLAGS = -DPACKAGE_NAME="\"$(PROJECT)\"" \
         1271  +               -DPACKAGE_TCLNAME="\"$(PRJ_PACKAGE_TCLNAME)\"" \
         1272  +               -DPACKAGE_VERSION="\"$(DOTVERSION)\"" \
         1273  +               -DMODULE_SCOPE=extern 
         1274  +!endif
         1275  +
         1276  +# crt picks the C run time based on selected OPTS
         1277  +!if $(MSVCRT)
         1278  +!if $(DEBUG) && !$(UNCHECKED)
         1279  +crt = -MDd
         1280  +!else
         1281  +crt = -MD
         1282  +!endif
         1283  +!else
         1284  +!if $(DEBUG) && !$(UNCHECKED)
         1285  +crt = -MTd
         1286  +!else
         1287  +crt = -MT
         1288  +!endif
         1289  +!endif
         1290  +
         1291  +# cdebug includes compiler options for debugging as well as optimization.
         1292  +!if $(DEBUG)
         1293  +
         1294  +# In debugging mode, optimizations need to be disabled
         1295  +cdebug = -Zi -Od $(DEBUGFLAGS)
         1296  +
         1297  +!else
         1298  +
         1299  +cdebug = $(OPTIMIZATIONS)
         1300  +!if $(SYMBOLS)
         1301  +cdebug = $(cdebug) -Zi
         1302  +!endif
         1303  +
         1304  +!endif # $(DEBUG)
         1305  +
         1306  +# cwarn includes default warning levels.
         1307  +cwarn = $(WARNINGS)
         1308  +
         1309  +!if "$(MACHINE)" == "AMD64"
         1310  +# Disable pointer<->int warnings related to cast between different sizes
         1311  +# There are a gadzillion of these due to use of ClientData and
         1312  +# clutter up compiler
         1313  +# output increasing chance of a real warning getting lost. So disable them.
         1314  +# Eventually some day, Tcl will be 64-bit clean.
         1315  +cwarn = $(cwarn) -wd4311 -wd4312
         1316  +!endif
         1317  +
         1318  +### Common compiler options that are architecture specific
         1319  +!if "$(MACHINE)" == "ARM"
         1320  +carch = -D_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE
         1321  +!else
         1322  +carch =
         1323  +!endif
         1324  +
         1325  +!if $(DEBUG)
         1326  +# Turn warnings into errors
         1327  +cwarn = $(cwarn) -WX
         1328  +!endif
         1329  +
         1330  +INCLUDES = $(TCL_INCLUDES) $(TK_INCLUDES) $(PRJ_INCLUDES)
         1331  +!if !$(DOING_TCL) && !$(DOING_TK)
         1332  +INCLUDES = $(INCLUDES) -I"$(GENERICDIR)" -I"$(WINDIR)" -I"$(COMPATDIR)"
         1333  +!endif
         1334  +
         1335  +# These flags are defined roughly in the order of the pre-reform
         1336  +# rules.vc/makefile.vc to help visually compare that the pre- and
         1337  +# post-reform build logs
         1338  +
         1339  +# cflags contains generic flags used for building practically all object files
         1340  +cflags = -nologo -c $(COMPILERFLAGS) $(carch) $(cwarn) -Fp$(TMP_DIR)^\ $(cdebug)
         1341  +
         1342  +# appcflags contains $(cflags) and flags for building the application
         1343  +# object files (e.g. tclsh, or wish) pkgcflags contains $(cflags) plus
         1344  +# flags used for building shared object files The two differ in the
         1345  +# BUILD_$(PROJECT) macro which should be defined only for the shared
         1346  +# library *implementation* and not for its caller interface
         1347  +
         1348  +appcflags = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES) $(USE_STUBS_DEFS)
         1349  +appcflags_nostubs = $(cflags) $(crt) $(INCLUDES) $(TCL_DEFINES) $(PRJ_DEFINES) $(OPTDEFINES)
         1350  +pkgcflags = $(appcflags) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT)
         1351  +pkgcflags_nostubs = $(appcflags_nostubs) $(PKGNAMEFLAGS) -DBUILD_$(PROJECT)
         1352  +
         1353  +# stubscflags contains $(cflags) plus flags used for building a stubs
         1354  +# library for the package.  Note: -DSTATIC_BUILD is defined in
         1355  +# $(OPTDEFINES) only if the OPTS configuration indicates a static
         1356  +# library. However the stubs library is ALWAYS static hence included
         1357  +# here irrespective of the OPTS setting.
         1358  +#
         1359  +# TBD - tclvfs has a comment that stubs libs should not be compiled with -GL
         1360  +# without stating why. Tcl itself compiled stubs libs with this flag.
         1361  +# so we do not remove it from cflags. -GL may prevent extensions
         1362  +# compiled with one VC version to fail to link against stubs library
         1363  +# compiled with another VC version. Check for this and fix accordingly.
         1364  +stubscflags = $(cflags) $(PKGNAMEFLAGS) $(PRJ_DEFINES) $(OPTDEFINES) -Zl -DSTATIC_BUILD $(INCLUDES)
         1365  +
         1366  +# Link flags 
         1367  +
         1368  +!if $(DEBUG)
         1369  +ldebug	= -debug -debugtype:cv
         1370  +!else
         1371  +ldebug	= -release -opt:ref -opt:icf,3
         1372  +!if $(SYMBOLS)
         1373  +ldebug	= $(ldebug) -debug -debugtype:cv
         1374  +!endif
         1375  +!endif
         1376  +
         1377  +# Note: Profiling is currently only possible with the Visual Studio Enterprise
         1378  +!if $(PROFILE)
         1379  +ldebug= $(ldebug) -profile
         1380  +!endif
         1381  +
         1382  +### Declarations common to all linker versions 
         1383  +lflags	= -nologo -machine:$(MACHINE) $(LINKERFLAGS) $(ldebug)
         1384  +
         1385  +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
         1386  +lflags	= $(lflags) -nodefaultlib:libucrt.lib
         1387  +!endif
         1388  +
         1389  +# Old linkers (Visual C++ 6 in particular) will link for fast loading
         1390  +# on Win98. Since we do not support Win98 any more, we specify nowin98
         1391  +# as recommended for NT and later. However, this is only required by
         1392  +# IX86 on older compilers and only needed if we are not doing a static build.
         1393  +
         1394  +!if "$(MACHINE)" == "IX86" && !$(STATIC_BUILD)
         1395  +!if [nmakehlp -l -opt:nowin98 $(LINKER_TESTFLAGS)]
         1396  +# Align sections for PE size savings.
         1397  +lflags	= $(lflags) -opt:nowin98
         1398  +!endif
         1399  +!endif
         1400  +
         1401  +dlllflags = $(lflags) -dll
         1402  +conlflags = $(lflags) -subsystem:console
         1403  +guilflags = $(lflags) -subsystem:windows
         1404  +
         1405  +# Libraries that are required for every image.
         1406  +# Extensions should define any additional libraries with $(PRJ_LIBS)
         1407  +winlibs   = kernel32.lib advapi32.lib
         1408  +
         1409  +!if $(NEED_TK)
         1410  +winlibs = $(winlibs) gdi32.lib user32.lib uxtheme.lib
         1411  +!endif
         1412  +
         1413  +# Avoid 'unresolved external symbol __security_cookie' errors.
         1414  +# c.f. http://support.microsoft.com/?id=894573
         1415  +!if "$(MACHINE)" == "AMD64"
         1416  +!if $(VCVERSION) > 1399 && $(VCVERSION) < 1500
         1417  +winlibs   = $(winlibs) bufferoverflowU.lib
         1418  +!endif
         1419  +!endif
         1420  +
         1421  +baselibs = $(winlibs) $(PRJ_LIBS)
         1422  +
         1423  +!if $(MSVCRT) && !($(DEBUG) && !$(UNCHECKED)) && $(VCVERSION) >= 1900
         1424  +baselibs   = $(baselibs) ucrt.lib
         1425  +!endif
         1426  +
         1427  +################################################################
         1428  +# 13. Define standard commands, common make targets and implicit rules
         1429  +
         1430  +CCPKGCMD = $(cc32) $(pkgcflags) -Fo$(TMP_DIR)^\
         1431  +CCAPPCMD = $(cc32) $(appcflags) -Fo$(TMP_DIR)^\
         1432  +CCSTUBSCMD = $(cc32) $(stubscflags) -Fo$(TMP_DIR)^\
         1433  +
         1434  +LIBCMD = $(lib32) -nologo $(LINKERFLAGS) -out:$@
         1435  +DLLCMD = $(link32) $(dlllflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
         1436  +
         1437  +CONEXECMD = $(link32) $(conlflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
         1438  +GUIEXECMD = $(link32) $(guilflags) -out:$@ $(baselibs) $(tcllibs) $(tklibs)
         1439  +RESCMD  = $(rc32) -fo $@ -r -i "$(GENERICDIR)" -i "$(TMP_DIR)" \
         1440  +	    $(TCL_INCLUDES) \
         1441  +	    -DDEBUG=$(DEBUG) -d UNCHECKED=$(UNCHECKED) \
         1442  +	    -DCOMMAVERSION=$(DOTVERSION:.=,),0 \
         1443  +	    -DDOTVERSION=\"$(DOTVERSION)\" \
         1444  +	    -DVERSION=\"$(VERSION)\" \
         1445  +	    -DSUFX=\"$(SUFX)\" \
         1446  +            -DPROJECT=\"$(PROJECT)\" \
         1447  +            -DPRJLIBNAME=\"$(PRJLIBNAME)\" 
         1448  +
         1449  +!ifndef DEFAULT_BUILD_TARGET
         1450  +DEFAULT_BUILD_TARGET = $(PROJECT)
   477   1451   !endif
   478   1452   
   479         -!if !defined(TCLDIR)
   480         -!if exist("$(_INSTALLDIR)\..\include\tcl.h")
   481         -TCLINSTALL	= 1
   482         -_TCLDIR		= $(_INSTALLDIR)\..
   483         -_TCL_H          = $(_INSTALLDIR)\..\include\tcl.h
   484         -TCLDIR          = $(_INSTALLDIR)\..
   485         -!else
   486         -MSG=^
   487         -Failed to find tcl.h.  Set the TCLDIR macro.
   488         -!error $(MSG)
   489         -!endif
   490         -!else
   491         -_TCLDIR	= $(TCLDIR:/=\)
   492         -!if exist("$(_TCLDIR)\include\tcl.h")
   493         -TCLINSTALL	= 1
   494         -_TCL_H          = $(_TCLDIR)\include\tcl.h
   495         -!elseif exist("$(_TCLDIR)\generic\tcl.h")
   496         -TCLINSTALL	= 0
   497         -_TCL_H          = $(_TCLDIR)\generic\tcl.h
   498         -!else
   499         -MSG =^
   500         -Failed to find tcl.h.  The TCLDIR macro does not appear correct.
   501         -!error $(MSG)
   502         -!endif
         1453  +default-target: $(DEFAULT_BUILD_TARGET)
         1454  +
         1455  +default-pkgindex:
         1456  +	@echo package ifneeded $(PRJ_PACKAGE_TCLNAME) $(DOTVERSION) \
         1457  +	    [list load [file join $$dir $(PRJLIBNAME)]] > $(OUT_DIR)\pkgIndex.tcl
         1458  +
         1459  +default-pkgindex-tea:
         1460  +	@if exist $(ROOT)\pkgIndex.tcl.in nmakehlp -s << $(ROOT)\pkgIndex.tcl.in > $(OUT_DIR)\pkgIndex.tcl
         1461  +@PACKAGE_VERSION@    $(DOTVERSION)
         1462  +@PACKAGE_NAME@       $(PROJECT)
         1463  +@PACKAGE_TCLNAME@    $(PRJ_PACKAGE_TCLNAME)
         1464  +@PKG_LIB_FILE@       $(PRJLIBNAME)
         1465  +<<
         1466  +
         1467  +
         1468  +default-install: default-install-binaries default-install-libraries
         1469  +
         1470  +default-install-binaries: $(PRJLIB)
         1471  +	@echo Installing binaries to '$(SCRIPT_INSTALL_DIR)'
         1472  +	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
         1473  +	@$(CPY) $(PRJLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
         1474  +
         1475  +default-install-libraries: $(OUT_DIR)\pkgIndex.tcl
         1476  +	@echo Installing libraries to '$(SCRIPT_INSTALL_DIR)'
         1477  +	@if exist $(LIBDIR) $(CPY) $(LIBDIR)\*.tcl "$(SCRIPT_INSTALL_DIR)"
         1478  +	@echo Installing package index in '$(SCRIPT_INSTALL_DIR)'
         1479  +	@$(CPY) $(OUT_DIR)\pkgIndex.tcl $(SCRIPT_INSTALL_DIR)
         1480  +
         1481  +default-install-stubs:
         1482  +	@echo Installing stubs library to '$(SCRIPT_INSTALL_DIR)'
         1483  +	@if not exist "$(SCRIPT_INSTALL_DIR)" mkdir "$(SCRIPT_INSTALL_DIR)"
         1484  +	@$(CPY) $(PRJSTUBLIB) "$(SCRIPT_INSTALL_DIR)" >NUL
         1485  +
         1486  +default-install-docs-html:
         1487  +	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
         1488  +	@if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)"
         1489  +	@if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.html" "$(DOCDIR)\*.css" "$(DOCDIR)\*.png") do @$(COPY) %f "$(DOC_INSTALL_DIR)"
         1490  +
         1491  +default-install-docs-n:
         1492  +	@echo Installing documentation files to '$(DOC_INSTALL_DIR)'
         1493  +	@if not exist "$(DOC_INSTALL_DIR)" mkdir "$(DOC_INSTALL_DIR)"
         1494  +	@if exist $(DOCDIR) for %f in ("$(DOCDIR)\*.n") do @$(COPY) %f "$(DOC_INSTALL_DIR)"
         1495  +
         1496  +default-install-demos:
         1497  +	@echo Installing demos to '$(DEMO_INSTALL_DIR)'
         1498  +	@if not exist "$(DEMO_INSTALL_DIR)" mkdir "$(DEMO_INSTALL_DIR)"
         1499  +	@if exist $(DEMODIR) $(CPYDIR) "$(DEMODIR)" "$(DEMO_INSTALL_DIR)"
         1500  +
         1501  +default-clean:
         1502  +	@echo Cleaning $(TMP_DIR)\* ...
         1503  +	@if exist $(TMP_DIR)\nul $(RMDIR) $(TMP_DIR)
         1504  +	@echo Cleaning $(WINDIR)\nmakehlp.obj, nmakehlp.exe ...
         1505  +	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
         1506  +	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
         1507  +	@if exist $(WINDIR)\nmakehlp.out del $(WINDIR)\nmakehlp.out
         1508  +	@echo Cleaning $(WINDIR)\nmhlp-out.txt ...
         1509  +	@if exist $(WINDIR)\nmhlp-out.txt del $(WINDIR)\nmhlp-out.txt
         1510  +	@echo Cleaning $(WINDIR)\_junk.pch ...
         1511  +	@if exist $(WINDIR)\_junk.pch del $(WINDIR)\_junk.pch
         1512  +	@echo Cleaning $(WINDIR)\vercl.x, vercl.i ...
         1513  +	@if exist $(WINDIR)\vercl.x del $(WINDIR)\vercl.x
         1514  +	@if exist $(WINDIR)\vercl.i del $(WINDIR)\vercl.i
         1515  +	@echo Cleaning $(WINDIR)\versions.vc, version.vc ...
         1516  +	@if exist $(WINDIR)\versions.vc del $(WINDIR)\versions.vc
         1517  +	@if exist $(WINDIR)\version.vc del $(WINDIR)\version.vc
         1518  +
         1519  +default-hose:
         1520  +	@echo Hosing $(OUT_DIR)\* ...
         1521  +	@if exist $(OUT_DIR)\nul $(RMDIR) $(OUT_DIR)
         1522  +
         1523  +default-distclean: default-hose
         1524  +	@if exist $(WINDIR)\nmakehlp.exe del $(WINDIR)\nmakehlp.exe
         1525  +	@if exist $(WINDIR)\nmakehlp.obj del $(WINDIR)\nmakehlp.obj
         1526  +
         1527  +default-setup:
         1528  +	@if not exist $(OUT_DIR)\nul mkdir $(OUT_DIR)
         1529  +	@if not exist $(TMP_DIR)\nul mkdir $(TMP_DIR)
         1530  +
         1531  +!if "$(TESTPAT)" != ""
         1532  +TESTFLAGS = $(TESTFLAGS) -file $(TESTPAT)
   503   1533   !endif
   504   1534   
   505         -!if [echo REM = This file is generated from rules.vc > versions.vc]
   506         -!endif
   507         -!if exist("$(_TCL_H)")
   508         -!if [echo TCL_DOTVERSION = \>> versions.vc] \
   509         -   && [nmakehlp -V "$(_TCL_H)" TCL_VERSION >> versions.vc]
   510         -!endif
   511         -!endif
   512         -!include versions.vc
   513         -TCL_VERSION	= $(TCL_DOTVERSION:.=)
         1535  +default-test: default-setup $(PROJECT)
         1536  +	@set TCLLIBPATH=$(OUT_DIR:\=/)
         1537  +	@if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)"
         1538  +	cd "$(TESTDIR)" && $(DEBUGGER) $(TCLSH) all.tcl $(TESTFLAGS)
   514   1539   
   515         -!if $(TCLINSTALL)
   516         -TCLSH		= "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)$(SUFX).exe"
   517         -!if !exist($(TCLSH)) && $(TCL_THREADS)
   518         -TCLSH           = "$(_TCLDIR)\bin\tclsh$(TCL_VERSION)t$(SUFX).exe"
   519         -!endif
   520         -TCLSTUBLIB	= "$(_TCLDIR)\lib\tclstub$(TCL_VERSION).lib"
   521         -TCLIMPLIB	= "$(_TCLDIR)\lib\tcl$(TCL_VERSION)$(SUFX).lib"
   522         -TCL_LIBRARY	= $(_TCLDIR)\lib
   523         -COFFBASE	= \must\have\tcl\sources\to\build\this\target
   524         -TCLTOOLSDIR	= \must\have\tcl\sources\to\build\this\target
   525         -TCL_INCLUDES    = -I"$(_TCLDIR)\include"
         1540  +default-shell: default-setup $(PROJECT)
         1541  +	@set TCLLIBPATH=$(OUT_DIR:\=/)
         1542  +	@if exist $(LIBDIR) for %f in ("$(LIBDIR)\*.tcl") do @$(COPY) %f "$(OUT_DIR)"
         1543  +	$(DEBUGGER) $(TCLSH)
         1544  +
         1545  +# Generation of Windows version resource 
         1546  +!ifdef RCFILE
         1547  +
         1548  +# Note: don't use $** in below rule because there may be other dependencies
         1549  +# and only the "master" rc must be passed to the resource compiler
         1550  +$(TMP_DIR)\$(PROJECT).res: $(RCDIR)\$(PROJECT).rc
         1551  +	$(RESCMD) $(RCDIR)\$(PROJECT).rc
         1552  +
   526   1553   !else
   527         -TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)$(SUFX).exe"
   528         -!if !exist($(TCLSH)) && $(TCL_THREADS)
   529         -TCLSH		= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclsh$(TCL_VERSION)t$(SUFX).exe"
         1554  +
         1555  +# If parent makefile has not defined a resource definition file,
         1556  +# we will generate one from standard template.
         1557  +$(TMP_DIR)\$(PROJECT).res: $(TMP_DIR)\$(PROJECT).rc
         1558  +
         1559  +$(TMP_DIR)\$(PROJECT).rc:
         1560  +	@$(COPY) << $(TMP_DIR)\$(PROJECT).rc
         1561  +#include <winver.h>
         1562  +
         1563  +VS_VERSION_INFO VERSIONINFO
         1564  + FILEVERSION	COMMAVERSION
         1565  + PRODUCTVERSION	COMMAVERSION
         1566  + FILEFLAGSMASK	0x3fL
         1567  +#ifdef DEBUG
         1568  + FILEFLAGS	VS_FF_DEBUG
         1569  +#else
         1570  + FILEFLAGS	0x0L
         1571  +#endif
         1572  + FILEOS		VOS_NT_WINDOWS32
         1573  + FILETYPE	VFT_DLL
         1574  + FILESUBTYPE	0x0L
         1575  +BEGIN
         1576  +    BLOCK "StringFileInfo"
         1577  +    BEGIN
         1578  +        BLOCK "040904b0"
         1579  +        BEGIN
         1580  +            VALUE "FileDescription",  "Tcl extension " PROJECT
         1581  +            VALUE "OriginalFilename", PRJLIBNAME
         1582  +            VALUE "FileVersion",      DOTVERSION
         1583  +            VALUE "ProductName",      "Package " PROJECT " for Tcl"
         1584  +            VALUE "ProductVersion",   DOTVERSION 
         1585  +        END
         1586  +    END
         1587  +    BLOCK "VarFileInfo"
         1588  +    BEGIN
         1589  +        VALUE "Translation", 0x409, 1200
         1590  +    END
         1591  +END
         1592  +
         1593  +<<
         1594  +
         1595  +!endif # ifdef RCFILE
         1596  +
         1597  +!ifndef DISABLE_IMPLICIT_RULES
         1598  +DISABLE_IMPLICIT_RULES = 0
         1599  +!endif
         1600  +
         1601  +!if !$(DISABLE_IMPLICIT_RULES)
         1602  +# Implicit rule definitions - only for building library objects. For stubs and
         1603  +# main application, the master makefile should define explicit rules.
         1604  +
         1605  +{$(ROOT)}.c{$(TMP_DIR)}.obj::
         1606  +	$(CCPKGCMD) @<<
         1607  +$<
         1608  +<<
         1609  +
         1610  +{$(WINDIR)}.c{$(TMP_DIR)}.obj::
         1611  +	$(CCPKGCMD) @<<
         1612  +$<
         1613  +<<
         1614  +
         1615  +{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
         1616  +	$(CCPKGCMD) @<<
         1617  +$<
         1618  +<<
         1619  +
         1620  +{$(COMPATDIR)}.c{$(TMP_DIR)}.obj::
         1621  +	$(CCPKGCMD) @<<
         1622  +$<
         1623  +<<
         1624  +
         1625  +{$(RCDIR)}.rc{$(TMP_DIR)}.res:
         1626  +	$(RESCMD) $<
         1627  +
         1628  +{$(WINDIR)}.rc{$(TMP_DIR)}.res:
         1629  +	$(RESCMD) $<
         1630  +
         1631  +{$(TMP_DIR)}.rc{$(TMP_DIR)}.res:
         1632  +	$(RESCMD) $<
         1633  +
         1634  +.SUFFIXES:
         1635  +.SUFFIXES:.c .rc
         1636  +
         1637  +!endif
         1638  +
         1639  +################################################################
         1640  +# 14. Sanity check selected options against Tcl build options
         1641  +# When building an extension, certain configuration options should
         1642  +# match the ones used when Tcl was built. Here we check and
         1643  +# warn on a mismatch.
         1644  +!if ! $(DOING_TCL)
         1645  +
         1646  +!if $(TCLINSTALL) # Building against an installed Tcl
         1647  +!if exist("$(_TCLDIR)\lib\nmake\tcl.nmake")
         1648  +TCLNMAKECONFIG = "$(_TCLDIR)\lib\nmake\tcl.nmake"
   530   1649   !endif
   531         -TCLSTUBLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tclstub$(TCL_VERSION).lib"
   532         -TCLIMPLIB	= "$(_TCLDIR)\win\$(BUILDDIRTOP)\tcl$(TCL_VERSION)$(SUFX).lib"
   533         -TCL_LIBRARY	= $(_TCLDIR)\library
   534         -COFFBASE	= "$(_TCLDIR)\win\coffbase.txt"
   535         -TCLTOOLSDIR	= $(_TCLDIR)\tools
   536         -TCL_INCLUDES	= -I"$(_TCLDIR)\generic" -I"$(_TCLDIR)\win"
         1650  +!else # ! $(TCLINSTALL) - building against Tcl source
         1651  +!if exist("$(OUT_DIR)\tcl.nmake")
         1652  +TCLNMAKECONFIG = "$(OUT_DIR)\tcl.nmake"
   537   1653   !endif
   538         -
   539         -!endif
         1654  +!endif # TCLINSTALL
   540   1655   
   541         -#----------------------------------------------------------
   542         -# Optionally check for Tk info for building extensions.
   543         -#----------------------------------------------------------
   544         -
   545         -!ifdef PROJECT_REQUIRES_TK
   546         -!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
         1656  +!if $(CONFIG_CHECK)
         1657  +!ifdef TCLNMAKECONFIG
         1658  +!include $(TCLNMAKECONFIG)
   547   1659   
   548         -!if !defined(TKDIR)
   549         -!if exist("$(_INSTALLDIR)\..\include\tk.h")
   550         -TKINSTALL      = 1
   551         -_TKDIR         = $(_INSTALLDIR)\..
   552         -_TK_H          = $(_TKDIR)\include\tk.h
   553         -TKDIR          = $(_TKDIR)
   554         -!elseif exist("$(_TCLDIR)\include\tk.h")
   555         -TKINSTALL      = 1
   556         -_TKDIR         = $(_TCLDIR)
   557         -_TK_H          = $(_TKDIR)\include\tk.h
   558         -TKDIR          = $(_TKDIR)
         1660  +!if defined(CORE_MACHINE) && "$(CORE_MACHINE)" != "$(MACHINE)"
         1661  +!error ERROR: Build target ($(MACHINE)) does not match the Tcl library architecture ($(CORE_MACHINE)).
         1662  +!endif
         1663  +!if defined(CORE_USE_THREAD_ALLOC) && $(CORE_USE_THREAD_ALLOC) != $(USE_THREAD_ALLOC)
         1664  +!message WARNING: Value of USE_THREAD_ALLOC ($(USE_THREAD_ALLOC)) does not match its Tcl core value ($(CORE_USE_THREAD_ALLOC)).
   559   1665   !endif
   560         -!else
   561         -_TKDIR = $(TKDIR:/=\)
   562         -!if exist("$(_TKDIR)\include\tk.h")
   563         -TKINSTALL      = 1
   564         -_TK_H          = $(_TKDIR)\include\tk.h
   565         -!elseif exist("$(_TKDIR)\generic\tk.h")
   566         -TKINSTALL      = 0
   567         -_TK_H          = $(_TKDIR)\generic\tk.h
   568         -!else
   569         -MSG =^
   570         -Failed to find tk.h. The TKDIR macro does not appear correct.
   571         -!error $(MSG)
         1666  +!if defined(CORE_DEBUG) && $(CORE_DEBUG) != $(DEBUG)
         1667  +!message WARNING: Value of DEBUG ($(DEBUG)) does not match its Tcl library configuration ($(DEBUG)).
   572   1668   !endif
   573   1669   !endif
   574   1670   
   575         -!if defined(TKDIR)
   576         -TK_DOTVERSION = 8.4
   577         -!if exist("$(_TK_H)")
   578         -!if [echo TK_DOTVERSION = \>> versions.vc] \
   579         -   && [nmakehlp -V "$(_TK_H)" TK_VERSION >> versions.vc]
   580         -!endif
   581         -!endif
   582         -!include versions.vc
   583         -TK_VERSION = $(TK_DOTVERSION:.=)
         1671  +!endif # TCLNMAKECONFIG
   584   1672   
   585         -!if $(TKINSTALL)
   586         -WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)$(SUFX).exe"
   587         -!if !exist($(WISH)) && $(TCL_THREADS)
   588         -WISH		= "$(_TKDIR)\bin\wish$(TK_VERSION)t$(SUFX).exe"
   589         -!endif
   590         -TKSTUBLIB	= "$(_TKDIR)\lib\tkstub$(TK_VERSION).lib"
   591         -TKIMPLIB	= "$(_TKDIR)\lib\tk$(TK_VERSION)$(SUFX).lib"
   592         -TK_INCLUDES     = -I"$(_TKDIR)\include"
   593         -!else
   594         -WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)$(SUFX).exe"
   595         -!if !exist($(WISH)) && $(TCL_THREADS)
   596         -WISH		= "$(_TKDIR)\win\$(BUILDDIRTOP)\wish$(TCL_VERSION)t$(SUFX).exe"
   597         -!endif
   598         -TKSTUBLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tkstub$(TCL_VERSION).lib"
   599         -TKIMPLIB	= "$(_TKDIR)\win\$(BUILDDIRTOP)\tk$(TCL_VERSION)$(SUFX).lib"
   600         -TK_INCLUDES     = -I"$(_TKDIR)\generic" -I"$(_TKDIR)\win" -I"$(_TKDIR)\xlib"
   601         -!endif
   602         -
   603         -!endif
   604         -!endif
   605         -!endif
   606         -
   607         -
   608         -#----------------------------------------------------------
   609         -# Setup the fully qualified OUT_DIR path as OUT_DIR_PATH
   610         -#----------------------------------------------------------
   611         -!if [echo OUT_DIR_PATH = \>> versions.vc] \
   612         -    && [nmakehlp -Q "$(OUT_DIR)" >> versions.vc]
   613         -!endif
   614         -!include versions.vc
         1673  +!endif # ! $(DOING_TCL)
   615   1674   
   616   1675   
   617   1676   #----------------------------------------------------------
   618   1677   # Display stats being used.
   619   1678   #----------------------------------------------------------
   620   1679   
   621   1680   !message *** Intermediate directory will be '$(TMP_DIR)'
   622   1681   !message *** Output directory will be '$(OUT_DIR)'
   623   1682   !message *** Suffix for binaries will be '$(SUFX)'
   624   1683   !message *** Optional defines are '$(OPTDEFINES)'
   625   1684   !message *** Compiler version $(VCVER). Target machine is $(MACHINE)
   626   1685   !message *** Host architecture is $(NATIVE_ARCH)
   627         -!message *** Compiler options '$(COMPILERFLAGS) $(OPTIMIZATIONS) $(DEBUGFLAGS) $(WARNINGS)'
   628         -!message *** Link options '$(LINKERFLAGS)'
   629   1686   
   630         -!endif
         1687  +!endif # ifdef _RULES_VC

Added win/targets.vc.

            1  +#------------------------------------------------------------- -*- makefile -*-
            2  +# targets.vc --
            3  +#
            4  +# Part of the nmake based build system for Tcl and its extensions.
            5  +# This file defines some standard targets for the convenience of extensions
            6  +# and can be optionally included by the extension makefile.
            7  +# See TIP 477 (https://core.tcl.tk/tips/doc/trunk/tip/477.md) for docs.
            8  +
            9  +$(PROJECT): setup pkgindex $(PRJLIB)
           10  +
           11  +!ifdef PRJ_STUBOBJS
           12  +$(PROJECT): $(PRJSTUBLIB)
           13  +$(PRJSTUBLIB): $(PRJ_STUBOBJS)
           14  +	$(LIBCMD) $**
           15  +
           16  +$(PRJ_STUBOBJS):
           17  +	$(CCSTUBSCMD) %s
           18  +!endif # PRJ_STUBOBJS
           19  +
           20  +!ifdef PRJ_MANIFEST
           21  +$(PROJECT): $(PRJLIB).manifest
           22  +$(PRJLIB).manifest: $(PRJ_MANIFEST)
           23  +	@nmakehlp -s << $** >$@
           24  +@MACHINE@	  $(MACHINE:IX86=X86)
           25  +<<
           26  +!endif
           27  +
           28  +!if "$(PROJECT)" != "tcl" && "$(PROJECT)" != "tk"
           29  +$(PRJLIB): $(PRJ_OBJS) $(RESFILE)
           30  +!if $(STATIC_BUILD)
           31  +       $(LIBCMD) $**
           32  +!else
           33  +       $(DLLCMD) $**
           34  +       $(_VC_MANIFEST_EMBED_DLL)
           35  +!endif
           36  +       -@del $*.exp
           37  +!endif
           38  +
           39  +!ifndef DISABLE_STANDARD_TARGETS
           40  +DISABLE_STANDARD_TARGETS = 0
           41  +!endif
           42  +
           43  +!if !$(DISABLE_STANDARD_TARGETS)
           44  +setup: default-setup
           45  +install: default-install
           46  +clean: default-clean
           47  +realclean: hose
           48  +hose: default-hose
           49  +distclean: realclean default-distclean
           50  +test: default-test
           51  +shell: default-shell
           52  +!endif