# Makefile template for Fortran90 programs # Needs filling in LIBS, FFILES and bin1/bin2 # (replace all instances of bin1/bin2 with your program name(s)) # compilers, flags and libraries F90 := ifort FFLAGS := -g -O2 # BLAS, LAPACK, FFT (not FFTW) routines are widely used, so # can include them here by default LIBS := -lmkl_lapack -lmkl -lguide -lpthread # optional - directories for sources and objects SRCDIR := . OBJDIR := . # source file(s) without suffix FFILES = OBJFILES = $(FFILES:%=%.o) # name of your program(s) PROGRAMS = bin1 bin2 # program driver source file bin1 = bin2 = # rules all : $(PROGRAMS) bin1: $(FFILES:%=$(OBJDIR)/%.o) $(bin1:%=$(OBJDIR)/%.o) $(F90) $(FFLAGS) -I$(SRCDIR) $^ -o $@ $(LIBS) bin2: $(FFILES:%=$(OBJDIR)/%.o) $(bin2:%=$(OBJDIR)/%.o) $(F90) $(FFLAGS) -I$(SRCDIR) $^ -o $@ $(LIBS) # implicit rule - objects from source files $(OBJDIR)/%.o: $(SRCDIR)/%.f90 $(F90) $(FFLAGS) -I$(SRCDIR) -c $< -o $@ clean: rm -f $(OBJDIR)/*.o $(PROGRAMS)