# Makefile.vc
#
# This makefile is suitable for use with Microsoft Visual C++ 8 and 10
#
# This makefile was hacked from Sun's 'example.zip'
# Copyright (c) 1996 Sun Microsystems, Inc.
# SCCS: @(#) makefile.vc 1.3 96/04/24 13:28:08
# Copyright 1997 Tom Poindexter.
#

MPEXPR_VERSION = 1.2
DLL_VERSION = 12

PROJECT = mpexpr$(DLL_VERSION)

#
# Project directories -- these may need to be customized for your site
# NOTE: vcvarsall.bat or equivalent should be run first to set up
#       the environment for the VC++ tools.
#
# ROOT --       location of above this
# TMPDIR --     location for .obj files.
# TCL --        location where Tcl is installed.
# TCLLIB --     define the Tcl lib (with correct version)

# note that the tcl  vclibs should have been unpacked in $(TCL)\lib !!

ROOT        = ..
TMPDIR      = .
GENERICDIR  = $(ROOT)\generic

# point TCL and TCLLIB to your tcl distribution

TCL     = C:\tcl
TCLLIB  = $(TCL)\lib\tcl86.lib
TCLSH   = tclsh

# comment the following line to compile with symbols
NODEBUG=1

cc      = cl
CP      = copy
RM      = del

# Manifest tool.  The $(PROJECT).dll rule below only runs $(MT) if
# the file $(PROJECT).dll.manifest exists.  Some versions of cl
# construct $(PROJECT).dll.manifest by default.
MT      = mt

INCLUDES = -I. -I$(GENERICDIR) -I$(TCL)\include
DEFINES = -nologo $(DEBUGDEFINES) -DUSE_TCLALLOC -D_CRT_SECURE_NO_DEPRECATE -DBUILD_mpexpr

# Compiler warning flags.  Use -wd# to disable warning #.
#   Warning 4131 is old-style function declarations.
WARNINGS = -wd4131

cflags    = -c
link      = link.exe
dlllflags = -dll

# 
# Global makefile settings
#

DLLOBJS = \
	$(TMPDIR)\mpexpr.obj  \
	$(TMPDIR)\mpformat.obj \
	$(TMPDIR)\mpiface.obj \
	$(TMPDIR)\mpparse.obj \
	$(TMPDIR)\qfunc.obj   \
	$(TMPDIR)\qio.obj     \
	$(TMPDIR)\qmath.obj   \
	$(TMPDIR)\qmod.obj    \
	$(TMPDIR)\qtrans.obj  \
	$(TMPDIR)\zfunc.obj   \
	$(TMPDIR)\zio.obj     \
	$(TMPDIR)\zmath.obj   \
	$(TMPDIR)\zmod.obj    \
	$(TMPDIR)\zmul.obj 


# Targets

all: $(PROJECT).dll

$(PROJECT).dll: $(DLLOBJS)
	$(link) $(linkdebug) $(dlllflags)  $(TCLLIB) \
		$(guilibsdll) -out:$(PROJECT).dll $(DLLOBJS)
	IF EXIST $(PROJECT).dll.manifest \
          $(MT) -manifest $(PROJECT).dll.manifest \
	        -outputresource:$(PROJECT).dll;#2


# Implicit Targets

{$(GENERICDIR)}.c{$(TMPDIR)}.obj:
	$(cc) $(cdebug) $(cflags) $(cvarsdll) $(INCLUDES) \
		$(DEFINES) $(WARNINGS) -Fo$(TMPDIR)\ $<

install: $(PROJECT).dll
	$(TCLSH) install.tcl

tests: test

test:
	$(TCLSH) ..\tests\mpexpr.test $(PROJECT).dll
	$(TCLSH) ..\tests\mpformat.test $(PROJECT).dll

clean:
	-$(RM) $(TMPDIR)\*.obj
	-$(RM) $(PROJECT).dll
	-IF EXIST $(PROJECT).dll.manifest $(RM) $(PROJECT).dll.manifest
	-$(RM) $(PROJECT).lib
	-$(RM) $(PROJECT).exp
