# Simple makefile
###############################################################################
# Adaptation to build environment:
# Set Fortran 90 compiler and F90 flags
#
# Targets of make command:
#
# make: compiles program
# make run: runs simulation program
# make plot: calls simulation program and plot program gnuplot with screen output
# make clean: removes all temporary files
#
# Creation of plot files:
# Uncomment 2nd and 3rd line of files gplot.plt and hplot.plt
###############################################################################

#FC=ifort
FC=gfortran

#F90FLAGS = -cpp -O3 -n32
#F90FLAGS = -cpp -g
F90FLAGS = -O3

APPLICATION=double-slit

$(APPLICATION) : $(APPLICATION).f90 Makefile
	$(FC) $(F90FLAGS) -o $(APPLICATION) $(APPLICATION).f90
#	cp $(APPLICATION) ..

run : $(APPLICATION)
	./$(APPLICATION)
#	time ./$(APPLICATION)

plot : $(APPLICATION) Makefile gplot.plt
	./$(APPLICATION)
	gnuplot gplot.plt
	gnuplot hplot.plt

plotall : $(APPLICATION) Makefile gplot.plt
	./$(APPLICATION)
	gnuplot g-it-plot.plt

gif : $(APPLICATION) Makefile g-it-plot1.plt g-it-plot2.plt
	./$(APPLICATION)
	gnuplot g-it-plot1.plt > out.gif

clean:
	rm -f *.mod *.o *.bak *~ $(APPLICATION)

