# intel_mkl = Intel Cluster Tools with MKL library for FFTs and MPI

# Intel C++, Intel MPI, Intel MKL FFTs
# Intel recommends Intel Cluster Tools Compiler Edition
# to build libfftw2xc_intel.a: 
# > cd /opt/intel/mkl/10.0.011/interfaces/fftw2xc
# > become root via su
# > gmake libem64t

SHELL = /bin/sh

# System-specific settings

# LINKFORT & FORTLIB settings can be blank if not using LAMMPS Fortran libs
# LINKGPU & GPULIB settings can be blank if not using LAMMPS gpu lib

include		Makefile.package

CC =	        mpiicc	
CCFLAGS =	$(PKGINC) -O3 -fno-alias -ip -unroll0 -g -DMPICH_IGNORE_CXX_SEEK -DLAMMPS_GZIP -DFFT_FFTW -I/opt/intel/mkl/10.0.011/include/fftw 
DEPFLAGS =	-M
LINK =		mpiicc
LINKFORT =	
LINKGPU =	
LINKFLAGS =	$(PKGPATH) $(LINKFORT) -mt_mpi -L/opt/intel/mkl/10.0.011/lib/em64t  $(LINKGPU)
USRLIB =	$(PKGLIB) /opt/intel/mkl/10.0.011/lib/em64t/libfftw2xc_intel.a
FORTLIB =	
GPULIB =	
SYSLIB =        $(FORTLIB) -lstdc++ -lpthread -lmkl_em64t -lguide  $(GPULIB)
ARCHIVE =	ar
ARFLAGS =	-rc
SIZE =		size

# Link target

$(EXE):	$(OBJ)
	$(LINK) $(LINKFLAGS) $(OBJ) $(USRLIB) $(SYSLIB) -o $(EXE)
	$(SIZE) $(EXE)

# Library target

lib:	$(OBJ)
	$(ARCHIVE) $(ARFLAGS) $(EXE) $(OBJ)

# Compilation rules

%.o:%.cpp
	$(CC) $(CCFLAGS) -c $<

%.d:%.cpp
	$(CC) $(CCFLAGS) $(DEPFLAGS) $< > $@

# Individual dependencies

DEPENDS = $(OBJ:.o=.d)
include $(DEPENDS)
