# RCSid: $Header: /rcs/vcom/sbeux/vcutils/vld/Makefile,v 1.3 92/01/31 11:16:25 rld Rel $

#-----------------------------------------------------------------------------
# Makefile - generic VCOM download utility (vcom_vld) makefile
#
# Copyrighted as an unpublished work.
# (c) Copyright 1991 SBE, Inc. and by other vendors under license agreements.
# All rights reserved.
#-----------------------------------------------------------------------------
# RCS info:
# RCS revision: $Revision: 1.3 $
# Last changed on $Date: 92/01/31 11:16:25 $
# Changed by $Author: rld $
#-----------------------------------------------------------------------------
# $Log:	Makefile,v $
# Revision 1.3  92/01/31  11:16:25  rld
# See 1.2
# 
# Revision 1.2  92/01/31  10:57:55  rld
# TCPIP interrogation of make/shell variables wasn't working. Now is.
# 
# Revision 1.1  92/01/28  16:06:58  rld
# Add flag for compilation w/o libstcp.a.
# 
# Revision 1.0  91/12/13  13:52:57  rld
# Initial revision
# 
# Revision 1.0  91/12/11  14:22:49  rld
# 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
