# ---------------------------------------------------------------------------
# Makefile.win
#
# Dave Beazley
# June 24, 1997
#
# This file is used to build all of the examples in the 'Examples' directory
# under Windows 95/NT.    This assumes that you are using NMAKE and
# Visual C++ 4.x/5.x.   However it may work with other compilers as well.
#
# This file assumes that the vcvars32 script has been run first!
#
# By default this only builds DLLs.
# ---------------------------------------------------------------------------

# Location of the Visual C++ tools
TOOLS         = $(MSVCDIR)

# The C/C++ compiler
CC            = cl.exe

# The linker
LINK          = link.exe

# Include directories for your compiler
INCLUDE32     = -I"$(TOOLS)\include"

# Target machine
MACHINE       = IX86

# C Libraries needed to build a DLL
DLLIBC        = msvcrt.lib oldnames.lib  

# Other windows libraries that are apparently needed
WINLIB        = kernel32.lib advapi32.lib user32.lib gdi32.lib comdlg32.lib winspool.lib
#WINLIB        = kernel32.lib 

# Libraries common to all DLLs
DLLLIBS       = $(DLLIBC) $(WINLIB) 

# Linker options
LOPT      = -debug:full -debugtype:cv /NODEFAULTLIB /RELEASE /NOLOGO /MACHINE:$(MACHINE) -entry:_DllMainCRTStartup@12 -dll

# C compiler flags
CFLAGS    =  /Od /WX /c  /nologo /DEBUG $(OPTS)

# SWIG Installation
SWIG      = d:\swig1.1\swig

# Now munge the files provided
# SRCS     = list of source files
# WRAPFILE = Outfile file for SWIG

SRCS         = $(SRCS) $(WRAPFILE)
OBJS         = $(SRCS:.cxx=.obj) 
OBJS         = $(OBJS:.c=.obj)
OBJS         = $(OBJS:/Tp=)

# ------------------------------------------------------------------
# Tcl settings
# 
# TCL_INCLUDES  = Include files for your Tcl installation.
#                 Typically you want Tcl/generic and Tcl/win.
# TCLLIB        = The location of the tcl library
# ------------------------------------------------------------------

TCL_INCLUDES  = -Id:\tcl8.0\generic -Id:\tcl8.0\win
TCLLIB        = d:\tcl8.0\win\tcl80.lib

tcl::
	$(SWIG) -tcl -o $(WRAPFILE) $(SWIGOPT) $(INTERFACE)
	$(CC) $(CFLAGS) $(TCL_INCLUDES) $(SRCS) 
	set LIB=$(TOOLS)\lib
	$(LINK) $(LOPT) -out:$(TARGET) $(DLLLIBS) $(TCLLIB) $(OBJS) 

# ------------------------------------------------------------------
# Python settings
# 
# PY_INCLUDES  = Include files for your Python installation.  Typically
#                you need the python-1.5\Include python-1.5\ and python-1.5\PC
#                directories here.
# PYLIB        = The location of the Python library
# ------------------------------------------------------------------


PY_INCLUDES  = -Id:\python-1.5\Include -Id:\python-1.5 -Id:\python-1.5\PC
PYLIB        = d:\python-1.5\PCbuild\Debug\python15.lib
PYFLAGS      = /D __WIN32__

python::
	$(SWIG) -python -o $(WRAPFILE) $(SWIGOPT) $(INTERFACE)
	$(CC) $(CFLAGS) $(PYFLAGS) $(PY_INCLUDES) $(SRCS) 
	set LIB=$(TOOLS)\lib
	$(LINK) $(LOPT) -out:$(TARGET) $(DLLLIBS) $(PYLIB) $(OBJS) 

# ------------------------------------------------------------------
# Perl settings
# 
# PERL_INCLUDE = Include files for your Perl installation
# PERLLIB      = The location of the Perl library
# PERLFLAGS    = Perl specific compilation flags
# ------------------------------------------------------------------

# These are for Perl5.004 
#PERL_INCLUDE = -Id:\packages\perl\lib\CORE 
#PERLLIB      = d:\packages\perl\lib\CORE\perl.lib
#PERLFLAGS    = /DWIN32 /DMSWIN32 /DWIN32IO_IS_STDIO 

# !!!!! BOGUS HACK ALERT !!!!!
# The following options appear to work for me using the ActiveState
# Perl for Win32 Build 517.  Tested on 6/8/99 using Visual C++ 5.0
# and Windows NT 4.0 (SP1).
# 
#  -- Dave

# Uncomment the following if you are using ActiveWare Perl for Win32
PERL_INCLUDE =-Id:\Perl\5.00502\lib\MSWin32-x86-object\Core
PERLLIB      = d:\perl\5.00502\lib\MSWin32-x86-object\Core\Perlcore.lib
PERLFLAGS    = /DWIN32 /DMSWIN32 /DPERL_OBJECT 


perl::
	$(SWIG) -perl5 -o $(WRAPFILE) $(SWIGOPT) $(INTERFACE)
	$(CC) $(CFLAGS) $(PERLFLAGS) $(PERL_INCLUDE) $(SRCS) 
	set LIB=$(TOOLS)\lib
	$(LINK) $(OBJS) $(LOPT)  /DEBUG -out:$(TARGET) $(DLLLIBS) $(PERLLIB) 

clean::
	del *.obj
	del *.dll
	del *.exp
	del *.lib
	del *.pdb
	del *_wrap*
	del *~















