# Copyright 2000, International Business Machines Corporation and others.
# All Rights Reserved.
# 
# This software has been released under the terms of the IBM Public
# License.  For details, see the LICENSE file in the top-level source
# directory or online at http://www.openafs.org/dl/license10.html

srcdir=@srcdir@
include @TOP_OBJDIR@/src/config/Makefile.config
include @TOP_OBJDIR@/src/config/Makefile.lwp
top_builddir=@TOP_OBJDIR@


CFLAGS=-g -I. -I${srcdir} -I${TOP_OBJDIR}/src/config -I${TOP_INCDIR} ${XCFLAGS} ${ARCHFLAGS}

HEADERS = ../rxkad.h stress.h stress_internal.h stress_errs.h

LIBS=${TOP_LIBDIR}/libauth.a \
	${TOP_LIBDIR}/librx.a \
	${TOP_LIBDIR}/liblwp.a \
	${TOP_LIBDIR}/libsys.a \
	${TOP_LIBDIR}/libcmd.a \
	${TOP_LIBDIR}/librxkad.a \
	${TOP_LIBDIR}/libafshcrypto_lwp.a \
	${TOP_LIBDIR}/librx.a \
	${TOP_LIBDIR}/libafscom_err.a \
	${TOP_LIBDIR}/util.a

THLIBS= $(top_builddir)/src/cmd/liboafs_cmd.la  \
	${TOP_LIBDIR}/libafscom_err.a \
	${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a \
	${MT_LIBS} ${ULIBS} ${LIBRPC} -lpthread

THRULE = ${MT_CC} $(COMMON_CFLAGS) $(MT_CFLAGS)

noversion all test system: stress

clean:
	$(LT_CLEAN)
	$(RM) -f *.o stress.cs.c stress.ss.c stress.xdr.c stress.h \
		stress_errs.c stress_errs.h stress th_*

stress.ss.o: stress.ss.c
stress.cs.o: stress.cs.c
stress.xdr.o: stress.xdr.c stress.h

th_stress.ss.o: stress.ss.c
	${THRULE} -c stress.ss.c -o th_stress.ss.o

th_stress.cs.o: stress.cs.c
	${THRULE} -c stress.cs.c -o th_stress.cs.o

th_stress.xdr.o: stress.xdr.c stress.h
	${THRULE} -c stress.xdr.c -o th_stress.xdr.o

stress.ss.c: stress.rg
	${RXGEN} -A -x -S -o stress.ss.c $(srcdir)/stress.rg

stress.cs.c: stress.rg
	${RXGEN} -A -x -C -o stress.cs.c $(srcdir)/stress.rg

stress.xdr.c: stress.rg
	${RXGEN} -A -x -c -o stress.xdr.c $(srcdir)/stress.rg

stress.h: stress.rg
	${RXGEN} -A -x -h -o stress.h $(srcdir)/stress.rg

stress_errs.o: stress_errs.c

th_stress_errs.o: stress_errs.c
	${THRULE} -c $(srcdir)/stress_errs.c -o th_stress_errs.o

stress_errs.c: stress_errs.et
	${COMPILE_ET_C} -p ${srcdir} stress_errs

stress_errs.h: stress_errs.et
	${COMPILE_ET_H} -p ${srcdir} stress_errs

stress_c.o: stress_errs.h
stress.o: stress_errs.h
stress_s.o: stress_errs.h

stress.o: ${HEADERS}
stress_c.o: ${HEADERS}
stress_s.o: ${HEADERS}

th_stress.o: stress.c ${HEADERS}
	${THRULE} -c $(srcdir)/stress.c -o th_stress.o

th_stress_c.o: stress_c.c ${HEADERS}
	${THRULE} -c $(srcdir)/stress_c.c -o th_stress_c.o

th_stress_s.o: stress_s.c ${HEADERS}
	${THRULE} -c $(srcdir)/stress_s.c -o th_stress_s.o

stress: stress.o stress.xdr.o stress_c.o stress_s.o stress.cs.o \
		stress.ss.o stress_errs.o
	$(AFS_LDRULE) stress.o stress.xdr.o stress_c.o \
		stress_s.o stress.cs.o stress.ss.o stress_errs.o \
		${LIBS} ${XLIBS}

th_stress: th_stress.o th_stress.xdr.o th_stress_c.o th_stress_s.o \
		th_stress.cs.o th_stress.ss.o stress_errs.o \
		${LIBRPC}
	$(LT_LDRULE_static) th_stress.o th_stress.xdr.o th_stress_c.o \
		th_stress_s.o th_stress.cs.o th_stress.ss.o stress_errs.o \
		${THLIBS}

