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

SOURCES			= src/main.cc
			  
OBJECTS			= main.o

INCLUDE_DIR			= include/
INCLUDE_SLBMDIR		= ../SLBM/include/
LIB_DIR				= ../lib/
BIN_DIR				= ../bin/
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_SLBMDIR		= ..\SLBM\include
LIB_DIR						= ..\lib
BIN_DIR						= ..\bin
CCFLAGS = /O2 /MD /Gm /Zi /D "WIN32" /I"${INCLUDE_DIR}" /I"${INCLUDE}" /I"${INCLUDE_SLBMDIR}" /I"$(GEO_INC)" /EHsc /nologo /Fo"$@"
COMMAND = ${CV} ${CC} ${CCFLAGS} ${OBJECTS} -link $(MACHINE) ${LIB_DIR}/libslbm.lib /OUT:"${BIN_DIR}/slbmtestcc.exe" /LIBPATH:$(GEO_LIB) libgeotesscpp.lib
VERSION_FLAG =


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

all : info main.o link  done

main.o : 
	$(CV) echo "Compile main.cc"
	${CV} ${CC} ${CCFLAGS} -I${INCLUDE_DIR} -I${INCLUDE_SLBMDIR} -c src/main.cc

link : 
	${CV} echo "building executable main"
	${COMMAND}
	$(CV) echo ""

cleanobjs :
	${CV} echo "removing object files"
	$(RM) main.o
	${CV} echo ""

info :
	@ echo "========================================="
	@ echo "Building" $(PROG_NAM) "on" $(OS) "for" $(LIB_DIR) "and" $(INCLUDE_SLBMDIR)
	@ $(CC) $(VERSION_FLAG)
	@ echo ""

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