# 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
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@


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}/libdes.a \
	${TOP_LIBDIR}/librx.a \
	${TOP_LIBDIR}/libafscom_err.a \
	${TOP_LIBDIR}/util.a

THLIBS= ${TOP_LIBDIR}/libcmd.a  ${TOP_LIBDIR}/libafscom_err.a \
	${TOP_LIBDIR}/libafsauthent.a ${TOP_LIBDIR}/libafsrpc.a \
	${MT_LIBS} ${ULIBS} ${XLIBS} ${LIBRPC} -lpthread

THRULE = ${MT_CC} ${CFLAGS} ${MT_CFLAGS}

noversion all test system: stress

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.h: stress_errs.et
	$(RM) -f stress_errs.h stress_errs.c; ${COMPILE_ET} -p ${srcdir} stress_errs -h stress_errs

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 
	$(CC) $(CFLAGS) -o stress 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}
	${CC} ${CFLAGS} ${THFLAGS} -o 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 ${THLIBS} ${XLIBS}

