# Build rules for the OpenAFS test suite.

srcdir=@srcdir@/../src/external/c-tap-harness/tests
abs_top_srcdir=@abs_top_srcdir@
abs_top_builddir=@abs_top_builddir@
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.pthread

MODULE_CFLAGS = -DC_TAP_SOURCE='"$(abs_top_srcdir)/tests"' \
	-DC_TAP_BUILD='"$(abs_top_builddir)/tests"'

SUBDIRS = tap common auth util cmd volser opr rx

all: runtests
	@for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done

runtests: runtests.o
	$(AFS_LDRULE) runtests.o

runtests.o: $(srcdir)/runtests.c
	$(AFS_CCRULE) $(srcdir)/runtests.c

check test tests: runtests
	@for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
	MAKECHECK=1 ./libwrap @TOP_OBJDIR@/lib \
	    ./runtests -v -l $(abs_top_srcdir)/tests/TESTS

install:

clean distclean:
	@for A in $(SUBDIRS); do cd $$A && $(MAKE) $@ && cd .. || exit 1; done
	$(RM) -f *.o core runtests
