#----------------------------------------------------------------------
# Get all the standard definitions
#----------------------------------------------------------------------
!include ../include/common1.mak

#----------------------------------------------------------------------
# Modify or override the default definitions here.
#----------------------------------------------------------------------
CPP_DEFINES=$(CPP_DEFINES) /D "main"="Tcl_Main" \
	    /D "NO_DIRENT_H" /D "TB_EXPAND" /D "HAVE_UNISTD_H" \
	    /D "NO_SYS_WAIT" /D "NO_UNION_WAIT"

LINK_LIBS=user32.lib gdi32.lib wsock32.lib

#----------------------------------------------------------------------
# Create the final definitions as a combination of the modified
# definitions and our own.
#----------------------------------------------------------------------
!include ../include/common2.mak

#----------------------------------------------------------------------
# Define the objects that make up modules
#----------------------------------------------------------------------

# The order of these objects is optimized for precompiled header usage.
TCL_OBJS = \
	$(DIR)\panic.obj \
	$(DIR)\tclAppInit.obj \
	$(DIR)\tclmain.obj \
	$(DIR)\regexp.obj \
	$(DIR)\tclasync.obj \
	$(DIR)\tclbasic.obj \
	$(DIR)\tclcmdah.obj \
	$(DIR)\tclcmdmz.obj \
	$(DIR)\tclget.obj \
	$(DIR)\tclhash.obj \
	$(DIR)\tclhisto.obj \
	$(DIR)\tclparse.obj \
	$(DIR)\tclproc.obj \
	$(DIR)\tclvar.obj \
	$(DIR)\tclcmdil.obj \
	$(DIR)\tclutil.obj \
 	$(DIR)\tclunixu.obj \
	$(DIR)\tclckall.obj \
	$(DIR)\tclenv.obj \
	$(DIR)\tclexpr.obj \
	$(DIR)\tclunixa.obj \
	$(DIR)\tclunixs.obj \
	$(DIR)\tclglob.obj \
	$(DIR)\tclLink.obj

COMPAT_OBJS =	$(DIR)\exit.obj \
	$(DIR)\forkexec.obj \
	$(DIR)\getcwd.obj \
	$(DIR)\gettod.obj \
	$(DIR)\helper.obj \
	$(DIR)\isatty.obj \
	$(DIR)\opendir.obj \
	$(DIR)\pipe.obj \
	$(DIR)\unlink.obj \
	$(DIR)\waitpid.obj \
	$(DIR)\winio.obj \
	$(DIR)\wsa_strerror.obj

LINK_OBJS= $(TCL_OBJS) $(COMPAT_OBJS)

DEF_FILE=tcl73.def
DEF_FLAGS=/DEF:$(DEF_FILE)

#----------------------------------------------------------------------
# Build rules
#----------------------------------------------------------------------
ALL: $(DIR)\tcl73.dll

$(DIR)\tcl73.dll:  $(DEF_FILE) $(LINK_OBJS)
	$(LINK) @<<
		$(LINK_FLAGS_DLL) $(DEF_FLAGS) $(LINK_OBJS) /IMPLIB:$(DIR)\tcl73.lib /OUT:$(DIR)\tcl73.dll
<<

#----------------------------------------------------------------------
# Rules for compat objects
#----------------------------------------------------------------------
$(DIR)\pipe.obj:  COMPAT\pipe.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\pipe.c

$(DIR)\isatty.obj:  COMPAT\isatty.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\isatty.c

$(DIR)\winio.obj: COMPAT\winio.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\winio.c

$(DIR)\wsa_strerror.obj:  COMPAT\wsa_strerror.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\wsa_strerror.c

$(DIR)\gettod.obj: COMPAT\gettod.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\gettod.c

$(DIR)\helper.obj: COMPAT\helper.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\helper.c

$(DIR)\opendir.obj: COMPAT\opendir.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\opendir.c

$(DIR)\getcwd.obj: COMPAT\getcwd.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\getcwd.c

$(DIR)\forkexec.obj: COMPAT\forkexec.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\forkexec.c

$(DIR)\waitpid.obj: COMPAT\waitpid.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\waitpid.c

$(DIR)\exit.obj: COMPAT\exit.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\exit.c

$(DIR)\unlink.obj: COMPAT\unlink.c $(DIRMADE)
	$(CPP) $(CPP_PROJ) .\COMPAT\unlink.c


ALL_OBJS=$(LINK_OBJS)
#----------------------------------------------------------------------
# Default build rules
#----------------------------------------------------------------------
!include "../include/common3.mak"
