##############################################################
#
# Makefile for UMAT_Driver
#
##############################################################
#
# Main Driver script, all include files are in the src folder -> source file of the UMAT driver, which calls a material through the UMAT interface
MAINSRC=UMAT_Driver.f
# Target file (==name of output)
RESULT=UMAT_Driver.o
#
#########################################change these lines when compiling with a different UMAT###########################################################
# Main UMAT script (+UEXTERNALDB etc.) -> source file of the ACTUAL UMAT, has to be changed to the UMAT to compile into UMAT driver
UMATSRC=$(abspath ../monolithfesqr/src/UMATmacro.f)
# All additional folders with source code which are needed by the UMAT
additionalSRC=-I$(abspath ../monolithfesqr/src) -I$(abspath ../uel-large-deformation/src) -I$(abspath ../uellib/lib) -I$(abspath ../uel-large-deformation/materialroutines/Mises)
#########################################change these lines when compiling with a different UMAT###########################################################
#
#
TRG=bin/${RESULT}
SRC := $(wildcard src/*.f) $(wildcard src/*.f90) $(wildcard src/*.f95)

build: ${TRG}

#Note CPATH is read as include path by ifort
${TRG}: src/${MAINSRC}
	cd src; ifort ${UMATSRC} ${MAINSRC} -o ${RESULT} -O3 -fPIC -qmkl -static-intel -qopenmp -heap-arrays ${additionalSRC}
	rm src/*.mod
	mv -f src/${RESULT}  bin/${RESULT}

move: 
	cd src
	mv src/${RESULT}  bin/${RESULT}

clean:
	rm -f ${TRG}
