##########################################################################
# Copyright 2003 MBARI                                             
##########################################################################
# Summary  : Makefile for Bluefin Battery driver and server
# Filename : Makefile
# Author   : Henthorn
# Project  : 
# Version  : Version 1.0
# Created  : 1/26/03
# Archived :
##########################################################################
# Modification History:
# $Header: 
#
##########################################################################

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

AUV_BIN_DIR = ../bin

DEBUG 	    = -g
EXCEPTION_HANDLING = -WC,-xs

## OPTIMIZE = -4 -Os
OPTIMIZE = 

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

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

# The other non-battery items in the include list below are because
# BluefinBattLog.h has to include Simulator.h, which in turn includes a bunch
# of other stuff, which therefore must also be included here.
INCLUDES    = 	-I/usr/include \
	        -I.. \
	      	-I../utils \
	      	-I../framework  \
		-I../LayeredControl \
		-I../taskIF \
		-I../Simulator \
		-I../hydroscat \
		-I../isus \
		-I../DataLog \
		-I../Simulator/OctreeC++Qnx

LDFLAGS	    = 	-g
LIBPATH	    = 	/usr/lib:../lib:..

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

OBJS	    =	BluefinBatt.o \
		BluefinBattOutput.o \
		BluefinBattLog.o \
		BluefinBattServer.o \
		../Simulator/OctreeC++Qnx/OctreeSupport.o 

TARGETS =	octrees \
		bluefinBattDriver \
		bluefinBattTest \
		bluefinBattServer 

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


all:		$(TARGETS)

octrees:
	@echo " "
	@echo "Building octree executables"
	@echo " "
	@cd ../Simulator/OctreeC++Qnx; \
	if \
	  make all; \
	then \
	  echo ""; \
	  echo "make succeeded"; \
	  echo ""; \
	else \
	  echo ""; \
	  echo "make failed";\
	  echo ""; \
	  exit; \
	fi; 

bluefinBattDriver:	_bluefinBattDriver.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _bluefinBattDriver.o $(OBJS) $(LIBS) -o $@

bluefinBattServer:	_bluefinBattServer.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _bluefinBattServer.o $(OBJS) $(LIBS) -o $@

bluefinBattTest:	_bluefinBattTest.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _bluefinBattTest.o $(OBJS) $(LIBS) -o $@

install:
		cp -f $(TARGETS) $(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 $@	

%.o: %.cc
	    $(CCPP) $(CPPFLAGS) $(INCLUDES) $< -o $@


#generic command to build object files from source files
%.o :%.cpp
	@echo compiling $<...
	$(CPP) $(CPPFLAGS) $(INCLUDES) -c $< -o $@
	@echo

#generic command to build dependency files from source files
%.d :%.cpp
	@echo generating dependency file for $<
	$(DEPEND_TOOL) $(INCLUDES) $? -f $@.tmp
	@mv $@.tmp $@
	@echo

DEST	    = .

MAKEFILE    = Makefile

include       $(OBJS:.o=.d)

depend:	

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

update:
	cvs update $(CC_SRCS) $MAKEFILE

commit:
	cvs commit $(CC_SRCS) $MAKEFILE

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









# DO NOT DELETE THIS LINE -- make depend depends on it.
