#*********************************************************************
#
# File:          Makefile
#
# Project:       Device Servers in C++
#
# Description:   Makefile for the OICDevice C++ class for wrapping OIC classes
#
# Author(s):     Andy Gotz
#
# Original:	 November 1996
#
#
# $Revision: 1.1 $
# $Date: 1996/11/12 16:11:41 $
#
# $Author: goetz $
#
# $Log: Makefile,v $
# Revision 1.1  1996/11/12 16:11:41  goetz
# Initial revision
#
# 
# Copyright (c) 1996 by European Synchrotron Radiation Facility,
#                       Grenoble, France
#
#                       All Rights Reserved
#
#**********************************************************************

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


ifdef __hp9000s700
INSTALL_HOME =  $(DS_HOME)/lib/s700
endif

ifdef (linux)
INSTALL_HOME =  $(DS_HOME)/lib/linux
endif

CC = $(CXX)

#               ... and his Flags
#                       Includes
INCLDIRS=       -I../include \
		-I../../cmds_err/include \
		-I../../../../classes/main/include \
		-I../../../xdr/include \
		-I$(DS_HOME)/include \
		-I$(DS_HOME)/include++ \
		-I$(DS_HOME)/include/private

#                       Libraries
#               No link phase - ergo no libraries to include

NAME    =       -o

#                       Optimizer or ANSI standard?
#if defined (__hpux)
#CFLAGS  =       -Aa -g -Dunix -D_HPUX_SOURCE -c $(INCLDIRS)
CFLAGS  =       -ansi -g -Dunix -D_HPUX_SOURCE -c $(INCLDIRS)
CXXFLAGS =	$(CFLAGS) $(INCLDIRSXX) -D__STDC__
#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 library
#
#	File list for RCS control
#               all include files
CLASS_INCL =	OICDevice.H

#               source files
CLASS_SRC =	OICDevice.C 

#
#	source list to make library
#		source files
SRC =		OICDevice.C 

#               object files
OBJS =		OICDevice.o 

#--------------------------------------------------------------------
# What has to be made
#
#if defined (__hp9000s700)
LIBNAME =       libdsclassg++.a
#endif

#               Names of the include files in the 
#		installation directories
#
INCL_INST  = 	../include/OICDevice.H


#---------------------------------------------------------------------
# Build library

all:	$(OBJS) $(LIBNAMES)

$(OBJS):        $(SRC)
		$(CC) $(CXXFLAGS) $(SRC)

#if defined (__hp9000s700)
#		Make HPUX library
$(LIBNAME):     $(OBJS)
		mv $(INSTALL_HOME)/$(LIBNAME) .
		ar rv $(LIBNAME) $(OBJS) 
#endif /* __hp9000s700 */

install_incl:	
#if defined (__hp9000s700)
	cp -f ../include/OICDevice.H $(DSHOME)/include++
	chmod 664 $(DSHOME)/include++/OICDevice.H
#endif 
		

install :       $(LIBNAME) install_incl
#		install library
		mv $(LIBNAME) $(INSTALL_HOME)


clean :
		rm -rf $(OBJS)
		rm -rf *.o


clobber:	clean
		rm -rf	$(LIBNAME)


lock:
		$(RCSLOCK) $(CLASS_SRC)
		cd ../include; $(RCSLOCK) $(CLASS_INCL)
		cd $(LOHOME)

co:
		$(RCSCO) $(CLASS_SRC)
		cd ../include; $(RCSCO) $(CLASS_INCL)
		cd $(LOHOME)

ci:
		$(RCSCI) $(CLASS_SRC)
		cd ../include; $(RCSCI) $(CLASS_INCL)
		cd $(LOHOME)

oicdevice_test.o : oicdevice_test.C 
		$(CC) $(CXXFLAGS) oicdevice_test.C

ifndef linux
oicdevice_test : oicdevice_test.o OICDevice.o
		$(CC) -o oicdevice_test oicdevice_test.o OICDevice.o \
		-static -L$(DSHOME)/lib/s700 -ldsclassg++ -ldsapig++ \
		-ldsclass -ldsapi -ldbapi -ldsxdr -lm
else
oicdevice_test : oicdevice_test.o OICDevice.o
		$(CC) -o oicdevice_test oicdevice_test.o OICDevice.o \
		-L$(DSHOME)/lib/linux -ldsclassg++ -ldsapig++ \
		-ldsclass -ldsapi -ldbapi -ldsxdr -lm
endif

