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

SOURCES			= src/slbmtestfort.f90
OBJECTS			= slbmtestfort.o

INCLUDE_DIR			= include/
INCLUDE_SHELLDIR	= ../SLBMshell/include/
INCLUDE_SLBMDIR		= ../SLBM/include/

BIN_DIR				= ../bin/
LIB_DIR				= ../lib/

ifeq ($(ARCH),32bit)
MACHINE=-m32
else
MACHINE=-m64
endif

F95 = x86_64-w64-mingw32-gfortran.exe
RM = del
CCOM = -c $(MACHINE) -fno-underscoring -o slbmtestfort.o
LCOM = $(MACHINE) -o ..\bin\slbmtestfort ..\lib\libslbmFshell.dll ..\lib\libslbm.dll -L C:\MinGW\mingw32\lib -L C:\MinGW\lib\gcc\mingw32\4.6.1
VERSION_FLAG := --version

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

all : info fshelltest cleanobjs done

fshelltest : ${OBJECTS}
	${CV} echo "building executable slbmtestfort"
	${CV} ${F95} ${LCOM} ${OBJECTS}
	${CV} echo ""

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

slbmtestfort.o :
	${CV} echo "Compiling: slbmtestfort.f90"
	${CV} ${F95} ${CCOM} ${SOURCES}
	${CV} echo ""

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

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