# MAKEFILE
#
# Builds the Visio GENERIC add-on in EXE 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

# The minimum flags are used for nondebug builds so that this MAK
# can work across most compilers.  However, for debug builds, the
# standard Microsoft debug flags were left.
#
# Note for differnt compilers, the /AM switch is required for the
# Microsoft C/C++ 8.00c compiler for Medium memory model.
#

CFLAGS_D_WEXE = /Zi /AM /Od /D "_DEBUG" /GA
CFLAGS_R_WEXE = /AM /GA
LFLAGS_D_WEXE = /NOD /PACKC:61440 /ALIGN:16 /ONERROR:NOEXE /CO  
LFLAGS_R_WEXE = /NOD /PACKC:61440 /ALIGN:16 /ONERROR:NOEXE  
LIBS_D_WEXE = oldnames libw mlibcew ole2 ole2disp
LIBS_R_WEXE = oldnames libw mlibcew ole2 ole2disp

RCFLAGS =
RESFLAGS = -t
DEFFILE = EXE.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_WEXE)
LFLAGS = $(LFLAGS_D_WEXE)
LIBS = $(LIBS_D_WEXE)
MAPFILE = nul
RCDEFINES = $(D_RCDEFINES)
!else
CFLAGS = $(CFLAGS_R_WEXE)
LFLAGS = $(LFLAGS_R_WEXE)
LIBS = $(LIBS_R_WEXE)
MAPFILE = nul
RCDEFINES = $(R_RCDEFINES)
!endif

# Object dependencies
#

all : $(PROJ).EXE

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

MAIN.OBJ : MAIN.C resource.h
	$(CC) $(CFLAGS) /c MAIN.C

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

