#
# RcsID = " $Header$"
#
#*********************************************************************
#
# File:          Makefile
#
# Project:       Device Servers with sun-rpc
#
# Description:   Makefile for the data collector server processes
#
# Author(s):     Andy Gotz (goetz@esrf.fr)
#
# Original:      December 2000
#
#
# $Revision$
# $Date$
#
# $Author$
#
# $Log$
#
# Copyright (c) 2000 by European Synchrotron Radiation Facility,
#                       Grenoble, France
#
#                       All Rights Reserved
#
#**********************************************************************

#---------------------------------------------------------------------
# Home Directories
#
#
#       The variables DSHOME is passed to the Makefile
#       as input argument or via the environment.
#
# external variable DSHOME
DS_HOME =       $(DSHOME)

ifdef __hpux10
LIB_HOME     =  $(DS_HOME)/lib/hpux10.2
INSTALL_HOME =  $(DS_HOME)/system/bin/hpux10.2
endif
ifdef _solaris
LIB_HOME     =  $(DS_HOME)/lib/solaris
INSTALL_HOME =  $(DS_HOME)/system/bin/solaris
endif
ifdef linux
ifdef x86
LIB_HOME     =  $(DS_HOME)/lib/linux/x86
INSTALL_HOME =  $(DS_HOME)/system/bin/linux/x86
else
LIB_HOME     =  $(DS_HOME)/lib/linux/68k
INSTALL_HOME =  $(DS_HOME)/system/bin/linux/68k
endif
endif


#---------------------------------------------------------------------
# All necessary compiler flags for UNIX
#
#
#               ... and his Flags
#                       Includes
INCLDIRS =      -I../include \
		-I$(DSHOME)/include \
		-I$(DSHOME)/include/private \
		-I../../api/apilib/include

#                       Libraries
LIBDIRS =       -L$(LIB_HOME)
ifdef _solaris
LFLAGS = 	$(LIBDIRS) -ldsxdr -ldsapi -ldbapi -ldsxdr -ldcmem \
		-lnsl -lsocket
else
LFLAGS = 	$(LIBDIRS) -ldsxdr -ldsapi -ldbapi -ldsxdr \
		-ldcmem
endif # _solaris

NAME =       	-o 

#            	Optimizer and ANSI standart for UNIX
ifdef __hpux
CFLAGS = 	-O -DBUG -Dunix -Aa -D_HPUX_SOURCE $(INCLDIRS) 
endif
ifdef _solaris
CFLAGS = 	-O -DBUG -Dunix $(CCOPTIONS) $(INCLDIRS) 
endif
ifdef linux
ifdef x86
CFLAGS  =      	-Dlinux -Dlinuxx86 -Dunix -DALONE -c $(INCLDIRS) -g 
else
CFLAGS  =      	-Dlinux -Dlinux68k -Dunix -DALONE -c $(INCLDIRS) -g
endif
endif


#---------------------------------------------------------------------
# All Files needed for the Server and the client
#
#               all include files
INCL     =	dc.h \
		dcP.h \
		dc_xdr.h \
		dcrd_xdr.h \
		dcwr_xdr.h

#               source files
SRC	 =	dc_devall.c \
		dc_devinf.c \
		dc_inf.c \
		dc_put.c \
		dc_read.c \
		dcrd_svc.c \
		dcwr_svc.c \
		dcrd_xdr.c \
		dcwr_xdr.c

#               object files
WR_SVR_OBJS =	dc_devall.o \
		dc_devinf.o \
		dc_inf.o \
		dc_put.o \
		dc_serv.o \
		dcwr_svc.o \
		dcwr_xdr.o

RD_SVR_OBJS =	dc_devall.o \
		dc_devinf.o \
		dc_inf.o \
		dc_read.o \
		dcrd_svc.o \
		dcrd_xdr.o


WR_SVR = dcwr_alo

RD_SVR = dcrd_alo

#---------------------------------------------------------------------
# build server and client
#

all:		$(WR_SVR) $(RD_SVR)

$(WR_SVR):  	$(WR_SVR_OBJS)
		$(CC) $(NAME) $@ $(WR_SVR_OBJS) $(LFLAGS)

$(RD_SVR):  	$(RD_SVR_OBJS)
		$(CC) $(NAME) $@ $(RD_SVR_OBJS) $(LFLAGS)

install:	$(WR_SVR) $(RD_SVR)
		cp $(WR_SVR) $(INSTALL_HOME)
		cp $(RD_SVR) $(INSTALL_HOME)

clean:	
		-rm -f $(WR_SVR_OBJS) $(RD_SVR_OBJS)


clobber:	clean
		-rm -f $(WR_SVR) $(RD_SVR)
