# Generated automatically from Makefile.vc.in by configure.
#
# XOTclSdbm Makefile for Visual C++ 6.0
#

# Be sure to adapt the "makefile.vc" file in the toplevel directory
# to your system settings.
!include "..\..\..\makefile.vc"

# Set NODEBUG to 0 to compile with symbols
NODEBUG=1

BINROOT		= .
!IF "$(NODEBUG)" == "1"
TMPDIR		= $(BINROOT)\Release
DBGX		=
!ELSE
TMPDIR		= $(BINROOT)\Debug
DBGX		= 
!ENDIF
OUTDIR		= $(TMPDIR)

#
# file names etc.
#
XOTCLSDBM=	xotclsdbm
DLLNAME      = $(XOTCLSDBM).dll
XOTCLSDBMDLL = $(OUTDIR)\$(DLLNAME)
DLLDEST = ..\lib$(XOTCLSDBM)

#
# obj specs
#
OBJS = $(TMPDIR)\hash.obj \
	$(TMPDIR)\pair.obj \
	$(TMPDIR)\sdbm.obj \
	$(TMPDIR)\xotclsdbm.obj \
	$(TMPDIR)\dllEntryPoint.obj

#
# VCC tools program names (and sub dirs)
#
cc32		= $(TOOLS32)\bin\cl.exe
link32		= $(TOOLS32)\bin\link.exe
rc32		= $(TOOLS32_rc)\bin\rc.exe
include32	= -I$(TOOLS32)\include

#
# libs
#
TCLLIB		= $(TCLDIR)\win\Release\$(TCLPREFIX)$(DBGX).lib
TCLDLL		= $(TCLDIR)\win\Release\$(TCLPREFIX)$(DBGX).dll
TKLIB       = $(TKDIR)\win\$(OUTDIR)\$(TKPREFIX)$(DBGX).lib
TKDLL       = $(TKDIR)\win\$(OUTDIR)\$(TKPREFIX)$(DBGX).dll
XOTCLLIB    = ..\..\..\src\$(OUTDIR)\xotcl.lib
DUMPEXTS    = ..\..\..\src\$(OUTDIR)\dumpexts.exe

# uncomment one of the following lines to compile with TCL_MEM_DEBUG, 
# TCL_MEM_DEBUG, or TCL_COMPILE_DEBUG
#DEBUGDEFINES	= -DTCL_MEM_DEBUG
#DEBUGDEFINES	= -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG
#DEBUGDEFINES	= -DTCL_MEM_DEBUG -DTCL_COMPILE_STATS
#DEBUGDEFINES	= -DTCL_MEM_DEBUG -DTCL_COMPILE_DEBUG -DTCL_COMPILE_STATS

#
# install dirs
#
LIB_INSTALL_DIR	= $(INSTALLDIR)\lib
BIN_INSTALL_DIR	= $(INSTALLDIR)\bin
INCLUDE_INSTALL_DIR	= $(INSTALLDIR)\include


INCLUDES	= -I. -I$(TCLDIR)\generic -I$(TKDIR)\generic -I$(TKDIR)\win -I$(TKDIR)\xlib -I../../../src
DEFINES	= -D__WIN32__ -DVISUAL_CC $(DEBUGDEFINES) -DXOLIBPKG=$(INST_XOLIBPKG)


CFLAGS	= $(cdebug) $(cflags) $(cvarsdll) $(include32) \
			$(INCLUDES) $(DEFINES) \
			-DLIBPKG=$(INST_XOLIBPKG) -DXOTCLVERSION=$(XOTCLVERSION)



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

!IF "$(NODEBUG)" == "1"
ldebug = /RELEASE
!ELSE
ldebug = -debug:full -debugtype:cv
!ENDIF

# declarations common to all linker options
lcommon = /NODEFAULTLIB /RELEASE /NOLOGO

# declarations for use on Intel i386, i486, and Pentium systems
!IF "$(MACHINE)" == "IX86"
DLLENTRY = @12
lflags   = $(lcommon) /MACHINE:$(MACHINE)
!ELSE
lflags   = $(lcommon) /MACHINE:$(MACHINE)
!ENDIF

conlflags = $(lflags) -subsystem:console -entry:mainCRTStartup
guilflags = $(lflags) -subsystem:windows -entry:WinMainCRTStartup
dlllflags = $(lflags) -entry:_DllMainCRTStartup$(DLLENTRY) -dll

!IF "$(MACHINE)" == "PPC"
libc = libc.lib
libcdll = crtdll.lib
!ELSE
libc = libc.lib oldnames.lib
libcdll = msvcrt.lib oldnames.lib
!ENDIF

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

guilibs	   = $(libc) $(winlibs)
conlibs	   = $(libc) $(baselibs)
guilibsdll = $(libcdll) $(winlibs)
conlibsdll = $(libcdll) $(baselibs)



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

!IF "$(NODEBUG)" == "1"
!IF "$(MACHINE)" == "ALPHA"
# MSVC on Alpha doesn't understand -Ot
cdebug = -O2i -Gs -GD
!ELSE
cdebug = -Oti -Gs -GD
!ENDIF
!ELSE
cdebug = -Z7 -Od -WX
!ENDIF

# declarations common to all compiler options
ccommon = -c -W3 -nologo -YX -Fp$(TMPDIR)\ -Dtry=__try -Dexcept=__except

!IF "$(MACHINE)" == "IX86"
cflags = $(ccommon) -D_X86_=1
!ELSE
!IF "$(MACHINE)" == "MIPS"
cflags = $(ccommon) -D_MIPS_=1
!ELSE
!IF "$(MACHINE)" == "PPC"
cflags = $(ccommon) -D_PPC_=1
!ELSE
!IF "$(MACHINE)" == "ALPHA"
cflags = $(ccommon) -D_ALPHA_=1
!ENDIF
!ENDIF
!ENDIF
!ENDIF

cvars      = -DWIN32 -D_WIN32
cvarsmt    = $(cvars) -D_MT
cvarsdll   = $(cvarsmt) -D_DLL

!IF "$(NODEBUG)" == "1"
cvarsdll   = $(cvarsdll) -MD
!ELSE
cvarsdll   = $(cvarsdll) -MDd
!ENDIF

CON_CFLAGS	= $(cdebug) $(cflags) $(cvars) $(include32) -DCONSOLE


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

src-xotclsdbm: setup $(DLLDEST).dll

setup:
	if not exist $(TMPDIR) mkdir $(TMPDIR)
	if not exist $(OUTDIR) mkdir $(OUTDIR)

$(DLLDEST).dll: $(OBJS) $(TCLLIB) $(TMPDIR)\vc.def
	set LIB=$(TOOLS32)\lib
	$(link32) $(ldebug) $(dlllflags) -def:$(TMPDIR)\vc.def \
		-out:$@ $(XOTCLLIB) $(guilibsdll) @<<
$(OBJS) $(TCLLIB)
<<

$(TMPDIR)\vc.def: $(DUMPEXTS) $(OBJS)
	$(DUMPEXTS) -o $@ $(DLLNAME) @<<
$(OBJS)
<<


src-install-xotclsdbm: src-xotclsdbm
	if not exist $(INSTALLDIR) mkdir $(INSTALLDIR)
	if not exist $(BIN_INSTALL_DIR) mkdir $(BIN_INSTALL_DIR)
	if not exist $(LIB_INSTALL_DIR) mkdir $(LIB_INSTALL_DIR)
	if not exist $(INCLUDE_INSTALL_DIR) mkdir $(INCLUDE_INSTALL_DIR)
	copy $(DLLDEST).dll "$(BIN_INSTALL_DIR)"
	copy $(DLLDEST).lib "$(BIN_INSTALL_DIR)"

#
# Implicit rules
#

{$(WINDIR)}.c{$(TMPDIR)}.obj:
    $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMPDIR)\ $<

{$(GENERICDIR)}.c{$(TMPDIR)}.obj:
    $(cc32) -DDLL_BUILD $(CFLAGS) -Fo$(TMPDIR)\ $<

{$(WINDIR)}.rc{$(TMPDIR)}.res:
	$(rc32) -fo $@ -r -i $(GENERICDIR) -i $(WINDIR) -i $(TCLDIR)\generic -D__WIN32__ \
		$(DEFINES) $<

src-clean-xotclsdbm:
	-@del $(OUTDIR)\*.exp
	-@del $(OUTDIR)\*.lib
	-@del $(OUTDIR)\*.dll
	-@del $(OUTDIR)\*.exe
	-@del $(OUTDIR)\*.pdb
	-@del $(TMPDIR)\*.pch
	-@del $(TMPDIR)\*.obj
	-@del $(TMPDIR)\*.res
	-@del $(TMPDIR)\*.def
	-@del $(TMPDIR)\*.exe
	-@del $(DLLDEST).dll
	-@del $(DLLDEST).exp
	-@del $(DLLDEST).lib
	-@rmdir $(OUTDIR)
	-@rmdir $(TMPDIR)
