##########################################################################
# Copyright 1999 MBARI                                             
##########################################################################
# Summary  : Makefile for utils subdirectory
# Filename : Makefile
# Author   : Andrew Pearce
# Project  : 
# Version  : Version 1.0
# Created  : 12/06/99
# Modified : 12/06/99
# Archived :
##########################################################################
# Modification History:
# $Header$
#
##########################################################################

CC	    = cc
CCPP	    = cc
LD	    = cc
AR 	    = wlib
DEPEND_TOOL = makedepend

DEBUG 	    = -g
EXCEPTION_HANDLING = -WC,-xs

## OPTIMIZE = -4 -Os
OPTIMIZE = 

## MAP_OUTPUT = -S -ms -M
MAP_OUTPUT =

AUV_BIN_DIR = ../bin

CFLAGS	    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -D_QNX -DUNIX  
CPPFLAGS    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -D_QNX -DUNIX \
	         $(EXCEPTION_HANDLING)

INCLUDES    = -I.  \
	      -I .. \
	      -I../utils \
	      -I../taskIF \
	      -I../framework \
	      -I/usr/include 


LDFLAGS	    = -g
LIBPATH	    = 

LIBS        =   ../utils/utils.lib \
		../framework/auvFramework.lib \
		../taskIF/taskInterfaces.lib 

OBJS 	    =	AngleAttribute.o \
		AngleData.o \
		Attribute.o \
		AttributeParser.o \
		Attributes.o \
		BooleanAttribute.o \
		CharData.o \
		Chebyshev.o \
		DataField.o \
		DataFieldFactory.o \
		DeviceUtils.o \
		DoubleData.o \
		FixedFieldStringMessage.o \
		FloatAttribute.o \
		FloatData.o \
		IntegerAttribute.o \
		IntegerData.o \
		Item.o \
		ItemList.o \
		Math.o \
		MyAssert.o \
		NavUtils.o \
		RealTimeClock.o \
		ShortData.o \
		smac.o \
		sonardyneCommand.o \
		SoundVelocity.o \
		StringAttribute.o \
		StringData.o \
		StringConverter.o \
		StringMessage.o \
		Syslog.o \
		SyslogUtils.o \
		System.o \
		Time.o \
		FastTime.o \
		TimeTag.o \
		parseComplex.tab.o \
		parseComplex.yy.o \
		ping.o \
		matherr.o \
		matrixMath.o \
		83p2csv.o \
		83p2mat.o

OBJS_TD =	td.o \
		Syslog.o \
		System.o 

TARGETS =	utils.lib semtest SyslogTest td adx testBisect smactest auvping testping 83p2csv \
		testShell testShellStruct testGasdev zonetest

-include ../autonomy.make # this file contains the general
                       # modifications we want to apply to
                       # all the modules 


all:		$(TARGETS)

parseComplex.tab.cc:	parseComplex.y
	yacc -b parseComplex -d -v parseComplex.y
	mv parseComplex.tab.c parseComplex.tab.cc

parseComplex.yy.cc:	parseComplex.l
	lex parseComplex.l
	mv lex.yy.c parseComplex.yy.cc


utils.lib: 	$(OBJS)
		$(AR) utils.lib +- $(OBJS)

stringTest:	stringTest.o $(OBJS)
	$(LD) $(LDFLAGS) stringTest.o $(OBJS) /usr/local/lib/gctpc/geolib.a -o $@

SyslogTest:	SyslogTest.o Syslog.o

testBisect:	testBisect.o $(LIBS)
	$(LD) $(LDFLAGS) testBisect.o $(LIBS) -o $@

testShell:	testShell.o $(LIBS)
	$(LD) $(LDFLAGS) testShell.o $(LIBS) -o $@

testShellStruct:	testShellStruct.o $(LIBS)
	$(LD) $(LDFLAGS) testShellStruct.o $(LIBS) -o $@

testGasdev:	testGasdev.o $(LIBS)
	$(LD) $(LDFLAGS) testGasdev.o $(LIBS) -o $@

td:		td.o $(LIBS)
	$(LD) $(LDFLAGS) $(OBJS_TD) $(LIBS) -o $@

adx:		AuvDataXfer.o $(LIBS)
	$(LD) $(LDFLAGS) AuvDataXfer.o -o $@

smactest:	smactest.o $(LIBS)
	$(LD) $(LDFLAGS) smactest.o $(LIBS) -o $@

testping:	testping.o $(LIBS)
	$(LD) $(LDFLAGS) testping.o $(LIBS) -o $@

zonetest:	zonetest.o $(LIBS)
	$(LD) $(LDFLAGS) zonetest.o $(LIBS) /usr/local/lib/gctpc/geolib.a -o $@

auvping:	auvping.o $(LIBS)
	$(LD) $(LDFLAGS) auvping.o $(LIBS) -o $@

83p2csv:	83p2csv.o $(LIBS)
	$(LD) $(LDFLAGS) 83p2csv.o $(LIBS) -o $@

install:	$(TARGETS)
		cp -fnv adx	$(AUV_BIN_DIR)/. 
		cp -fnv semtest	$(AUV_BIN_DIR)/. 
		cp -fnv td	$(AUV_BIN_DIR)/. 
		cp -fnv copybin	$(AUV_BIN_DIR)/. 
		cp -fnv copyconfig $(AUV_BIN_DIR)/. 
		cp -fnv mkSharedData $(AUV_BIN_DIR)/. 
		cp -fnv mkDriverOutput $(AUV_BIN_DIR)/. 
		cp -fnv testping $(AUV_BIN_DIR)/. 
		cp -fnv zonetest $(AUV_BIN_DIR)/. 
		cp -fnv auvping $(AUV_BIN_DIR)/. 
		cp -fnv 83p2csv $(AUV_BIN_DIR)/. 

##########################################################################
# Do not modify anything below this line unless absolutely necessary

.SUFFIXES:
.SUFFIXES:	.o .c .cc .d .idl

%.d: %.c
	    @echo Generating dependencies for $?
	    @$(DEPEND_TOOL) $(INCLUDES) $? -f $@.tmp
	    @mv $@.tmp $@

%.d: %.cc
	    @echo Generating dependencies for $?
#	    @$(DEPEND_TOOL) $(INCLUDES) $? -f $@.tmp
#	    @mv $@.tmp $@

%.o: %.c 
	    $(CC) $(CFLAGS) $(INCLUDES) $< -o $@	
	    @echo
%.o: %.cc
	    $(CCPP) $(CPPFLAGS) $(INCLUDES) $< -o $@
	    @echo
DEST	    = .

MAKEFILE    = Makefile

include     $(OBJS:.o=.d)

depend:	

clean:
	rm -f core *.o $(OBJS:.o=.d) *.lib *.yy *.tab.* $(TARGETS)

update:
	cvs update $(CC_SRCS) $MAKEFILE

commit:
	cvs commit $(CC_SRCS) $MAKEFILE

##########################################################################









