# RCSid: $Header: /export/sw/rcs/vcom5.0/sbeux/vcutils/vld/Makefile,v 1.0 92/08/20 11:27:04 root Exp $

#-----------------------------------------------------------------------------
# Makefile - generic VCOM download utility (vcom_vld) makefile
#
# Copyrighted as an unpublished work.
# (c) Copyright 1992 SBE, Inc. and by other vendors under license agreements.
# All Rights Reserved.
#-----------------------------------------------------------------------------
# RCS info:
# RCS revision: $Revision: 1.0 $
# Last changed on $Date: 92/08/20 11:27:04 $
# Changed by $Author: root $
#-----------------------------------------------------------------------------
# $Log:	Makefile,v $
# Revision 1.0  92/08/20  11:27:04  root
# Initial revision
# 
#-----------------------------------------------------------------------------
#

UTILS =vcom_vld

############################################################################
#  Assign LOCALINC to be the path to the directory containing the SBE
#  distributed "sys" header files.
############################################################################
LOCALINC =../../include

INC      =-I$(LOCALINC)
DEST     =/etc
CFLAGS   =-O $(INC) $(DPARMS)
LDFLAGS  =-s

CC= cc

all: $(UTILS) Makefile

#######
# It gets tricky to keep this a generic Makefile.  If this is for SBE_TCPIP
# then a special SBE tcp library (libstcp.a) is used for inet decoding and
# such.  This lib may come from a new release (sysfiles/lib) or already be
# present on the system.  Non SBE_TCP_IP usage does not include the code,
# so its version does not reference the library.
#######

vcom_vld: vcom_vld.o sbeRelease.o
	( \
	TCP="FALSE" ;\
	for PARM in $(DPARMS) ;\
	do \
	    if [ $$PARM = "-DSBE_TCPIP" ] ;\
	    then \
	        TCP="TRUE" ;\
			break ;\
	    fi ;\
	done ;\
	if [ $$TCP = "TRUE" ] ;\
	then \
	    if [ -f ../../sysfiles/lib/libstcp.a ] ;\
	    then \
	        $(CC) $(LDFLAGS) -o vcom_vld sbeRelease.o vcom_vld.o ../../sysfiles/lib/libstcp.a ;\
	    else \
	        $(CC) $(LDFLAGS) -o vcom_vld sbeRelease.o vcom_vld.o -lstcp ;\
	    fi ;\
	else \
	    $(CC) $(LDFLAGS) -o vcom_vld sbeRelease.o vcom_vld.o ;\
	fi \
	)

# -----------------------------------------------------------------------------

vcom_vld.o: vcom_vld.c \
	$(LOCALINC)/sys/vcom/vcom.h \
	$(LOCALINC)/sys/vcom/vctypes.h \
	$(LOCALINC)/sys/vcom/vcutil.h \
	$(FRC)

sbeRelease.o: sbeRelease.c

# -----------------------------------------------------------------------------

install:
	chmod 754 $(UTILS)
	chown root $(UTILS)
	cp $(UTILS) $(DEST)

clean:
	rm -f *.o

clobber:
	rm -f $(UTILS) *.o

# End-of-file
