#*****************************************************************
#**                                                             **
#**             (C) Copyright 1992 the Regents of the           **
#**        University of California.  All Rights Reserved.      **
#**                                                             **
#**        This work was produced under the sponsorship of      **
#**         the U.S. Department of Energy.  The Government      **
#**                retains certain rights therein.              **
#**                                                             **
#**                         Written by                          **
#**         Distributed Programming Environments Project        **
#**           Computer Software and Networking Division,        **
#**                   Livermore Computer Center,                **
#**            Lawrence Livermore National Laboratory           **
#**                                                             **
#*****************************************************************

#	sccsid:		"@(#)Makesocket	1.7 10/26/92 09:40:45 LLNL "

#
#	Make for real tests over PURESOCKETS
#

# The following macros need to be defined on the command line for all
# tests:
#
#   TEST - the prefix of the test file (.ec file) to execute
#   TEST_IP - name of host machine on which to run
#
# The following macros may be defined on the command line, but are given
# local defaults in this file.
#
#   SERVER - the name of the server
#   CLIENT - the name of the client
#   SARGS - server command line arguments
#   CARGS - client command line arguments
#   OUT - .out file to use for comparison of output
#
# The following macros may be defined on the command line to select the ELROS
# system (driver, preprocessor, runtime) that you want to test.  The default
# values are read from ../Make.Defaults.
#
#   RO_DIR - path name to ELROS system to test
#   RO_SWITCHES - Command line arguments to C or ECC to use
#
#   ECC - Path name to driver to test, if not in $(RO_DIR)/driver
#
# Note:  use RO_SWITCHES=-## for a verbose version of ECC commands.
#
# The following macros need to be defined on the command line for some
# tests.
#
#   AUX - .in files to read
#   EXTRAS - .i files (interface specifications) to use
#

include ../Make.Defaults

#
# Local macros, if not defined on command line
#
SERVER=	$(TEST).ex
CLIENT=	$(TEST).ex
SARGS=	$(TEST_IP) r
CARGS=	$(TEST_IP) i
OUT=	complete.out

#
# Paths and files
#
I	=	$(RO_DIR)/runtime/include/elros/
INCLUDES=       $(I)preprocessor.h $(I)instance.h $(I)sem.h $(I)exceptions.h \
                $(I)typeinfo.h $(I)messages.h $(I)oidtree.h $(I)typeforms.h \
		$(I)sendP_element.h $(I)typetags.h $(I)typecodes.h \
		$(I)typecmps.h $(I)typecopies.h $(I)typeconsts.h \
		$(I)functiondefs.h $(I)binds.h $(I)shared_decls.h

#
# Targets
#
all:	diff $(OS) finis

finis:
	$(RM) $(TEST).ex $(TEST).ec..o $(TEST).OUT*
	$(TOUCH) $(TEST)

UNIX:
	$(PS) | $(GREP) $(SERVER) | $(GREP) -v $(GREP) | \
	  $(SED) -e "s!\([ ]*\)\([0123456789]*\)\(.*\)!$(KILL) \2!" | $(CSH)
	$(PS) | $(GREP) $(CLIENT) | $(GREP) -v $(GREP) | \
	  $(SED) -e "s!\([ ]*\)\([0123456789]*\)\(.*\)!$(KILL) \2!" | $(CSH)

diff:	$(SERVER) $(CLIENT)
	$(SERVER) $(SARGS) > $(TEST).OUTr &
	$(SLEEP) 5
	$(CLIENT) $(CARGS) > $(TEST).OUTi
	-$(GREP) "test completed" $(TEST).OUTi > $(TEST).DIFF
	-$(DIFF) $(TEST).DIFF $(OUT)
	$(RM) $(TEST).DIFF
	-$(GREP) "test completed" $(TEST).OUTr > $(TEST).DIFF
	-$(DIFF) $(TEST).DIFF $(OUT)
	$(RM) $(TEST).DIFF

$(TEST).ex: perfsub.o $(TEST).ec..o 
	$(ECC) $(RO_SWITCHES) $(TEST).ec..o perfsub.o -o $(TEST).ex

$(TEST).ec..o:	$(TEST).ec $(INCLUDES) $(AUX) $(EXTRAS)
	$(ECC) -c $(RO_SWITCHES) $(TEST).ec

perfsub.o:

