# Set the remove file command for your system
# Used in the clean command
RM = rm

# Set the required Fortran compiler and associated flags
f90comp= nagfor
# name the executable
flag= -o
# Set the compilation flags
# Optimize
#switch= -O3
# Debug
switch = -gline -u -dcfuns -nan -save -C -C=undefined

OBJS = set_rk.o rk_erfcx_Cody.o Faddeyeva_v2_mod_rk.o\
 wofz.o wofz_v2.o

mod_mid=Faddeyeva_v2_mod_rk.mod set_rk.mod\
 wofz.mod wofz_v2.mod rk_erfcx_Cody.mod

wofz_680_driver: $(OBJS) wofz_680_driver.o
	$(f90comp) $(flag) wofz_680_driver $(switch) $(OBJS)\
	 wofz_680_driver.o

set_rk.o: 
	$(f90comp) -c $(switch) set_rk.f90

rk_erfcx_Cody.o: set_rk.o
	$(f90comp) -c $(switch) rk_erfcx_Cody.f90

Faddeyeva_v2_mod_rk.o: set_rk.o rk_erfcx_Cody.o
	$(f90comp) -c $(switch) Faddeyeva_v2_mod_rk.f90

wofz_v2.o: set_rk.o rk_erfcx_Cody.o
	$(f90comp) -c $(switch) wofz_v2.f90

wofz.o: set_rk.o
	$(f90comp) -c $(switch) wofz.f90

wofz_680_driver.o: Faddeyeva_v2_mod_rk.o\
 wofz_680_driver.f90 set_rk.o wofz.o wofz_v2.o rk_erfcx_Cody.o
		$(f90comp) -c $(switch) wofz_680_driver.f90

# Cleaning
clean:
	# remove all files generated by the compiler
	# these are compiler dependent
	$(RM) -f *.o *.mod
	# remove all executables
	$(RM) -f $(executables)
