## -*- Mode: Makefile; -*-
## vim: set ft=automake :
##
## (C) 2011 by Argonne National Laboratory.
##     See COPYRIGHT in top-level directory.
##

## This is an automake makefile fragment that should be included by:
##
##   include $(top_srcdir)/Makefile.mtest
##
## It provides a "testing" rule that uses runtests, cleanup for summary.xml, and
## adds appropriate includes and linker flags for using the MTest framework.
## The goal is to reduce the amount of boilerplate that needs to exist in each
## Makefile.am

# AM_CPPFLAGS are used for C++ code as well
AM_CPPFLAGS = -I$(top_builddir)/include -I$(top_srcdir)/include
LDADD = $(top_builddir)/util/mtest.o

## FIXME "DEPADD" is a simplemake concept, which we can handle on a per-target
## prog_DEPENDENCIES variable, but it would be better to figure out the right
## way to do this
##DEPADD = @MPILIBLOC@ $(top_builddir)/util/mtest.o

$(top_builddir)/util/mtest.$(OBJEXT): $(top_srcdir)/util/mtest.c
	(cd $(top_builddir)/util && $(MAKE) mtest.$(OBJEXT))

testing:
	$(top_builddir)/runtests -srcdir=$(srcdir) -tests=testlist \
		-mpiexec=${MPIEXEC} -xmlfile=summary.xml \
		-tapfile=summary.tap

CLEANFILES = summary.xml summary.tap
