#       Makefile for RPC tests on priam
#
# S = stub source .rpc files
# SS = stub secondary .c files
#
RPC = ../../..
RRC = $(RPC)/rts/c/
RPC_INC = $(RPC)/rts/c
RPCRTS_H = $(RPC_INC)/rpcrts.h
S	= ..
SS	= ..
#       Choose the RPC library to use:

RPCLIB = $(RRC)/vax_ultrix/librpc.a

RPCC = $(RPC)/compiler/rpcc
CFLAGS = -I$(RPC_INC)

.c.o	:	; gcc -c $(CFLAGS) $*.c

#-----------------------------------------------------------

all : time_cli_c time_ser_c big_ser_c big_cli_c cback_cli_c cback_ser_c
	touch all

time_ser_c : time_ser_c.o time_sub_c.o $(RPCLIB) $(RPCRTS_H)
	cc -I$(RPC_INC) -o time_ser_c   \
	      time_ser_c.o $(SS)/time_sub_c.c $(RPCLIB)
	chmod +x time_ser_c

time_ser_c.o : $(SS)/time_ser_c.c $(RPCRTS_H) 
	cc -c -I$(RPC_INC) $(SS)/time_ser_c.c

$(SS)/time_ser_c.c : $(S)/time.rpc $(RPCC) $(RPCRTS_H)
	$(RPCC) -byvalue -sgenericc=$(SS)/time_ser_c.c $(S)/time.rpc

time_sub_c.o : $(SS)/time_sub_c.c $(RPCRTS_H)
	cc -c -I$(RPC_INC) $(SS)/time_sub_c.c

time_cli_c : time_cli_c.o time_prog_c.o $(RPCLIB) $(RPCRTS_H)
	cc -I$(RPC_INC) -o time_cli_c time_cli_c.o time_prog_c.o $(RPCLIB) -lm
	chmod +x time_cli_c

time_cli_c.o : $(SS)/time_cli_c.c $(RPCRTS_H)
	cc -c -I$(RPC_INC) $(SS)/time_cli_c.c

$(SS)/time_cli_c.c : $(S)/time.rpc $(RPCC) $(RPCRTS_H)
	$(RPCC) -byvalue -cgenericc=$(SS)/time_cli_c.c $(S)/time.rpc

time_prog_c.o : $(S)/time_prog_c.c $(RPCRTS_H)
	cc -c -I$(RPC_INC) $(S)/time_prog_c.c
#____________________________________________________________________


big_ser_c : big_ser_c.o $(S)/big_sloop_c.c $(S)/big_sub_c.c $(RPCLIB) $(RPCRTS_H)
	cc -I$(RPC_INC) -o big_ser_c \
	      $(S)/big_sloop_c.c big_ser_c.o $(S)/big_sub_c.c $(RPCLIB)
	chmod +x big_ser_c

big_ser_c.o : $(SS)/big_ser_c.c $(RPCRTS_H)
	cc -c -I$(RPC_INC) $(SS)/big_ser_c.c

$(SS)/big_ser_c.c : $(S)/big.rpc $(RPCC)
	$(RPCC) -sgenericc=$(SS)/big_ser_c.c $(S)/big.rpc

#big_sub_c.o : $(S)/big_sub_c.c $(RPCRTS_H)
#	cc -c -I$(RPC_INC) $(S)/big_sub_c.c

big_cli_c : big_cli_c.o big_prog_c.o $(RPCLIB)
	cc -o big_cli_c big_cli_c.o big_prog_c.o $(RPCLIB) -lm

big_cli_c.o : $(SS)/big_cli_c.c $(RPCRTS_H)
	cc -c -I$(RPC_INC) $(SS)/big_cli_c.c

$(SS)/big_cli_c.c : $(S)/big.rpc $(RPCC)
	$(RPCC) -cgenericc=$(SS)/big_cli_c.c $(S)/big.rpc

big_prog_c.o : $(S)/big_prog_c.c $(RPCRTS_H)
	cc -c -I$(RPC_INC) $(S)/big_prog_c.c

#____________________________________________________________________

$(SS)/cback1_ser_c.c : $(S)/cback1.rpc $(RPCC)
	$(RPCC) -byvalue -sgenericc=$(SS)/cback1_ser_c.c $(S)/cback1.rpc
$(SS)/cback1_cli_c.c : $(S)/cback1.rpc $(RPCC)
	$(RPCC) -byvalue -cgenericc=$(SS)/cback1_cli_c.c $(S)/cback1.rpc

$(SS)/cback2_ser_c.c : $(S)/cback2.rpc $(RPCC)
	$(RPCC) -byvalue -sgenericc=$(SS)/cback2_ser_c.c $(S)/cback2.rpc
$(SS)/cback2_cli_c.c : $(S)/cback2.rpc $(RPCC)
	$(RPCC) -byvalue -cgenericc=$(SS)/cback2_cli_c.c $(S)/cback2.rpc

cback1_ser_c.o : $(SS)/cback1_ser_c.c $(RPCHEADER)
	cc -c -I$(RPC_INC) $(SS)/cback1_ser_c.c
cback1_cli_c.o : $(SS)/cback1_cli_c.c $(RPCHEADER)
	cc -c -I$(RPC_INC) $(SS)/cback1_cli_c.c
cback2_ser_c.o : $(SS)/cback2_ser_c.c $(RPCHEADER)
	cc -c -I$(RPC_INC) $(SS)/cback2_ser_c.c
cback2_cli_c.o : $(SS)/cback2_cli_c.c $(RPCHEADER)
	cc -c -I$(RPC_INC) $(SS)/cback2_cli_c.c
cback_ser_c : cback1_ser_c.o cback2_cli_c.o cback_sub_c.o $(RPCLIB)
	cc -o cback_ser_c cback1_ser_c.o cback2_cli_c.o cback_sub_c.o $(RPCLIB)

cback_cli_c : cback2_ser_c.o cback1_cli_c.o cback_prog_c.o $(RPCLIB)
	cc -o cback_cli_c cback2_ser_c.o cback1_cli_c.o cback_prog_c.o $(RPCLIB)

cback_prog_c.o : $(S)/cback_prog_c.c $(RPCHEADER)
	gcc -c $(CFLAGS) $(S)/cback_prog_c.c

cback_sub_c.o : $(S)/cback_sub_c.c
	gcc -c $(CFLAGS) $(S)/cback_sub_c.c

