include ../config/make.def

# Note that COMPILE is also defined in make.common and should
# be the same. We can't include make.common because it has a lot
# of other garbage. LINK is not defined in make.common because
# ${MPI_LIB} needs to go at the end of the line. 
COMPILE = $(F77) -c $(MPI_INC) $(FFLAGS)
LINK=${LOAD} ${LDFLAGS} ${MPI_LIB}

all: setparams mpifrag.f print_results.o

# setparams creates an npbparam.h file for each benchmark 
# configuration. npbparams.h also contains info about how a benchmark
# was compiled and linked

setparams: setparams.c
	$(CC) -o setparams setparams.c

print_results.o: print_results.f
	$(F77) -c $(FFLAGS) print_results.f

#  
# The variables dp_type, integer_type and dc_type need
# to be defined every benchmark (see comments in make.def). 
# The correct values are specified in make.def and need
# to be set in some Fortran code. 
# This creates a small Fortran code fragment that 
# can be inserted into each benchmark. 

mpifrag.f: ../config/make.def
	-rm -f mpifrag.f
	@echo "c This file is generated automatically. Rebuild it"   > mpifrag.f
	@echo "c by typing "make" in the config directory"          >> mpifrag.f
	@echo "        dp_type = ${DP_TYPE}"             >> mpifrag.f
	@echo "        integer_type = ${INTEGER_TYPE}"   >> mpifrag.f
	@echo "        dc_type = ${DC_TYPE}"             >> mpifrag.f


clean: 
	-rm -f setparams makesuite setparams.h npbparams.h mpifrag.f
	-rm -f *~ *.o

