#---------------------------------------------------------------------
# Makefile for RGA/PPAS monitoring application
#
# HPUX : hpuxmake
# SUN  : solmake
#
# Author : Jean-Luc PONS
# Project : RGA/PPAS monitoring (vacuum)

PROGM     =xrga
OBJET     =xrga_main.o bxutil-c.o \
           xrga_creation.o xrga_cb.o \
	   xrga_tools.o xrga_gui.o \
	   xrga_dev.o

DS_HOM	  = /segfs/dserver
#---------------------------------------------------------------------
INCLUDIR  =   .

#---------------------------------------------------------------------
# Make for hpux
#---------------------------------------------------------------------

ifdef __hpux

CC         =    cc

CFLAGS     =	-g +DA1.1 \
		-Aa -D_HPUX_SOURCE \
		-I/usr/include/Motif1.2 \
		-I/usr/include/X11R5    \
		-I/usr/local/XRTPDS-2.0/include \
		-I$(INCLUDIR) \
		-I$(DS_HOM)/include \
		-I$(DS_HOM)/include/private \
		-I/usr/local/include

XLIBS     =    -L.    \
               -L/usr/lib/Motif1.2  \
               -L/usr/local/XRTPDS-2.0/lib \
	       -L$(DS_HOM)/lib/hpux10.2 \
               -L/usr/lib/X11R5 \
               -L/usr/local/lib


LFLAGS    =     -g $(XLIBS) \
		-lxrtm -lpdsutil -lXpm \
		-ldsclass -ldsapi -ldbapi -ldsxdr \
		-lXm -lXt -lX11 \
		-lM \
		-Wl,+s
endif

#---------------------------------------------------------------------
# Make for solaris
#---------------------------------------------------------------------

ifdef _solaris

CC        = /opt/SUNWspro/bin/cc

CFLAGS    =     -Xa -c -D_NO_PROTO -DSUN -DBUG \
                -I/usr/dt/include \
                -I/usr/openwin/include \
                -I/usr/local/include \
                -I/usr/local/XRTPDS-2.0/include \
                -I$(INCLUDIR) \
                -I$(DS_HOM)/include \
                -I$(DS_HOM)/include/private


XLIBS     =    -L.    \
               -L$(DS_HOM)/lib/solaris \
               -L/usr/dt/lib  \
               -L/usr/local/XRTPDS-2.0/lib \
               -L/usr/openwin/lib \
               -L/usr/local/lib


LFLAGS    =     $(XLIBS) -lxrtm -lpdsutil -lXpm \
                -ldsapi -ldsxdr -ldbapi -lsocket -ldsclass \
                -lXm -lXt -lX11 -lposix4 \
                -lm

endif

#--------------------------------------------------------------------
all: $(PROGM)

ifdef _solaris
$(PROGM): $(OBJET)
	@echo Linking...
	@rm -f xrga
	$(CC) $(OBJET) $(LFLAGS) -o $(PROGM)
	@/usr/local/XRTPDS-2.0/bin/xrt_auth xrga
	@echo Linking OK...
endif

ifdef __hpux
$(PROGM): $(OBJET)
	@echo Linking...
	@rm -f xrga
	$(CC) $(OBJET) $(LFLAGS) -o $(PROGM)
	@/usr/local/XRTPDS-2.0/bin/xrt_auth xrga
	@echo Linking OK...
endif

clean:
	@echo Cleaning...
	@rm *.o
