head     1.1;
access   ;
symbols  ;
locks    olivier:1.1; strict;
comment  @# @;


1.1
date     97.11.17.11.57.04;  author cardonne;  state Exp;
branches ;
next     ;


desc
@@



1.1
log
@Initial revision
@
text
@#
# RcsID = " $Header: Makefile,v 1.7 95/02/06 13:10:40 meyer Exp $ ";
#
#*********************************************************************
#
# File:          Makefile 
#
# Project:       Device Servers with SUN-RPC
#
# Description:   Makefile for vacuum gauges device server
#
# Author(s):     J.Meyer
#
# Original:   	 February 1995
#
# $Log:	Makefile,v $
#
# Copyright (c) 1990 by European Synchrotron Radiation Facility,
#                       Grenoble, France
#
#**********************************************************************

#---------------------------------------------------------------------
#
#       The variables DSHOME is passed to the Makefile
#       as input argument or via the environment.
#
#	For UltraC use the settings for the environment variables:
#	MWOS	 =	/usr/local/MWOS
#   	PATH     =	$PATH:$MWOS/UNIX/bin/hp97k
#   	CDEF 	 =	$MWOS/OS9/SRC/DEFS
#   	CDEFESRF =	/usr/local/os9/dd/DEFS
#   	CLIB 	 =	$MWOS/OS9/LIB
#   	CLIBESRF =	/usr/local/os9/dd/LIB
#	DSHOME	 =	/libra/users/d/dserver
#
#
# Home Directories
#

#if defined (_UCC)
LIB_HOME	= $(DSHOME)/lib/os9
OBJS_HOME	= $(DSHOME)/lib/os9/objs
INSTALL_HOME	= $(DSHOME)/bin/os9
#endif
#if defined (lynx)
LIB_HOME     =  $(DSHOME)/lib/lynxos
INSTALL_HOME =  $(DSHOME)/bin/lynxos
#endif
#if defined (__hp9000s300)
LIB_HOME     =  $(DSHOME)/lib/s300
INSTALL_HOME =  $(DSHOME)/bin/s300
#endif
#if defined (__hp9000s700)
LIB_HOME     =  $(DSHOME)/lib/s700
INSTALL_HOME =  $(DSHOME)/bin/s700
#endif
#if defined (__hp9000s800)
LIB_HOME     =  $(DSHOME)/lib/s800
INSTALL_HOME =  $(DSHOME)/bin/s800
#endif
#if defined (sun)
LIB_HOME     =  $(DSHOME)/lib/sun4
INSTALL_HOME =  $(DSHOME)/bin/sun4
#endif
#if defined (solaris2)
LIB_HOME     =  $(DSHOME)/lib/solaris2
INSTALL_HOME =  $(DSHOME)/bin/solaris2
#endif


#---------------------------------------------------------------------
# All include file and standard library pathes
#
#		make sure to get always the new include files 
#		under ../include
#
#if defined (_UCC)
INCLDIRS =  	-I ../include \
		-I $(DSHOME)/include/ALPHA \
		-I $(DSHOME)/include/private/ALPHA \
		-I $(DSHOME)/include \
		-I $(DSHOME)/include/private \
		-I $(CDEFESRF) 
#endif

#if defined (unix)
INCLDIRS =	-I../include \
		-I$(DSHOME)/include \
		-I$(DSHOME)/include/private
#endif

#---------------------------------------------------------------------
# All necessary compiler flags for UNIX and OS9
#

# Debug flags
DEBUG =  -g -D PRINT  -D DEBUG_2

#if defined (_UCC)
#               The C Compiler for OS9
CC =       	/usr/local/MWOS/UNIX/bin/hp97k/xcc

#                	Libraries
LIBDIRS =       -L $(LIB_HOME) -L $(CLIB) -L $(MYOS9_HOME)/lib

LFLAGS =   	$(LIBDIRS) \
		-l dsapi.ALPHA \
		-l dsxdr \
		-l dbapi \
		-l rpclib.l \
		-l netdb_small.l \
		-l unix.l \
		-l socklib.l \
		-l sys_clib020.l 

ICODE_LFLAGS = 	$(LIBDIRS) \
                -Wi,-l=$(LIB_HOME)/libdsapi.ALPHA.il \
                -Wi,-l=$(LIB_HOME)/libdsxdr.il \
                -Wi,-l=$(LIB_HOME)/libdbapi.il \
                -l dsapi.ALPHA \
                -l rpclib.l \
                -l netdb_small.l \
                -l unix.l \
                -l socklib.l \
                -l sys_clib.l 

#               	Compiler Flags
CFLAGS =       	-mode=c89 -i -to osk -tp 020 $(DEBUG) $(INCLDIRS)
NAME =       	-o $@@
#endif

#if defined (unix)
#               The C Compiler for HPUX
CC =       	/bin/cc
#if defined (lynx)
CC      =       gcc
#endif

#                       Libraries
LIBDIRS =       -L $(LIB_HOME)
LFLAGS = 	$(LIBDIRS) -ldsapi -ldbapi -ldsxdr -lm

# when using CodeCenter (unix only)
CODELIBS = -L $(DSHOME)/lib/s700 -ldsapi -ldbapi -ldsxdr -lm

NAME =       	-o 
#endif

#            		Optimizer and ANSI standart for UNIX
#if defined (__hpux)
CFLAGS = 	-g -Aa  -D_HPUX_SOURCE $(INCLDIRS) $(DEBUG)
#endif
#if defined (sun)
CFLAGS = 	-O $(INCLDIRS) $(DEBUG)
#endif
#if defined (lynx)
CFLAGS  =       -Dlynx -Dunix -ansi -X $(INCLDIRS)
#endif

#--------------------------------------------------------------------
#	 Server and test menu generic names
SERVER	 = 	Rga
CLIENT	 = 	Rga_menu
CLIENT2	 = 	rga_menu


#---------------------------------------------------------------------
# RCS options to lock and check out a version.
# Or to check in a new version.
#
#               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)"

#---------------------------------------------------------------------
# Class library
# The object file representing the class has
# to be added to the class library.
#
CLASS_LIB = libdsclass.a
CLASS_OBJS = $(SERVER).o

#
#---------------------------------------------------------------------
# All Files needed for the Server and the client
#
#               all include files
INCL     =	$(SERVER)P.h \
		$(SERVER).h \
		Dev$(SERVER)Cmds.h \
		Dev$(SERVER)Errors.h

#               source files
SRC	 =	startup.c \
		$(SERVER).c \
		$(CLIENT).c \
		$(CLIENT2).c

#               object files
SVC_OBJS =	startup.o \
		$(SERVER).o

SVC_ICODE =	startup.i \
		$(SERVER).i

CLN_OBJS =	$(CLIENT).o
CLN2_OBJS =	$(CLIENT2).o

#---------------------------------------------------------------------
# What has to be made
#

#		Names of executables 
#		and include files in the installation directories
SVC_INST   = 	$(SERVER)
CLN_INST   = 	$(CLIENT)
CLN2_INST   = 	$(CLIENT2)
INCL_INST  =	$(SERVER).h 
INCLP_INST = 	$(SERVER)P.h
INCL2_INST = ../include/Dev$(SERVER)Cmds.h
INCL3_INST = ../include/Dev$(SERVER)Errors.h


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

#if defined (_UCC)
#               Rule for making OS-9 relocatable files
.SUFFIXES: .i .c
.c.i:
	
	
all:		$(SERVER) 

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

$(CLIENT):  	$(CLN_OBJS)
		$(CC) $(CFLAGS) $(NAME) $(CLN_OBJS) $(LFLAGS)

icode:		$(SVC_ICODE)
		echo Linking PG_Arun with icode libraries!
		$(CC) $(CFLAGS) -o $(SERVER) $(SVC_ICODE) $(ICODE_LFLAGS)

$(SVC_ICODE):
		$(CC) $(CFLAGS) -P $? -o $@@
#endif


#if defined (unix)
all:		$(CLIENT) $(CLIENT2)

$(CLIENT):  	$(CLN_OBJS) 
		$(CC) $(CFLAGS) $(NAME) $@@ $(CLN_OBJS) $(LFLAGS)
$(CLIENT2):  	$(CLN2_OBJS) 
		$(CC) $(CFLAGS) $(NAME) $@@ $(CLN2_OBJS) $(LFLAGS)
#endif


# 		Add object file representing the class
#		to the class library.
#
$(CLASS_LIB):	$(CLASS_OBJS) 
#if defined (_UCC)
#		For os9 all object files are kept are
#		kept in a special directory, because
#		the library has to be built by a cat
#		of all object files.
#
		cp $(CLASS_OBJS) $(OBJS_HOME)
		libgen -c $(OBJS_HOME)/?*.o -o=$(OBJS_HOME)/$(CLASS_LIB)
		cp $(OBJS_HOME)/$(CLASS_LIB) $(LIB_HOME)
		rm -rf $(OBJS_HOME)/$(CLASS_LIB)
#endif
#if defined (unix)
		ar rv $(LIB_HOME)/$(CLASS_LIB) $(CLASS_OBJS)
#endif


#
# 		install executables		
#
#if defined (_UCC)
install:	$(SERVER) 
		cp $(SERVER) $(INSTALL_HOME)/$(SVC_INST)
#
#		install include files
#
		rm -f $(DSHOME)/include/$(INCL_INST)
		cp ../include/$(INCL_INST) $(DSHOME)/include
		chmod 664 $(DSHOME)/include/$(INCL_INST)
		rm -f $(DSHOME)/include/private/$(INCLP_INST)
		cp ../include/$(INCLP_INST) $(DSHOME)/include/private
		chmod 664 $(DSHOME)/include/private/$(INCLP_INST)
#endif
#if defined (unix)
install:	$(CLIENT) $(CLIENT2)
		cp $(CLIENT) $(INSTALL_HOME)/$(CLN_INST)
		cp $(CLIENT2) $(INSTALL_HOME)/$(CLN2_INST)
#endif


clean:	
		-rm -f $(SVC_OBJS) 
		-rm -f $(CLN_OBJS) $(CLN2_OBJS)
		-rm -f $(SVC_ICODE)
		-rm -f *.ic *stb *dbg
		-rm -f *~


clobber:	clean
		-rm -f $(SERVER) 
		-rm -f $(CLIENT) $(CLIENT2)



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
#
#
# when using CodeCenter
code-c:
	#load $(SRC) $(CFLAGS) $(INCLDIRS) $(CODELIBS)
@
