#  Wilson heavy code
#  MIMD version 5

#  Generic make-include file for heavy codes

#  This template file defines rules and macros common to all architectures
#  It is intended to be an include file for other Makefiles.
#  Don't use it by itself!
#
#
# "make su3_sum" reconstructs the hopping parameter expansion


MYINCLUDEDIR = .
INCLUDEDIR = ../../include
#Where the complex and su3 libraries are
LIBDIR = ../../libraries

GLOBAL_HEADERS = \
  ${INCLUDEDIR}/complex.h \
  ${INCLUDEDIR}/su3.h \
  ${INCLUDEDIR}/macros.h \
  ${INCLUDEDIR}/comdefs.h \
  ${INCLUDEDIR}/io_lat.h

MY_HEADERS = \
  lattice_k.h \
  w_sum_includes.h

HEADERS = ${GLOBAL_HEADERS} ${MY_HEADERS}

# Choose one of the lattice layout algorithms:
LAYOUT = layout_hyper

OBJECTS=  \
   control_k.o \
   com_dummy.o \
   setup_k.o \
   sum.o \
   sum_light.o \
   output_k.o \
   input_m.o \
   input_mb2.o \
   io_helpers_strip.o


#Libraries for complex numbers and su3 functions
QCDLIB = ${LIBDIR}/su3.${PRECISION}.a ${LIBDIR}/complex.${PRECISION}.a 

LIBRARIES = ${QCDLIB} ${SCIDAC_LIBRARIES}

.c.o: ; ${CC} -c ${CFLAGS} $<

# To force a full remake when changing targets
LASTMAKE = .lastmake.${MAKEFILE}.${MYTARGET}

${LASTMAKE}: ${ALL_MAKES}
	touch .lastmake.humor_irix; /bin/rm -f .lastmake.*
	${MAKE} -f ${MAKEFILE} clean
	touch ${LASTMAKE}

# To force a remake when changing make files
ALL_MAKES = \
  Make_template \
  ${MAKEFILE} \
  ../../Make_template_qop \
  ../../Make_template_scidac

${OBJECTS} ${EXTRA_OBJECTS} : ${HEADERS} ${EXTRA_HEADERS} ${LASTMAKE} ${ALL_MAKES}

########################################################
# Note: we prefer double precison version of inverters {for global sums}

# Optional DEFINES for timing:
# -DCGTIME for cg timing and iterations
# -DMRTIME for cg timing and iterations

su3_sum::
	make -f ${MAKEFILE} target "MYTARGET= $@" \
	"DEFINES= "
	
clean:
	touch humor_irix.o; /bin/rm -f *.o


target: ${OBJECTS} ${EXTRA_OBJECTS} ${QCDLIB}
	${LD} ${LDFLAGS} -o ${MYTARGET} \
	${OBJECTS} ${EXTRA_OBJECTS} ${QCDLIB} ${ILIB} -lm
	touch target
