# glory = Linux cluster with 4-way quad cores, Intel mpicxx, native MPI, FFTW

SHELL = /bin/sh
.IGNORE:

# this Makefile builds LAMMPS for mvapich running on Glory
# to invoke this Makefile, you need these modules loaded:
#   compilers/intel-10.1-f015-c015
#   misc/env-mvapich
#   mpi/mvapich-1.0.1_ofed_intel-10.1-f015-c015
#   libraries/fftw-2.1.5_openmpi-1.2.7_ofed_intel-10.1-f015-c015
# you can determine which modules are loaded by typing:
#   module list
# these modules are not the default ones, but can be enabled by 
#   lines like this in your .cshrc or other start-up shell file
#   or by typing them before you build LAMMPS:
#     module swap mpi mpi/mvapich-1.0.1_ofed_intel-10.1-f015-c015
#     module load libraries/fftw-2.1.5_openmpi-1.2.7_ofed_intel-10.1-f015-c015
# these same modules need to be loaded to submit a LAMMPS job,
#   either interactively or via a batch script

# System-specific settings

CC =		mpicxx
CCFLAGS =	-O -DFFT_FFTW -I${FFTW_INCLUDE}
DEPFLAGS =	-M
LINK =		mpicxx
LINKFLAGS =	-O -L${FFTW_LIB}
USRLIB =	-lfftw -lstdc++
SYSLIB =	-lm
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)
