#       Makefile for OS9 version cross-compiled on PRIAM
#
#	The "TCPOnly" versions have tcp only, no raw ethernet or v24.
#
BIG = /userd/tbl/rpc/test/big/
RPCC = /userd/tbl/rpc/compiler/rpcc
OBJECTS = rpcrts.r errmsg.r rpc_msg.r ts.r ts_eth.r ts_tcp.r ts_v24.r \
	cm_env.r rpc_eth_os9.r rpc_v24_os9.r rpc_os9.r
TCPOBJECTS = rpcrts.r errmsg.r rpc_msg.r TCPOnly/ts.r ts_tcp.r cm_env.r rpc_os9.r
NETLIB = -l=/usr/local/os9/lib/socklib.l -l=/usr/local/os9/lib/netdb.l
RPCLIB = ./rpclib.l
RPCLIB8K = ./rpclib8k.l

CFLAGS = -r=. -V=. -V=.. -DETHERNET -DTCP -DV24
CFLAGS2 = -r=. -V=. -V=.. -DTCP -R=TCPOnly

all : TCPOnly/rpclib.l rpclib.l big_ser big_cli
	touch all

rpclib.l : $(OBJECTS)
	cat $(OBJECTS) > rpclib.l

TCPOnly/rpclib.l : $(TCPOBJECTS)
	cat $(TCPOBJECTS) > TCPOnly/rpclib.l

rpcrts.r : ../rpcrts.c
	cc68 $(CFLAGS) -k=2 ../rpcrts.c
errmsg.r : ../errmsg.c ../errmsg.h
	cc68 $(CFLAGS) -k=2 ../errmsg.c
rpc_msg.r : ../rpc_msg.c ../errmsg.h
	cc68 $(CFLAGS) -k=2 ../rpc_msg.c
ts.r : ../ts.c
	cc68 $(CFLAGS) ../ts.c
TCPOnly/ts.r : ../ts.c
	cc68 $(CFLAGS2) ../ts.c
ts_tcp.r : ../ts_tcp.c
	cc68 $(CFLAGS) ../ts_tcp.c
ts_eth.r : ../ts_eth.c
	cc68 $(CFLAGS) ../ts_eth.c
ts_v24.r : ../ts_v24.c
	cc68 $(CFLAGS) ../ts_v24.c
cm_env.r : ../cm_env.c
	cc68 $(CFLAGS) ../cm_env.c

#  OS9 - specific modules:

rpc_os9.r : rpc_os9.c
	cc68 $(CFLAGS) rpc_os9.c
rpc_eth_os9.r : rpc_eth_os9.c
	cc68 $(CFLAGS) rpc_eth_os9.c
rpc_v24_os9.r : rpc_v24_os9.c
	cc68 $(CFLAGS) rpc_v24_os9.c


#___________________________________________________________________________
#
#       BIG Test program:
#
#       Note we have to specify an extra 16kB stack size (4k is too little).
#
big_ser:     big_sloop_c.r big_sub_c.r big_ser_c.r $(RPCLIB)
	cc68 -M=16K big_sloop_c.r big_sub_c.r big_ser_c.r \
	     -l=$(RPCLIB) $(NETLIB) -f=big_ser

big_sub_c.r : $(BIG)big_sub_c.c
	cc68 -V=.. -r=. $(BIG)big_sub_c.c

big_sloop_c.r : $(BIG)big_sloop_c.c
	cc68 -V=.. -r=. $(BIG)big_sloop_c.c

big_ser_c.r : $(BIG)big_ser_c.c
	cc68 -V=.. -r=. $(BIG)big_ser_c.c

big_cli:         big_prog_c.r big_cli_c.r $(RPCLIB)
	cc68  big_prog_c.r big_cli_c.r -l=$(RPCLIB) $(NETLIB) -f=big_cli

big_prog_c.r : $(BIG)big_prog_c.c
	cc68 -V=.. -r=. $(BIG)big_prog_c.c

big_cli_c.r : $(BIG)big_cli_c.c
	cc68 -V=.. -r=. $(BIG)big_cli_c.c
#________________________________________________________________________

clean :
	rm *.r
