# ============================================================================
# Name        : Makefile
# Author      : Geralf Hütter
# Version     :
# Copyright   : 
# Description : Makefile for UELlib
# ============================================================================

.PHONY: all clean lib

PATH := $(shell pwd)/src:$(PATH)

# Change this line if you are using a different Fortran compiler, Abaqus version etc.
CC = ifort
CFLAGS = -c -fPIC -openmp -mP2OPT_hpo_vec_divbyzero=F -extend_source -w90 -w95 -O2

#global Target
build: bin/UEL_lib-std.o

# dependencies
bin/ABQinterface.o: bin/ABA_PARAM.INC
bin/Math.o: bin/ABQinterface.o
bin/UEL_lib.o: bin/Math.o bin/ABQinterface.o

# compilation
#   combine all object files to final "UEL_lib-std.o" 
#   (Note: abaqus make links only object files named *-std.o) 
bin/UEL_lib-std.o: bin/ABQinterface.o bin/Math.o bin/UEL_lib.o  
	ld -r $^ -o $@ 

# compile individual files
bin/%.o bin/%.mod: lib/%.f90
	cd bin; $(CC) $(CFLAGS) $(abspath $<)

#	mv bin/$(notdir $(basename $<)).o bin/$(notdir $(basename $<))-std.o

#clean
clean:
	rm -f bin/*.o
	rm -f bin/*.mod

	
