# Makefile for ex1a

VPATH = ./Mod

#Source files to compile
SOURCES = test.f95

#Object files produced from source files 
OBJECTS = test.o

#Flags for linking:   -L path where libraries are, -l which library to link
CFLAGS = -Bstatic -L/usr/lib -lnagfl90
#-L/usr/local/nag/lib -lnagfl90_rh9 -L/usr/lib -lcrypt -lpthread


# -I path is where to search for need .mod files
FCOMPLR = /usr/bin/f95 -I/usr/local/nag/nag_mod_dir -I./Mod
# -g = debugging
# -O4 -Oassumed 
#Produce executable from object
# -o means outfile
test:  $(OBJECTS)
	$(FCOMPLR) -o JDAY test.o ./Mod/ay_mat_eval.o ./Mod/ay_mat_vec_mod.o ./Mod/ay_matrix.o ./Mod/ay_kernels.o ./Mod/ay_integration.o ./Mod/ay_constants.o $(CFLAGS)

#Compile source but don't link, i.e., only produce object files
test.o:  $(SOURCES) ay_mat_vec_mod.o
	$(FCOMPLR) -c $(SOURCES)

ay_kind.o ay_constants.o ay_kernels.o ay_integration.o ay_mat_eval.o ay_matrix.o ay_mat_vec_mod.o :
	$(MAKE) -C Mod

.PHONY: clean
clean:  
	rm *.o
	$(MAKE) clean -C Mod	