##########################################################################################################################################################
#
#
#
#  Makefile for compiling the conventional Drude-Lorentz model package
#  Copyright (C) 2009 - 2014  Thomas Moeller
#
#  I. Physikalisches Institut, University of Cologne
#
#
#
#  Versions of the program:
#
#  Who           When        What
#
#  T. Moeller    07/06/2009  Initial version
#
#
#
#  License:
#
#    GNU GENERAL PUBLIC LICENSE
#    Version 3, 29 June 2007
#    (Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>)
#
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
##########################################################################################################################################################


#  %--------------------------------------------%
#  | The directories to find the various pieces |
#  %--------------------------------------------%
#
srcdir  = src
bindir  = bin

#
# %------------------------------%
# | Make our own suffixes' list. |
# %------------------------------%
#
.SUFFIXES:
.SUFFIXES: .o .f90

#
# %-----------------------------------------%
# | Various compilation programs and flags. |
# | You need to make sure these are correct |
# | for your system.                        |
# %-----------------------------------------%
#
SHELL = /bin/bash

# gfortran with flags
FCFORTRAN = gfortran
FFLAGSFORTRAN = -O5 -ffree-form -ffree-line-length-none -fdefault-double-8 -fdefault-real-8 -Wall -fbounds-check

# LIBS = -L$(LIBDIR)/ARPACK -larpack_AMD_PathScale -L/opt/rrzk/acml-4.2.0/pathscale64_mp/lib/ -lacml_mp

EXEC = DrudeLorentzConv.exe
FSRC = Drude-Lorentz_conv.f90
FSRCPTP = Drude-Lorentz_conv_PointToPoint.f90

FOBJ = $(FSRC:.f90=.o)
MFIL = *.mod

#
#  make the binaries and clean up the directory
#

all: gfortran clean move

PointToPoint: PTP clean move

gfortran: $(srcdir)/$(FSRC) Makefile
	$(FCFORTRAN) -o $(EXEC) $(FFLAGSFORTRAN) $(srcdir)/$(FSRC)

PTP: $(srcdir)/$(FSRCPTP) Makefile
	$(FCFORTRAN) -o $(EXEC) $(FFLAGSFORTRAN) $(srcdir)/$(FSRCPTP)

clean:
	rm -f $(MFIL)

move:
	mv $(EXEC) $(bindir)/


