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

SHELL = /bin/sh

# System-specific settings

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

CC =		mpiCC
CCFLAGS =	-O -DFFT_FFTW -I${FFTW_INC}
DEPFLAGS =	-M
LINK =		mpiCC
LINKFLAGS =	-O -L${FFTW_LIB}
USRLIB =	${FFTW_LIB}/libfftw.a
SYSLIB =	-L/opt/apps/intel/10.1/fc/lib -lifcore
#SYSLIB =	-L/opt/apps/intel/10.1/fc/lib -lifcore (use if linking to MEAM)
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)
