# tbird = Dell cluster with dual 3.6 GHz Xeons, Intel mpicxx, native MPI, FFTW

SHELL = /bin/sh
.IGNORE:

# this Makefile builds LAMMPS for openMPI running on Tbird
# as of April 09, you want these modules loaded, which are not the default:
#   mpi/openmpi-1.2.8_intel-11.0-f074-c074
#   misc/env-openmpi-1.2
#   compilers/intel-11.0-f074-c074
#   libraries/intel-mkl
#   libraries/intel_fftw-10.0.4.023
#   libraries/intel-mkl-11.0.074
# you can determine which modules are loaded by typing:
#   module list
# you can load these modules by putting
#   these lines in your .cshrc or other start-up shell file
#   or by typing them before you build LAMMPS:
#     module switch mpi mpi/openmpi-1.2.8_intel-11.0-f074-c074
#     module load libraries/intel_fftw-10.0.4.023
#     module load libraries/intel-mkl-11.0.074
# these same modules need to be loaded to submit a LAMMPS job,
#   either interactively or via a batch script

# ---------------------------------------------------------------------
# System-specific settings
# edit as needed for your machine

# additional system libs needed by LAMMPS libs
# NOTE: these settings are ignored if the LAMMPS package (e.g. gpu, meam)
#       which needs these libs is not included in the LAMMPS build

gpu_SYSLIB =          -lcudart
meam_SYSLIB =         -lifcore -lsvml -lompstub -limf
reax_SYSLIB =         -lifcore -lsvml -lompstub -limf
user-atc_SYSLIB =     -lblas -llapack

gpu_SYSLIBPATH =      -L/usr/local/cuda/lib64
meam_SYSLIBPATH =     -L/opt/intel/fce/10.0.023/lib
reax_SYSLIBPATH =     -L/opt/intel/fce/10.0.023/lib
user-atc_SYSLIBPATH = 

include	Makefile.package

# compiler/linker settings
# NOTE: specify how to compile/link with MPI
#       either an MPI installed on your machine, or the src/STUBS dummy lib
# NOTE: specify an FFT option, e.g. -DFFT_NONE, -DFFT_FFTW, etc

CC =		mpicxx
CCFLAGS =	-O -DFFT_FFTW -I$(FFTW_INCLUDE) $(PKGINC)
DEPFLAGS =	-M
LINK =		mpicxx
LINKFLAGS =	-O $(PKGPATH) $(PKGPATHSYS)
SYSLIB =	-lm $(PKGLIBSYS)
SIZE =		size
ARCHIVE =       ar
ARFLAGS =       -rc

# Link rule

$(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)
