# g++ = UT Lonestar TACC machine, mpiCC, MPI, FFTW

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

FFTW_INC = ${TACC_FFTW2_INC}
FFTW_LIB = ${TACC_FFTW2_LIB}

CC =		mpiCC
CCFLAGS =	-O -DFFT_FFTW -I${FFTW_INC} $(PKGINC)
DEPFLAGS =	-M
LINK =		mpiCC
LINKFORT =	-L/opt/apps/intel/10.1/fc/lib
LINKGPU =	
LINKFLAGS =	-O -L${FFTW_LIB} $(PKGPATH) $(LINKFORT) $(LINKGPU)
USRLIB =	${FFTW_LIB}/libfftw.a $(PKGLIB) 
FORTLIB =	-lifcore
GPULIB =	
SYSLIB =	$(FORTLIB) $(GPULIB)
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)
