#*********************************************************************
#
# File          :   Makefile
#
# Project       :   ASCII based interface to device server API
#
# Description   :   The Makefile to build two different applications. One to
#                   using the shared version of the library (libascapi.sl) and
#                   the other one using the archive version of the library
#                   (libascapi.a).
#
# Author        :   Faranguiss Poncet
#
# Original      :   November 1996
#
# $Revision: 1.7 $                              $Author: poncet $
# $Date: 97/04/10 15:49:58 $                                    $State: Rel $
#
# $Log:	Makefile,v $
# Revision 1.7  97/04/10  15:49:58  15:49:58  poncet (F.Poncet)
# Unchanged. Archived for compatible revision numbers with libascapi.sl.
# 
# Revision 1.6  97/03/21  14:36:11  14:36:11  poncet (F.Poncet)
# File Unchanged. Archived for compatible revision numbers with ascapi lib.
# 
# Revision 1.5  97/02/18  13:48:01  13:48:01  poncet (F.Poncet)
# File not changed. Archived for compatible revision numbers.
# 
# Revision 1.4  97/01/21  17:24:05  17:24:05  poncet (F.Poncet)
# File rearchived to initialize the first officially released version.
# 
# Revision 1.4  97/01/21  14:14:40  14:14:40  poncet (F.Poncet)
# Converted to a Multi-Plateform GNU Makefile. To be used with "gmake" command.
# 
# Revision 1.3  97/01/08  14:07:49  14:07:49  poncet (F.Poncet)
# File unchanged. Archived for compatible revision numbers.
# 
# Revision 1.2  97/01/07  17:50:29  17:50:29  poncet (F.Poncet)
# File unchanged. Archived for compatible revision numbers.
# 
# Revision 1.1  96/11/26  14:57:27  14:57:27  poncet (F.Poncet)
# Initial revision
#
#
#
# Copyright (c) 1997 by European Synchrotron Radiation Facility,
#                       Grenoble, France
#
#**********************************************************************
#

#---------------------------------------------------------------------
#	This Makefile works with the GNU make (sometimes called gmake)
#	It makes use of the GNU make conditional statements to support
#	multiple platforms. To use this makefile for a particular platform
#	call GNU make with the appropriate symbol for that platform
#	defined e.g. "gmake __hp9000s700=1 unix=1 all". The following symbols
#	are used to identify the following platforms :
#
#	__hp9000s700	=	HPUX 9000 series 700 
#	_solaris	=	Solaris 
#	sun		=	SunOS
#	_UCC		=	OS9 Fastrak Ultra-C Compiler
#	unix		=	various unix flavours (Solaris, HPUX, Lynx, Linux)
#	lynx		=	LynxOS
#	
#--------------------------------------------------------------------
#
#       The variables DSHOME is set inside this Makefile. So it does
#       not use your own environment varaible $DSHOME.
#
#       Only TWO plateforms are supported in this Makefile : Hpux and Solaris
#
#
#--------------------------------------------------------------------
#
DSHOME	= /segfs/dserver


ifdef __hp9000s700
LIB_HOME     =  $(DSHOME)/lib/hpux10.2
endif
ifdef _solaris
LIB_HOME     =  $(DSHOME)/lib/solaris
endif


#---------------------------------------------------------------------
# All include file and standard library pathes
#
#		make sure to get always the new include files 
#		under ../include
#

INCLDIRS =  	-I ../include \
		-I $(DSHOME)/include

#---------------------------------------------------------------------
# All necessary compiler flags for UNIX
#
#                	Libraries


NAME =	-o 


ifdef __hp9000s700
CC      =	/bin/cc
LIBDIRS =	-L ../lib/hpux10.2 -L $(LIB_HOME)
CFLAGS  =	-Aa -g -DEBUG -Dunix -D_HPUX_SOURCE -c $(INCLDIRS)
LFLAGS =	-Wl,+s $(LIBDIRS) -ldsapi -ldbapi -ldsxdr -ldld
LFLAGS_STAT =	$(LIBDIRS) \
		-Wl,-a,archive -lascapi -ldsapi -ldbapi -ldsxdr -ldsxdr_all \
		-Wl,-a,shared -ldld
endif

ifdef _solaris
CC      =	/opt/SUNWspro/bin/cc
LIBDIRS =	-L ../lib/solaris -L $(LIB_HOME)
CFLAGS  =	-Xa -g -Dsolaris -DEBUG -c $(INCLDIRS)
LFLAGS =	$(LIBDIRS) -ldsapi -ldbapi -ldsxdr -ldl
LFLAGS_STAT =	$(LIBDIRS) \
		-Bstatic -lascapi -ldsapi -ldbapi -ldsxdr -ldsxdr_all \
		-Bdynamic -ldl -lnsl -lsocket
endif




#---------------------------------------------------------------------
# RCS options to lock and check out a version.
# Or to check in a new version.
#
#
#    call format :
#
#         gmake __hp9000s700=1 unix=1 VERSION=y.xx LOGMSG=.... RCSCI
#         gmake __hp9000s700=1 unix=1 VERSION=y.xx RCSCO
#         gmake __hp9000s700=1 unix=1 VERSION=y.xx RCSLOCK
#

#               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 to build the shared library
#
#               source files
SRC	 =	test_asc_dyn.c test_asc_stat.c Makefile

OBJS =		test_asc_dyn.o test_asc_stat.o



#---------------------------------------------------------------------
# What has to be made
#
#		Name of the applications to be built
APPLIS	= 	test_asc_dyn test_asc_stat


#---------------------------------------------------------------------
# build the shared library
#

all:		$(APPLIS)


test_asc_stat:	test_asc_stat.o
		$(CC) $(NAME) $@ test_asc_stat.o $(LFLAGS_STAT)

test_asc_stat.o:	test_asc_stat.c
		$(CC) $(CFLAGS) test_asc_stat.c

test_asc_dyn:	test_asc_dyn.o
		$(CC) $(NAME) $@ test_asc_dyn.o $(LFLAGS)

test_asc_dyn.o:	test_asc_dyn.c
		$(CC) $(CFLAGS) test_asc_dyn.c

clean:	
		-rm -f $(OBJS) 


clobber:	clean
		-rm -f $(APPLIS) 


lock:
		$(RCSLOCK) $(SRC)

co:
		$(RCSCO) $(SRC)

ci:
		$(RCSCI) $(SRC)

