#
# RcsID = " $Header: Makefile,v 1.5 95/01/04 16:38:54 meyer Exp $ ";
#
#*********************************************************************
#
# File:          Makefile
#
# Project:       Device Servers with sun-rpc
#
# Description:   Makefile Message Server runing under HPUX
#
# Author(s):     Jens Meyer
#
# Original:      January 1991
#
#
# $Revision: 1.5 $
# $Date: 95/01/04 16:38:54 $
#
# $Author: meyer $
#
# $Log:	Makefile,v $
# Revision 1.5  95/01/04  16:38:54  16:38:54  meyer (Jens Meyer)
# Deleted define for OPERATOR.
# 
# Revision 1.4  93/03/07  13:57:42  13:57:42  meyer (Jens Meyer)
# chaged sunos to sun4.
# 
# Revision 1.3  92/11/11  11:59:01  11:59:01  meyer (Jens Meyer)
# Standart Makefile
# 
# Revision 1.1  91/02/28  10:31:33  10:31:33  meyer (Jens Meyer)
# Initial revision
#
#
#
# Copyright (c) 1990 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 OSK
LIB_HOME     =  $(DS_HOME)/lib/os9
INSTALL_HOME =  $(DS_HOME)/system/bin/os9
endif
ifdef __hp9000s300
LIB_HOME     =  $(DS_HOME)/lib/s300
INSTALL_HOME =  $(DS_HOME)/system/bin/s300
endif
ifdef __hp9000s700
LIB_HOME     =  $(DS_HOME)/lib/s700
INSTALL_HOME =  $(DS_HOME)/system/bin/s700
endif
ifdef __hp9000s800
LIB_HOME     =  $(DS_HOME)/lib/s800
INSTALL_HOME =  $(DS_HOME)/system/bin/s800
endif
ifdef _solaris
LIB_HOME     =  $(DS_HOME)/lib/solaris
INSTALL_HOME =  $(DS_HOME)/system/bin/solaris
endif
ifdef linux
LIB_HOME     =  $(DS_HOME)/lib/linux/x86
INSTALL_HOME =  $(DS_HOME)/system/bin/linux/x86
endif


#---------------------------------------------------------------------
# All necessary compiler flags for UNIX and OS9
#
ifdef OSK
#               The C Compiler for OS9

#               ... and his Flags
#                       Includes
INCLDIRS =  	-v=../include \
		-v=$(DSHOME)/include \
		-v=$(DSHOME)/include/private

#                       Libraries
LFLAGS =       	-l=$(LIB_HOME)/os9-dsapilib.l \
		-l=$(LIB_HOME)/os9-dsxdrlib.l \
		-l=$(LIB_HOME)/os9dbapi.l \
		-l=$(CLIB)/rpclib.l \
		-l=$(CLIB)/netdb.l \
		-l=$(CLIB)/socklib.l \
		-l=$(CLIB)/math881.l \
		-l=$(CLIB)/clib020h.l

#               Compiler Flags
CFLAGS =       	-Q -DBUG -K=2F $(INCLDIRS)
NAME =       	-fd=$@
endif

ifdef unix

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 -lnsl -lsocket
else
LFLAGS = 	$(LIBDIRS) -ldsxdr -ldsapi -ldbapi -ldsxdr
endif # _solaris

NAME =       	-o 
endif

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


#---------------------------------------------------------------------
# RCS options
#
#               RCS lock options
RCSLOCK =      	co -l -r$(VERSION)
#               RCS check out options
RCSCO   =      	co -r$(VERSION)
#               RCS check in options
RCSCI   =      	ci -u -f -s"Rel" -r$(VERSION) -m"$(LOCKMSG)"


#---------------------------------------------------------------------
# All Files needed for the Server and the client
#
#               all include files
INCL     =	Message.h

#               source files
SRC	 =	MessageServer.c \
		MessageServerMain.c

#               object files
ifdef OSK
SVC_OBJS =	MessageServer.r \
		MessageServerMain.r
endif

ifdef unix
SVC_OBJS =	MessageServer.o \
		MessageServerMain.o
endif


#---------------------------------------------------------------------
# What has to be made
#
#		Names of executables in the home directory
ifdef OSK
SERVER	 = 	MessageServer.os9
endif
ifdef unix
SERVER	 = 	MessageServer.ux
endif

#		Names of executables in the installation directory
SVC_INST = 	MessageServer


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

ifdef OSK
#               Rule for making OS-9 relocatable files (.r)
.SUFFIXES:      .r .cpp

all:		$(SERVER)

$(SERVER):  	$(SVC_OBJS) 
		$(CC) $(CFLAGS) $(NAME) $(SVC_OBJS) $(LFLAGS) $(LFLAGS)

.c.r:
		$(CC) $(CFLAGS) -r $<
		@echo
endif


ifdef unix
all:		$(SERVER)

$(SERVER):  	$(SVC_OBJS)
		$(CC) $(NAME) $@ $(SVC_OBJS) $(LFLAGS)
endif



install:	$(SERVER)
		cp $(SERVER) $(INSTALL_HOME)/$(SVC_INST)


clean:	
		-rm -f $(SVC_OBJS) 


clobber:	clean
		-rm -f $(SERVER) 


lock:
		$(RCSLOCK) $(SRC)
		cd ../include; $(RCSLOCK) $(INCL); cd ../src

co:
		$(RCSCO) $(SRC)
		cd ../include; $(RCSCO) $(INCL); cd ../src

ci:
		$(RCSCI) $(SRC)
		cd ../include; $(RCSCI) $(INCL); cd ../src
#
#
