# FILE NAME: Makefile 
# Makefile for the inventory application
#
# definitions for this make file 
#
APPL=inventory
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 application.
#
all:	local interface client server


#
# LOCAL BUILD of the application to test locally.
#
local:	interface i_client.c i_procedures.c implement_inventory.c
	   $(CC) $(CFLAGS) -DLOCAL -o local_i_client.exe i_client.c \
		  i_procedures.c implement_inventory.c
#remove the object files so they do not interfere with a real build
	   rm i_client.o i_procedures.o implement_inventory.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:	i_client
i_client:	i_client.o $(APPL)_cstub.o
	   $(CC) $(CFLAGS) -o i_client.exe i_client.o $(APPL)_cstub.o $(LIBS)


#
# SERVER BUILD 
#
server:	i_server
i_server:	$(APPL).h i_server.o i_procedures.o implement_inventory.o \
   $(APPL)_sstub.o
	   $(CC) $(CFLAGS) -I$(CHECK) -o i_server.exe i_server.o i_procedures.o \
		   implement_inventory.o \
		   $(APPL)_sstub.o $(LIBS)
i_server.o:	i_server.c
	   $(CC) $(CFLAGS) -I$(CHECK) -c i_server.c
