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

SHELL = /bin/sh
.IGNORE:

# System-specific settings

# openmpi on tbird does not work correctly with LAMMPS
# mvapich should be used
# mpiexec should be used
#
# Before building Lammps on tbird, do the following two module commands:
#     "module switch mpi mpi/mvapich-0.9.8-ofed-intel-9.1"
#     "module load libraries/fftw-2.1.5-openmpi-1.1.2-ofed-intel-9.1"
#     Note: this fftw is correct, despite the openmpi in the name
#
# Before issuing a mpiexec command for Lammps, use the following commands:
#     "source /opt/modules/3.1.6/init/bash"
#     "module switch mpi mpi/mvapich-0.9.8-ofed-intel-9.1"
#     "module load libraries/fftw-2.1.5-openmpi-1.1.2-ofed-intel-9.1" 
#
# If bash is not your interactive shell,
#    or what is specified in your NQS script,
#    substitute another shell name for bash in the "source" line

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)
