#
# makefile for amplitude from force constant matrix
#
CC = gcc
FC = gfortran
LD = gfortran
#
CPUFLAGS = -march=core2 -mtune=core2 -mmmx -msse -msse2 -msse3 -mssse3
#
CFLAGS = -O3 \
         -ffast-math -fomit-frame-pointer -funroll-loops \
         -Wall $(CPUFLAGS)
#
FFLAGS = -O3 \
         -fautomatic -fno-f2c \
         -ffast-math -fomit-frame-pointer -funroll-loops \
         -Wall $(CPUFLAGS)
# MKL
LAPACK = /opt/intel/mkl/10.1.2.024/lib/em64t
INCLUDE = -I$(LAPACK)/../../include/
#LIBS = -L$(LAPACK) -lmkl_lapack -lmkl -lguide -lpthread -lm
#LIBS = -L$(LAPACK) -lmkl_lapack64 -lmkl -lguide -lpthread -lm
LIBS = -L$(LAPACK) -lmkl_lapack -lmkl -lmkl_intel_thread -liomp5 -lpthread -lm
## ACML
#LAPACK = /opt/acml3.1.0/gnu64/lib/
#INCLUDES = -I$(LAPACK)/../include/
#LIBS = -lm -L$(LAPACK) -lacml
## ATLAS
#LAPACK = /pgm/atlas/lib
#INCLUDES = -I$(LAPACK)/../include/
#LIBS = -lm -L$(LAPACK) -llapack -lcblas -lf77blas -latlas

OBJS = \
	atomic.o \
	initialize.o \
	readfchk.o \
	readgdat.o \
	readgeneric.o \
	readinternal.o \
	interface.o \
	coordinates.o \
	calculate.o \
	transformation.o \
	generateredundant.o \
	cartesian.o \
	internal.o \
	vibrational.o \
	modeinternal.o \
	shrinkage.o \
	modewalk.o \
	errors.o \
	export.o \
	outputs.o 

OBSOLETE = blas.o

.PHONY: clean

all: amplitude 

amplitude: %: %.o $(OBJS)
	$(LD) $@.o $(OBJS) $(LIBS) -o $@.x

tmo2inp: %: %.o initialize.o errors.o
	$(CC) $@.o initialize.o errors.o -o $@.x

clean:
	$(RM) $(OBJS) amplitude.o

