#*********************************************************************
#
# File:          Makefile
#
# Project:       Device Servers in C++
#
# Description:   Makefile for the PowerSupply class implemented in C++
#
# Author(s):     Andy Gotz
#
# Original:	 July 1995
#
#
# $Revision: 1.1 $
# $Date: 95/07/28 13:12:24 $
#
# $Author: goetz $
#
# $Log:	Makefile,v $
# Revision 1.1  95/07/28  13:12:24  13:12:24  goetz (Andy Goetz)
# checking in before I disappear into the African dust ...
# 
# 
# Copyright (c) 1995 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 _UCC
INSTALL_HOME =  $(DS_HOME)/lib/os9
OBJS_HOME =  $(DS_HOME)/lib/os9/objs++
endif
ifdef linux
INSTALL_HOME =  $(DS_HOME)/lib/linux/x86
endif


ifdef __hp9000s700
CC	=	g++
endif
ifdef _UCC
CC	=	xcc
endif
ifdef linux
CC	=	g++
endif

#               ... 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
ifdef _UCC
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 \
		-I$(CDEF)
endif

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

NAME    =       -o

#                       Optimizer or ANSI standart?
ifdef __hpux
#CFLAGS  =       -Aa -g -DEBUG -Dunix -D_HPUX_SOURCE -c $(INCLDIRS)
CFLAGS  =       -g -Dunix -D_HPUX_SOURCE -c $(INCLDIRS)
CXXFLAGS =	$(CFLAGS) $(INCLDIRSXX) -D__STDC__
endif
ifdef _UCC
CFLAGS  =       -mode=c89 -g -qp -to osk -tp 020 -x il -e as=. -a=warn
CXXFLAGS =	$(CFLAGS) $(INCLDIRS)
endif
ifdef linux
CFLAGS  =       -g -Dunix -Dlinux -c $(INCLDIRS)
CXXFLAGS =	$(CFLAGS) $(INCLDIRSXX)
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 =	PowerSupply.H

#               source files
CLASS_SRC =	PowerSupply.cpp 

#
#	source list to make library
#		source files
SRC =		PowerSupply.cpp

#               object files
OBJS =		PowerSupply.o

#--------------------------------------------------------------------
# What has to be made
#
ifdef __hp9000s700
LIBNAME =       libdsclassg++.a
endif
ifdef _UCC
LIBNAME =       libdsclass++.a
endif
ifdef linux
LIBNAME =       libdsclassg++.a
endif

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


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

all:	$(OBJS)

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

ifdef unix
#		Make HPUX library
$(LIBNAME):     $(OBJS)
	mv -f $(INSTALL_HOME)/$(LIBNAME) .
	ar rv $(LIBNAME) $(OBJS) 
endif
ifdef _UCC
	cp $(OBJS) $(OBJS_HOME)
	libgen -c $(OBJS_HOME)/?*.o -o=$(OBJS_HOME)/$(LIBNAME)
	cp $(OBJS_HOME)/$(LIBNAME) $(INSTALL_HOME)
	rm -rf $(OBJS_HOME)/$(LIBNAME)
endif

install_incl:	
ifdef __hp9000s700
	cp -f ../include/PowerSupply.H $(DSHOME)/include++
	chmod 664 $(DSHOME)/include++/PowerSupply.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)
