# FILE NAME: Makefile 
# Makefile for the remote_file application
#
# definitions for this make file
#
APPL=remote_file
IDLCMD=idl -v 
CHECK=../arithmetic       # Directory containing check_status.h
LIBS = -ldce -lpthreads -lc_r -lmach -lm		# DEC Alpha OSF/1
CFLAGS= -D_SHARED_LIBRARIES -Dalpha -D_REENTRANT	# DEC Alpha OSF/1
CC= cc 


#
# COMPLETE BUILD of the distributed application.
#
all:	local interface client server


#
# LOCAL BUILD of the client application to test locally.
#
local:	interface r_client.c get_args.c r_procedures.c
	   $(CC) $(CFLAGS) -DLOCAL -o local_r_client.exe \
		   r_client.c get_args.c r_procedures.c 
# remove object files so they do not interfere with a real build
	   rm r_client.o get_args.o r_procedures.o 


#
# INTERFACE BUILD 
#
interface:	$(APPL).h $(APPL)_cstub.o $(APPL)_sstub.o
$(APPL).h $(APPL)_cstub.o $(APPL)_sstub.o:	$(APPL).idl
	   $(IDLCMD) $(APPL).idl


#
# CLIENT BUILD 
#
client:	r_client
r_client:	$(APPL).h r_client.o get_args.o do_string_binding.o \
   $(APPL)_cstub.o
	   $(CC) $(CFLAGS) -o r_client.exe r_client.o \
		   get_args.o do_string_binding.o $(APPL)_cstub.o $(LIBS)

do_string_binding.o:	do_string_binding.c
	   $(CC) $(CFLAGS) -I$(CHECK) -c do_string_binding.c


#
# SERVER BUILD 
#
server:	r_server 
r_server:	$(APPL).h r_server.o r_procedures.o context_rundown.o \
   $(APPL)_sstub.o 
	   $(CC) $(CFLAGS) -I$(CHECK) -o r_server.exe r_server.o \
	       r_procedures.o context_rundown.o $(APPL)_sstub.o $(LIBS)

r_server.o:	r_server.c
	   $(CC) $(CFLAGS) -I$(CHECK) -c r_server.c
