#-------------------------------------------------------------------------------
# Define Program, Program Directory, Program Version, Install Directories, and
# Target Names ... set mode to default (empty)
#-------------------------------------------------------------------------------
PROGRAM				= libslbmCshell
PROG_NAM			= SLBM_C_shell

SOURCES			= src/slbm_C_shell.cc
OBJECTS			= slbm_C_shell.obj

INCLUDE_DIR			= include/
INCLUDE_SLBMDIR		= ../SLBM/include/
LIB_DIR				= ../lib/
GEO_INC				= ../GeoTessCPP/include
GEO_LIB				= ../GeoTessCPP/lib

CV = @

ifeq ($(ARCH),32bit)
MACHINE=/MACHINE:X86
else
MACHINE=/MACHINE:X64
endif

CC = cl
RM = del
INCLUDE_DIR			= include
INCLUDE_SLBMDIR		= ..\SLBM\include
LIB_DIR				= ..\lib
CCFLAGS = /O2 /MD /Gm /Zi /D "WIN32" /D "_WINDOWS" /D "_USRDLL"  /D "TAUP_EXPORTS" /D"SLBM_C_EXPORT" \
	 /D "UTIL_EXPORTS" /D "_CRT_SECURE_NO_DEPRECATE" /D "_WINDLL" /D "_UNICODE" /D "UNICODE" /I"$(INCLUDE_DIR)" /I"${INCLUDE}" /I"${INCLUDE_SLBMDIR}" /I"$(GEO_INC)" /EHsc /nologo /Fo"$@"
COMMAND = ${CV} ${CC} ${CCFLAGS} ${OBJECTS} -link $(MACHINE) -dll -out:"${LIB_DIR}\libslbmCshell.dll" -LIBPATH:"${LIB_DIR}" ${LIB_DIR}/libslbm.lib /LIBPATH:$(GEO_LIB) libgeotesscpp.lib
VERSION_FLAG =


#-------------------------------------------------------------------------------
# targets
#-------------------------------------------------------------------------------

all : info cshell done

slbm_C_shell.obj :
	${CV} echo "compiling slbm_C_shell.cc"
	${CV} ${CC} ${CCFLAGS} -I${INCLUDE_DIR} -I${INCLUDE_SLBMDIR} -c src/slbm_C_shell.cc
	$(CV) echo ""

cshell :${OBJECTS}
	${CV} echo "building shared library slbm_C_shell.so"
	${COMMAND}
	${CV} echo ""

cleanobjs :
	${CV} echo "removing object files"
	${RM} slbm_C_shell.o
	${CV} echo ""

info :
	@ echo "========================================="
	@ echo "Building" $(PROG_NAM) "on" $(OS) 
	@ $(CC) $(VERSION_FLAG)
	@ echo ""

done :
	@echo "Done building" $(PROG_NAM)
	@ echo ""
