#
# EASY-ROB Development V2.0
#
#
# library name and locations
#
DEST		= ..\.
DEST_OBJ	= .\obj
LIBRARY		= ipo_user
OUT_LIBRARY	= er_ipo

#
# Operating System
#
!IF "$(OS)" == "Windows_NT"
NULL=
!ELSE 
NULL=nul
!ENDIF 

#
# set up the MS Visual C++ compiler
#
#MS_LOC		= c:\prog\msdev
#MS_LOC		= d:\Programme\msdev
MS_LOC		= ..\msdev
PATH		= $(MS_LOC)\bin;$(PATH)

#
# location of the library file to link with to resolve
# symbols
#
LIBERW_LOC	= ..\.
INCS		= -I $(MS_LOC)\include -I $(MS_LOC)\mfc\include

#
# define the commands
#
CC		= cl
LD		= link
DELETE		= del
MOVE		= move
SET		= set

#
# define some important file names
#
LIBRARY_CPP	= $(LIBRARY).cpp
LIBRARY_DLL	= $(DEST)\$(OUT_LIBRARY).dll
LIBRARY_LIB	= $(DEST)\$(OUT_LIBRARY).lib
LIBRARY_EXP	= $(DEST)\$(LIBRARY).exp
LIBRARY_OBJ	= $(DEST_OBJ)\$(LIBRARY).obj
LIBRARY_PCH	= $(DEST_OBJ)\$(LIBRARY).pch
LIBRARY_ERW	= $(LIBERW_LOC)\easyrobw.lib

#
# compile and link options and flags
#
CFLAGS		= $(INCS) /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS"\
 /Fp$(LIBRARY_PCH) /YX /Fo$(DEST_OBJ)/ /c
 
LDFLAGS= kernel32.lib user32.lib gdi32.lib winspool.lib\
 comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib\
 odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\
 /pdb:"$(LIBRARY_PCH)" /machine:I386 /out:"$(LIBRARY_DLL)" \
 /implib:$(LIBRARY_LIB) 


#
# files to compile
#
OBJS	= \
	$(LIBRARY_OBJ)

#
# this target will rebuilt the library
#

lib: 	warn obj
	@echo Making  $(LIBRARY_DLL) ...
	@$(SET) LIB=$(MS_LOC)\lib;$(MS_LOC)\mfc\lib;$(LIB)
	@$(LD) -OUT:$(LIBRARY_DLL) $(LDFLAGS) $(OBJS) $(LIBRARY_ERW)
	@echo $(LIBRARY_DLL) is up-to-date

obj:	warn $(OBJS) $(LIBRARY_ERW)
	@echo $(LIBRARY_OBJ) is up-to-date
#
# echo the assumption about the location of visual C++
# remove this target if you want to suppress this warning
#
warn:
	@echo Visual C++ is assumed to be in $(MS_LOC)

#
# this target will remove all of the object files
#
clean:	warn
	@echo removing some files ...
	@$(DELETE) $(LIBRARY_DLL)
	@$(DELETE) $(LIBRARY_LIB)
	@$(DELETE) $(LIBRARY_EXP)
	@$(DELETE) $(LIBRARY_OBJ)
	@$(DELETE) $(LIBRARY_PCH)
	@echo Done.

#
# this target will force a recompile of all files and rebuilt the library
#
all:	clean lib 

# default rule for making a .obj from a .c (compiling the C programs)
# is built in
.c{$(DEST_OBJ)/}.obj:
	$(CC) $(CFLAGS) $<  
.cpp{$(DEST_OBJ)/}.obj:
	$(CC) $(CFLAGS) $<  
