#--------------------------------------------------------------------------------
# makefile.vc --
#
#	Microsoft Visual C++ makefile for use with nmake.exe v1.62+ (VC++ 5.0+)
#
# See the file "license.terms" for information on usage and redistribution
# of this file, and for a DISCLAIMER OF ALL WARRANTIES.
# 
# Copyright (c) 1995-1996 Sun Microsystems, Inc.
# Copyright (c) 1998-2000 Ajuba Solutions.
# Copyright (c) 2001 ActiveState Corporation.
# Copyright (c) 2001 Tomasoft Engineering.
#
#--------------------------------------------------------------------------------
# RCS: @(#) $Id: makefile.vc,v 1.69 2001/11/08 00:39:01 davygrvy Exp $
#--------------------------------------------------------------------------------

!if "$(MSVCDIR)" == ""
MSG = ^
You'll need to run vcvars32.bat from Developer Studio, first, to setup^
the environment.  Jump to this line to read the new instructions.
!error $(MSG)
!endif

#--------------------------------------------------------------------------------
# HOW TO USE this makefile:
#
# 1)  It is now necessary to have MSVCDir set in the environment.  This is used
#     as a check to see if vcvars32.bat had been run prior to running nmake or
#     during the install of Microsoft Developer Studio, MSVCDir had been set
#     globally and the PATH adjusted.  Either way is valid.
#
#     You'll need to run vcvars32.bat contained in the MsDev's vc(98)/bin
#     directory to setup the proper environment, if needed, for your current
#     setup.  This is a needed bootstrap requirement and allows the swapping of
#     different environments to be easier.
#
# 2)  To use the Platform SDK (not expressly needed), run setenv.bat after
#     vcvars32.bat according to the instructions for it.  This can also turn on
#     the 64-bit compiler, if your SDK has it.
#
# 3)  Targets are:
#	release  -- builds the core, the shell and the dlls. (default)
#	dlls     -- just builds the windows extensions and the 16-bit DOS
#		    pipe/thunk driver.
#	shell    -- Just builds the shell and the core.
#	core     -- Only builds the core.
#	all      -- builds everything.
#	test     -- builds and runs the test suite.
#	tcltest  -- just builds the binaries for the test suite.
#	install  -- installs the built binaries and libraries to $(INSTALLDIR)
#		    as the root of the install tree.
#	plugin   -- [currently out-dated].
#	clean    -- removes the contents of $(TMP_DIR) and $(OUT_DIR)
#	genstubs -- rebuilds the Stubs table and support files (dev only).
#	winhelp  -- builds the windows .hlp file for Tcl from the troff man
#		    files.
#
# 4)  Macros usable on the commandline:
#	INSTALLDIR=<path>
#		Sets where to install Tcl from the built binaries.
#		C:\Progra~1\Tcl is assumed when not specified.
#
#	OPTS=static,msvcrt,threads,symbols,profile,none
#		Sets special options for the core.  The default is for none.
#		Any combination of the above may be used (comma separated).
#		'none' will over-ride everything to nothing.
#
#		static  =  Builds a static library of the core instead of a
#			   dll.  The shell will be static (and large), as well.
#		msvcrt  =  Effects the static option only to switch it from
#			   using libcmt(d) as the C runtime [by default] to
#			   msvcrt(d). This is useful for static embedding
#			   support.
#		threads =  Turns on full multithreading support.
#		symbols =  Adds symbols for step debugging.
#		profile =  Adds profiling hooks.  Map file is assumed.
#
#	STATS=memdbg,compdbg,compstat,none
#		Sets optional memory and bytecode compiler debugging code added
#		to the core.  The default is for none.  Any combination of the
#		above may be used (comma separated).  'none' will over-ride
#		everything to nothing.
#
#		memdbg   = Enables the debugging memory allocator.
#		compdbg  = Enables byte compilation logging.
#		compstat = Enables byte compilation statistics gathering.
#
#	MACHINE=(IX86|IA64|ALPHA)
#		Set the machine type used for the compiler, linker, and
#		resource compiler.  This hook is needed to tell the tools
#		when alternate platforms are requested.  IX86 is the default
#		when not specified.
#
#	TMP_DIR=<path>
#	OUT_DIR=<path>
#		Hooks to allow the intermediate and output directories to be
#		changed.  $(OUT_DIR) is assumed to be $(TMP_DIR) by default.
#		$(TMP_DIR) will be $(BINROOT)\(Release|Debug) based on if
#		symbols are requested.
#
# 5)  Examples:
#                        Standard (no frills)
#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
#       Setting environment for using Microsoft Visual C++ tools.
#       c:\tcl_src\win\>nmake -f makefile.vc release
#       c:\tcl_src\win\>nmake -f makefile.vc install INSTALLDIR=c:\progra~1\tcl
#
#                         Building for Win64
#       c:\tcl_src\win\>c:\progra~1\micros~1\vc98\bin\vcvars32.bat
#       Setting environment for using Microsoft Visual C++ tools.
#       c:\tcl_src\win\>c:\progra~1\platfo~1\setenv.bat /pre64 /RETAIL
#       Targeting Windows pre64 RETAIL
#       c:\tcl_src\win\>nmake -f makefile.vc MACHINE=IA64
#
#--------------------------------------------------------------------------------
#================================================================================
#################################################################################


#    //==================================================================\\
#   >>[               -> Do not modify below this line. <-               ]<<
#   >>[  Please, use the commandline macros to modify how Tcl is built.  ]<<
#   >>[  If you need more features, send us a patch for more macros.     ]<<
#    \\==================================================================//


#################################################################################
#================================================================================
#--------------------------------------------------------------------------------
PROJECT	= tcl
!include "rules.vc"


STUBPREFIX = $(PROJECT)stub
DOTVERSION = 8.4
VERSION = $(DOTVERSION:.=)

DDEDOTVERSION = 1.2
DDEVERSION = $(DDEDOTVERSION:.=)

REGDOTVERSION = 1.0
REGVERSION = $(REGDOTVERSION:.=)

BINROOT		= .
ROOT		= ..

TCLIMPLIB	= $(OUT_DIR)\$(PROJECT)$(VERSION)$(SUFX).lib
TCLLIBNAME	= $(PROJECT)$(VERSION)$(SUFX).$(EXT)
TCLLIB		= $(OUT_DIR)\$(TCLLIBNAME)

TCLSTUBLIBNAME	= $(STUBPREFIX)$(VERSION).lib
TCLSTUBLIB	= $(OUT_DIR)\$(TCLSTUBLIBNAME)

TCLSH		= $(OUT_DIR)\$(PROJECT)sh$(VERSION)$(SUFX).exe
TCLPIPEDLLNAME	= $(PROJECT)pip$(VERSION).dll
TCLPIPEDLL	= $(OUT_DIR)\$(TCLPIPEDLLNAME)

TCLREGDLLNAME	= $(PROJECT)reg$(REGVERSION)$(SUFX:t=).$(EXT)
TCLREGDLL	= $(OUT_DIR)\$(TCLREGDLLNAME)

TCLDDEDLLNAME	= $(PROJECT)dde$(DDEVERSION)$(SUFX:t=).$(EXT)
TCLDDEDLL	= $(OUT_DIR)\$(TCLDDEDLLNAME)

TCLTEST		= $(OUT_DIR)\$(PROJECT)test.exe
CAT32		= $(TMP_DIR)\cat32.exe
RMDIR		= .\rmd.bat
MKDIR		= .\mkd.bat
RM		= del

LIB_INSTALL_DIR	= $(INSTALLDIR)\lib
BIN_INSTALL_DIR	= $(INSTALLDIR)\bin
SCRIPT_INSTALL_DIR	= $(INSTALLDIR)\lib\tcl$(DOTVERSION)
INCLUDE_INSTALL_DIR	= $(INSTALLDIR)\include

TCLSHOBJS = \
	$(TMP_DIR)\tclAppInit.obj \
	$(TMP_DIR)\tclsh.res

TCLTESTOBJS = \
	$(TMP_DIR)\tclTest.obj \
	$(TMP_DIR)\tclTestObj.obj \
	$(TMP_DIR)\tclTestProcBodyObj.obj \
	$(TMP_DIR)\tclThreadTest.obj \
	$(TMP_DIR)\tclWinTest.obj \
	$(TMP_DIR)\testMain.obj

TCLOBJS = \
	$(TMP_DIR)\regcomp.obj \
	$(TMP_DIR)\regexec.obj \
	$(TMP_DIR)\regfree.obj \
	$(TMP_DIR)\regerror.obj \
	$(TMP_DIR)\strftime.obj \
	$(TMP_DIR)\tclAlloc.obj \
	$(TMP_DIR)\tclAsync.obj \
	$(TMP_DIR)\tclBasic.obj \
	$(TMP_DIR)\tclBinary.obj \
	$(TMP_DIR)\tclCkalloc.obj \
	$(TMP_DIR)\tclClock.obj \
	$(TMP_DIR)\tclCmdAH.obj \
	$(TMP_DIR)\tclCmdIL.obj \
	$(TMP_DIR)\tclCmdMZ.obj \
	$(TMP_DIR)\tclCompCmds.obj \
	$(TMP_DIR)\tclCompExpr.obj \
	$(TMP_DIR)\tclCompile.obj \
	$(TMP_DIR)\tclDate.obj \
	$(TMP_DIR)\tclEncoding.obj \
	$(TMP_DIR)\tclEnv.obj \
	$(TMP_DIR)\tclEvent.obj \
	$(TMP_DIR)\tclExecute.obj \
	$(TMP_DIR)\tclFCmd.obj \
	$(TMP_DIR)\tclFileName.obj \
	$(TMP_DIR)\tclGet.obj \
	$(TMP_DIR)\tclHash.obj \
	$(TMP_DIR)\tclHistory.obj \
	$(TMP_DIR)\tclIndexObj.obj \
	$(TMP_DIR)\tclInterp.obj \
	$(TMP_DIR)\tclIO.obj \
	$(TMP_DIR)\tclIOCmd.obj \
	$(TMP_DIR)\tclIOGT.obj \
	$(TMP_DIR)\tclIOSock.obj \
	$(TMP_DIR)\tclIOUtil.obj \
	$(TMP_DIR)\tclLink.obj \
	$(TMP_DIR)\tclLiteral.obj \
	$(TMP_DIR)\tclListObj.obj \
	$(TMP_DIR)\tclLoad.obj \
	$(TMP_DIR)\tclMain.obj \
	$(TMP_DIR)\tclNamesp.obj \
	$(TMP_DIR)\tclNotify.obj \
	$(TMP_DIR)\tclObj.obj \
	$(TMP_DIR)\tclPanic.obj \
	$(TMP_DIR)\tclParse.obj \
	$(TMP_DIR)\tclParseExpr.obj \
	$(TMP_DIR)\tclPipe.obj \
	$(TMP_DIR)\tclPkg.obj \
	$(TMP_DIR)\tclPosixStr.obj \
	$(TMP_DIR)\tclPreserve.obj \
	$(TMP_DIR)\tclProc.obj \
	$(TMP_DIR)\tclRegexp.obj \
	$(TMP_DIR)\tclResolve.obj \
	$(TMP_DIR)\tclResult.obj \
	$(TMP_DIR)\tclScan.obj \
	$(TMP_DIR)\tclStringObj.obj \
	$(TMP_DIR)\tclStubInit.obj \
	$(TMP_DIR)\tclStubLib.obj \
	$(TMP_DIR)\tclThread.obj \
	$(TMP_DIR)\tclThreadJoin.obj \
	$(TMP_DIR)\tclTimer.obj \
	$(TMP_DIR)\tclUtf.obj \
	$(TMP_DIR)\tclUtil.obj \
	$(TMP_DIR)\tclVar.obj \
	$(TMP_DIR)\tclWin32Dll.obj \
	$(TMP_DIR)\tclWinChan.obj \
	$(TMP_DIR)\tclWinConsole.obj \
	$(TMP_DIR)\tclWinSerial.obj \
	$(TMP_DIR)\tclWinError.obj \
	$(TMP_DIR)\tclWinFCmd.obj \
	$(TMP_DIR)\tclWinFile.obj \
	$(TMP_DIR)\tclWinInit.obj \
	$(TMP_DIR)\tclWinLoad.obj \
	$(TMP_DIR)\tclWinMtherr.obj \
	$(TMP_DIR)\tclWinNotify.obj \
	$(TMP_DIR)\tclWinPipe.obj \
	$(TMP_DIR)\tclWinSock.obj \
	$(TMP_DIR)\tclWinThrd.obj \
	$(TMP_DIR)\tclWinTime.obj \
!if $(STATIC_BUILD) == 0
	$(TMP_DIR)\tcl.res
!endif

TCLSTUBOBJS = $(TMP_DIR)\tclStubLib.obj

WINDIR		= $(ROOT)\win
GENERICDIR	= $(ROOT)\generic

TCL_INCLUDES	= -I"$(WINDIR)" -I"$(GENERICDIR)"
TCL_DEFINES	= $(OPTDEFINES)

######################################################################
# Compile flags
######################################################################

!if !$(DEBUG)
# This cranks the optimization level to maximize speed
!IF "$(MACHINE)" == "IA64"
cdebug = -O2 -Gs
!ELSE
cdebug = -O2 -Gs -GD
!ENDIF
!ELSE IF "$(MACHINE)" == "IA64"
cdebug = -Od -Zi
!ELSE
cdebug = -Z7 -Od -WX
!ENDIF

# declarations common to all compiler options
cflags = -c -W3 -nologo -Fp$(TMP_DIR)\ -YX

!if $(MSVCRT)
crt = -MD$(DBGX)
!else
crt = -MT$(DBGX)
!endif

BASE_CLFAGS	= $(cdebug) $(cflags) $(crt) $(TCL_INCLUDES)
TCL_CFLAGS	= $(BASE_CLFAGS) $(TCL_DEFINES)
CON_CFLAGS	= $(cdebug) $(cflags) $(crt) -DCONSOLE

######################################################################
# Link flags
######################################################################

!if $(DEBUG)
ldebug	= -debug:full -debugtype:cv
!else
ldebug	= -release
!endif

# declarations common to all linker options
lflags	= -nologo -machine:$(MACHINE)

# declarations for use on Intel i386, i486, and Pentium systems
!IF "$(MACHINE)" == "IX86"
DLLENTRY = @12
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
!ELSE IF "$(MACHINE)" == "IA64"
DLLENTRY = @12
dlllflags = $(lflags) -dll
!ELSE
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll
!ENDIF

conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup

baselibs   = kernel32.lib advapi32.lib user32.lib
winlibs	   = $(baselibs) gdi32.lib

######################################################################
# Project specific targets
######################################################################

release:    setup $(TCLSH) dlls
core:	    setup $(TCLLIB)
shell:	    setup $(TCLSH)
dlls:	    setup $(TCLPIPEDLL) $(TCLREGDLL) $(TCLDDEDLL)
all:	    setup $(TCLSH) dlls $(CAT32) 
tcltest:    setup $(TCLTEST) dlls $(CAT32)
plugin:	    setup $(TCLPLUGINDLL) $(TCLSHP)
install:    install-binaries install-libraries
test:	    setup $(TCLTEST) dlls $(CAT32)
	set TCL_LIBRARY=$(ROOT)/library
	$(TCLTEST) $(ROOT)/tests/all.tcl

setup:
	@$(MKDIR) $(TMP_DIR)
	@$(MKDIR) $(OUT_DIR)

!if !$(STATIC_BUILD)
$(TCLIMPLIB): $(TCLLIB)
!endif

$(TCLLIB): $(TCLOBJS)
!if $(STATIC_BUILD)
	$(lib32) -nologo -out:$@ @<<
!else
	$(link32) $(ldebug) $(dlllflags) -out:$@ $(winlibs) @<<
!endif
$(TCLOBJS)
<<
!if !$(STATIC_BUILD)
	-@del $*.exp
!endif

$(TCLSTUBLIB): $(TCLSTUBOBJS)
	$(lib32) -nologo -out:$@ $(TCLSTUBOBJS)

$(TCLSH): $(TCLSHOBJS) $(TCLIMPLIB)
	$(link32) $(ldebug) $(conlflags) -stack:2300000 -out:$@ $(baselibs) $**

$(TCLTEST): $(TCLTESTOBJS) $(TCLIMPLIB)
	$(link32) $(ldebug) $(conlflags) -stack:2300000 -out:$@ $(baselibs) $**

$(TCLPIPEDLL): $(WINDIR)\stub16.c
	$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $(WINDIR)\stub16.c
	$(link32) $(ldebug) $(conlflags) -out:$@ $(TMP_DIR)\stub16.obj $(baselibs)


$(TCLDDEDLL): $(TMP_DIR)\tclWinDde.obj $(TCLSTUBLIB)
!if $(STATIC_BUILD)
	$(lib32) -nologo -out:$@ $(TMP_DIR)\tclWinDde.obj
!else
	$(link32) $(ldebug) $(dlllflags) -out:$@ $** $(baselibs)
	-@del $*.exp
	-@del $*.lib
!endif


$(TCLREGDLL): $(TMP_DIR)\tclWinReg.obj $(TCLSTUBLIB)
!if $(STATIC_BUILD)
	$(lib32) -nologo -out:$@ $(TMP_DIR)\tclWinReg.obj
!else
	$(link32) $(ldebug) $(dlllflags) -out:$@ $** $(baselibs)
	-@del $*.exp
	-@del $*.lib
!endif


$(CAT32): $(WINDIR)\cat.c
	$(cc32) $(CON_CFLAGS) -Fo$(TMP_DIR)\ $?
	$(link32) $(conlflags) -out:$@ -stack:16384 $(TMP_DIR)\cat.obj $(baselibs)

install-binaries: $(TCLSH)
	$(MKDIR) "$(BIN_INSTALL_DIR)"
	$(MKDIR) "$(LIB_INSTALL_DIR)"
	@echo installing $(TCLDLLNAME)
	@copy "$(TCLLIB)" "$(BIN_INSTALL_DIR)"
	@copy "$(TCLIMPLIB)" "$(LIB_INSTALL_DIR)"
	@echo installing "$(TCLSH)"
	@copy "$(TCLSH)" "$(BIN_INSTALL_DIR)"
	@echo installing $(TCLPIPEDLLNAME)
	@copy "$(TCLPIPEDLL)" "$(BIN_INSTALL_DIR)"
	@echo installing $(TCLSTUBLIBNAME)
	@copy "$(TCLSTUBLIB)" "$(LIB_INSTALL_DIR)"

install-libraries:
	-@$(MKDIR) "$(LIB_INSTALL_DIR)"
	-@$(MKDIR) "$(INCLUDE_INSTALL_DIR)"
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)"
	@echo installing http1.0
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\http1.0"
	-@copy "$(ROOT)\library\http1.0\http.tcl"     "$(SCRIPT_INSTALL_DIR)\http1.0"
	-@copy "$(ROOT)\library\http1.0\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\http1.0"
	@echo installing http2.4
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\http2.4"
	-@copy "$(ROOT)\library\http\http.tcl"     "$(SCRIPT_INSTALL_DIR)\http2.4"
	-@copy "$(ROOT)\library\http\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\http2.4"
	@echo installing opt0.4
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\opt0.4"
	-@copy "$(ROOT)\library\opt\optparse.tcl" "$(SCRIPT_INSTALL_DIR)\opt0.4"
	-@copy "$(ROOT)\library\opt\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\opt0.4"
	@echo installing msgcat1.2
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\msgcat1.2"
	-@copy "$(ROOT)\library\msgcat\msgcat.tcl"   "$(SCRIPT_INSTALL_DIR)\msgcat1.2"
	-@copy "$(ROOT)\library\msgcat\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\msgcat1.2"
	@echo installing $(TCLDDEDLLNAME)
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\dde1.2"
	-@copy "$(TCLDDEDLL)" "$(SCRIPT_INSTALL_DIR)\dde1.2"
	-@copy "$(ROOT)\library\dde\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\dde1.2"
	@echo installing $(TCLREGDLLNAME)
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\reg1.0"
	-@copy "$(TCLREGDLL)" "$(SCRIPT_INSTALL_DIR)\reg1.0"
	-@copy "$(ROOT)\library\reg\pkgIndex.tcl" "$(SCRIPT_INSTALL_DIR)\reg1.0"
	@echo installing encoding files
	-@$(MKDIR) "$(SCRIPT_INSTALL_DIR)\encoding"
	-@copy "$(ROOT)\library\encoding\*.enc" "$(SCRIPT_INSTALL_DIR)\encoding"
	@echo installing library files
	-@copy "$(GENERICDIR)\tcl.h"          "$(INCLUDE_INSTALL_DIR)"
	-@copy "$(GENERICDIR)\tclDecls.h"     "$(INCLUDE_INSTALL_DIR)"
	-@copy "$(GENERICDIR)\tclPlatDecls.h" "$(INCLUDE_INSTALL_DIR)"
	-@copy "$(ROOT)\library\history.tcl"  "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\init.tcl"     "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\ldAout.tcl"   "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\parray.tcl"   "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\safe.tcl"     "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\tclIndex"     "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\package.tcl"  "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\word.tcl"     "$(SCRIPT_INSTALL_DIR)"
	-@copy "$(ROOT)\library\auto.tcl"     "$(SCRIPT_INSTALL_DIR)"

#
# Regenerate the stubs files.
#

genstubs:
	tclsh$(VERSION) $(ROOT)\tools\genStubs.tcl $(GENERICDIR) \
		$(GENERICDIR)\tcl.decls $(GENERICDIR)\tclInt.decls

#
# Regenerate the windows help files.
#

TCLTOOLS	= $(ROOT)/tools
MAN2TCL		= $(TCLTOOLS)/man2tcl
TCLRTF		= $(TCLTOOLS)/tcl.rtf
MAN2HELP	= $(TCLTOOLS)/man2help.tcl

winhelp: $(OUT_DIR)\$(PROJECT)$(VERSION).hlp

$(OUT_DIR)\$(PROJECT)$(VERSION).hlp : $(TCLRTF)
	cd $(TCLTOOLS)
	start /wait hcrtf.exe -xn tcl.hpj
	copy $(PROJECT)$(VERSION).hlp ..\win\$(OUT_DIR)
	copy $(PROJECT)$(VERSION).cnt ..\win\$(OUT_DIR)

$(MAN2TCL).exe: $(MAN2TCL).obj 
	cd $(TCLTOOLS)
	$(cc32) -nologo -G4 -ML -O2 $(MAN2TCL).c

$(TCLRTF): $(MAN2TCL).exe $(TCLSH)
	cd $(TCLTOOLS)
	..\win\$(TCLSH) $(MAN2HELP) $(PROJECT) $(VERSION) $(ROOT)/doc ../../tk$(DOTVERSION)/doc
#
# Special case object file targets
#

$(TMP_DIR)\tclWinInit.obj: $(WINDIR)\tclWinInit.c
	$(cc32) -DBUILD_tcl $(TCL_CFLAGS) $(EXTFLAGS) -Fo$(TMP_DIR)\ $?

$(TMP_DIR)\testMain.obj: $(WINDIR)\tclAppInit.c
	$(cc32) $(TCL_CFLAGS) -DTCL_TEST -Fo$(TMP_DIR)\testMain.obj $?

$(TMP_DIR)\tclTest.obj: $(GENERICDIR)\tclTest.c
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?

$(TMP_DIR)\tclTestObj.obj: $(GENERICDIR)\tclTestObj.c
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?

$(TMP_DIR)\tclWinTest.obj: $(WINDIR)\tclWinTest.c
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?

$(TMP_DIR)\tclAppInit.obj: $(WINDIR)\tclAppInit.c
	$(cc32) $(TCL_CFLAGS) -Fo$@ $?

# The following objects should be built using the stub interfaces

$(TMP_DIR)\tclWinReg.obj: $(WINDIR)\tclWinReg.c
!if $(STATIC_BUILD)
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DSTATIC_BUILD -Fo$@ $?
!else
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DUSE_TCL_STUBS -Fo$@ $?
!endif


$(TMP_DIR)\tclWinDde.obj: $(WINDIR)\tclWinDde.c
!if $(STATIC_BUILD)
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DSTATIC_BUILD -Fo$@ $?
!else
	$(cc32) $(BASE_CLFAGS) -DTCL_THREADS=1 -DUSE_TCL_STUBS -Fo$@ $?
!endif


# The following objects are part of the stub library and should not
# be built as DLL objects but none of the symbols should be exported

$(TMP_DIR)\tclStubLib.obj: $(GENERICDIR)\tclStubLib.c
	$(cc32) $(cdebug) $(cflags) -Zl -DSTATIC_BUILD $(TCL_INCLUDES) -Fo$@ $?


# Dedependency rules

$(GENERICDIR)\regcomp.c: \
	$(GENERICDIR)\regguts.h \
	$(GENERICDIR)\regc_lex.c \
	$(GENERICDIR)\regc_color.c \
	$(GENERICDIR)\regc_nfa.c \
	$(GENERICDIR)\regc_cvec.c \
	$(GENERICDIR)\regc_locale.c
$(GENERICDIR)\regcustom.h: \
	$(GENERICDIR)\tclInt.h \
	$(GENERICDIR)\tclPort.h \
	$(GENERICDIR)\regex.h
$(GENERICDIR)\regexec.c: \
	$(GENERICDIR)\rege_dfa.c \
	$(GENERICDIR)\regguts.h
$(GENERICDIR)\regerror.c: $(GENERICDIR)\regguts.h
$(GENERICDIR)\regfree.c: $(GENERICDIR)\regguts.h
$(GENERICDIR)\regfronts.c: $(GENERICDIR)\regguts.h
$(GENERICDIR)\regguts.h: $(GENERICDIR)\regcustom.h

#
# Implicit rules
#

{$(WINDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<<
$<
<<

{$(GENERICDIR)}.c{$(TMP_DIR)}.obj::
    $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<<
$<
<<

{$(ROOT)\compat}.c{$(TMP_DIR)}.obj::
    $(cc32) -DBUILD_tcl $(TCL_CFLAGS) -Fo$(TMP_DIR)\ @<<
$<
<<

{$(WINDIR)}.rc{$(TMP_DIR)}.res:
	$(rc32) -fo $@ -r -i $(GENERICDIR) $(include32) -D__WIN32__ \
		$(TCL_DEFINES) -d DEBUG=$(DEBUG) $<

clean:
	-@$(RM) $(OUT_DIR)\*.exp 
	-@$(RM) $(OUT_DIR)\*.lib 
	-@$(RM) $(OUT_DIR)\*.dll 
	-@$(RM) $(OUT_DIR)\*.exe
	-@$(RM) $(OUT_DIR)\*.pdb
	-@$(RM) $(TMP_DIR)\*.pch
	-@$(RM) $(TMP_DIR)\*.obj
	-@$(RM) $(TMP_DIR)\*.res
	-@$(RM) $(TMP_DIR)\*.exe
	-@$(RMDIR) $(OUT_DIR)
	-@$(RMDIR) $(TMP_DIR)

.SUFFIXES:.c .rc
