# MAKEFILE
#
# Builds the Visio GENERIC add-on in VSL form.
#
# Usage : NMAKE [DEBUG={0|1}]
#
# Defaults to DEBUG=0
#

# First we check if any command line parameters were passed
#

!ifndef DEBUG
DEBUG=0
!endif

!if "$(DEBUG)" != "0"
DEBUG = 1
!endif

# Now we have some general defines
#

PROJ = GENERIC
D_RCDEFINES = -d_DEBUG
R_RCDEFINES = -dNDEBUG
CC = cl
CPP = cl
CXX = cl
RC = rc

CFLAGS_D_WDLL = /nologo /G2 /W3 /Zi /Od /D "_DEBUG" /D "_DLL" /FR /AMw /GD
CFLAGS_R_WDLL = /AMw /GD /D "_DLL"
LFLAGS_D_WDLL = /NOD /NOE /NOPACKC /ALIGN:16 /ONERROR:NOEXE /CO /MAP:FULL
LFLAGS_R_WDLL = /NOD /NOE /NOPACKC /ALIGN:16 /ONERROR:NOEXE /MAP:FULL
LIBS_D_WDLL = oldnames libw mdllcew ole2 ole2disp compobj
LIBS_R_WDLL = oldnames libw mdllcew ole2 ole2disp compobj

RCFLAGS =
RESFLAGS = -t
DEFFILE = VSL.DEF


# Set the compile flags depending on whether or not we are
# DEBUG/RELEASE and whether or not we are VSL/EXE.
#

!if "$(DEBUG)" == "1"
CFLAGS = $(CFLAGS_D_WDLL)
LFLAGS = $(LFLAGS_D_WDLL)
LIBS = $(LIBS_D_WDLL)
MAPFILE = nul
RCDEFINES = $(D_RCDEFINES)
!else
CFLAGS = $(CFLAGS_R_WDLL)
LFLAGS = $(LFLAGS_R_WDLL)
LIBS = $(LIBS_R_WDLL)
MAPFILE = nul
RCDEFINES = $(R_RCDEFINES)
!endif


# Object dependencies
#

all : $(PROJ).DLL

LIB.OBJ : LIB.C VAO.H
	$(CC) $(CFLAGS) /c LIB.C

VAO.OBJ : VAO.C vao.h
	$(CC) $(CFLAGS) /c VAO.C

IVISREG.OBJ : IVISREG.CPP IVISAUTO.H IVISREG.H
    $(CC) $(CFLAGS) /c IVISREG.CPP
    
GENERIC.OBJ : GENERIC.CPP ivisprox.h ivisauto.h
	$(CC) $(CFLAGS) /c GENERIC.CPP

GENERIC.RES : GENERIC.RC resource.h GENERIC.ICO
	$(RC) $(RCFLAGS) $(RCDEFINES) -r GENERIC.RC
	
$(PROJ).DLL : LIB.OBJ VAO.OBJ GENERIC.OBJ GENERIC.RES IVISREG.OBJ\
		$(DEFFILE)
	echo >NUL @<<$(PROJ).CRF
LIB.OBJ +
GENERIC.OBJ +
IVISREG.OBJ +
VAO.OBJ
$(PROJ).DLL
$(MAPFILE)
$(LIBS)
$(DEFFILE);
<<
	link $(LFLAGS) @$(PROJ).CRF
	$(RC) $(RESFLAGS) $(PROJ).RES $@
    copy $(PROJ).DLL $(PROJ).VSL

