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

OBJECTS			= slbm_F_shell.o

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 
CCFLAGS = /EHsc /D SLBM_FORT_SHELL_EXPORTS /D WIN32 /nologo /Fo"$@"  /I"$(GEO_INC)"
COMMAND = ${CV} ${CC} ${CCFLAGS} ${OBJECTS} -link $(MACHINE) -dll -out:"${LIB_DIR}libslbmFshell.dll" -LIBPATH:"${LIB_DIR}" ${LIB_DIR}/libslbm.lib /MANIFEST  /LIBPATH:$(GEO_LIB) libgeotesscpp.lib && cd ..\lib && mt.exe -manifest \
		libslbmFshell.dll.manifest /nologo -outputresource:libslbmFshell.dll;2
VERSION_FLAG =

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

all : info fortshell cleanobjs done

fortshell : ${OBJECTS}
	${CV} echo "building shared library slbm_F_shell.so/dll"
	${COMMAND}
	${CV} echo ""

cleanobjs :
	${CV} echo "removing object files"
	$(RM) ${OBJECTS}
	${CV} echo ""

slbm_F_shell.o :
	${CV} echo "Compiling slbm_F_shell.cc"
	${CV} ${CC} ${CCFLAGS} -I${INCLUDE_DIR} -I${INCLUDE_SLBMDIR} -c src/slbm_F_shell.cc
	${CV} echo ""

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

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