#  MIMD version 6
#  Standard application makefile for Linux cluster
#  Do not use for making libraries
#  Copy this file into the application directory and run make there.
#

# This file
MAKEFILE = Make_linux_qdp
COMMTYPE = QMP

#----------------------------------------------------------------------
#  User choices - edit to suit 
#----------------------------------------------------------------------
# 1. Compiler
CC               = gcc    # ( mpicc cc gcc pgcc g++ )
#  (Use /usr/local/myricom/vmi/bin/gcc/mpicc on qcdhome.fnal.gov 7/2002)

#----------------------------------------------------------------------
# 2. Compiler optimization level
OPT              = -O3    # ( -g -O, etc )

#----------------------------------------------------------------------
# 3. Other compiler optimization flags.  Uncomment stanza to suit.
#-------------- Gnu C -------------------------------------
#OCFLAGS = -Wall  # ( -DP3, -DP4 )
OCFLAGS = -Wall -fexpensive-optimizations -fpeephole -fstrength-reduce -march=i586  # Simone's pick for PIII/gcc version 2.95.2.1 19991024 (release)
#-------------- Portland Group ----------------------------
#OCFLAGS = -tp p6 -Munroll=c:4,n:4
#OCFLAGS= -mpentiumpro -march=pentiumpro -funroll-all-loops -malign-double -D_REENTRANT  # Pentium pro

#-------------- DEC Alpha ---------------------------------
#OCFLAGS = -DT3E -float -fptm n 

#-------------- SUN SPARC ---------------------------------
#OCFLAGS= -fast -dalign -libmil -fsimple=2 -fns  #Ultra

#----------------------------------------------------------------------
# 4. Choose large file support
#CLFS = -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE64 # Large files gcc only
CLFS =             # Not researched for others

#------------------------------------------------------
#  *** edit these ***
QDP = $(HOME)/scidac/build/qdp
QLA = $(HOME)/scidac/build/qla
QIO = $(HOME)/scidac/build/qio
QMP = $(HOME)/scidac/build/qmp-single
IMPI = #-I/usr/include/mpi
LMPI = #-lmpi

# shouldn't need to change this
IQDP = -I$(QDP)/include -I$(QLA)/include -I$(QIO)/include -I$(QMP)/include $(IMPI)
LQDP = -L$(QDP)/lib -lqdp_int -lqdp_f -lqdp_f3 -lqdp_common \
       -L$(QLA)/lib -lqla_int -lqla_f -lqla_f3 -lqla_d -lqla_d3 \
                    -lqla_df -lqla_df3 -lqla_random \
       -L$(QIO)/lib -lqio -llime \
       -L$(QMP)/lib -lqmp $(LMPI)

#----------------------------------------------------------------------
# 6. I/O routines
# Both io_nonansi and io_ansi should work on a scalar machine
# Solaris 2.6 gave "bad file number" errors with io_ansi.  CD
MACHINE_DEP_IO   = io_ansi.o # (io_ansi.o io_nonansi.o io_romio.o)

#----------------------------------------------------------------------
# 7. Linker
LD               = ${CC}

#----------------------------------------------------------------------
# 8. Extra linker flags
LDFLAGS          =           # most
#LDFLAGS          = -fast     # Sun SPARC

#----------------------------------------------------------------------
# 9. Extra libraries
ILIB             = ${LQDP}    # not needed if using mpicc

#----------------------------------------------------------------------
# 10. Code alternatives 

# -DSSE says we have the SSE package
# For P3 or P4 or Athlon Thunderbird and GNUC Use -DSSE_INLINE to get
# inline assembly code from the package.

CODETYPE         = -DNOPREFETCH -DSSE -DSSE_INLINE #-DCGTIME -DQDP_PROFILE

#----------------------------------------------------------------------
# 11. Choose MILC library make file in libraries directory.  
#    CHECK IT FOR FURTHER OPTIONS!

MAKELIBRARIES = Make_vanilla  # or Make_SSE_nasm (don't use -DSSE with this)

#----------------------------------------------------------------------
# End of user choices.  Please, also, check include/config.h.
#----------------------------------------------------------------------

# Routines that depend on both application and architecture
MACHINE_DEP = com_qmp.o ${MACHINE_DEP_IO}

# Complete set of compiler flags - do not change
CFLAGS = ${OPT} ${OCFLAGS} -D${COMMTYPE} ${CODETYPE} ${CLFS} ${IQDP} -I${MYINCLUDEDIR} ${DEFINES}

include Make_template_qdp
