##########################################################################
# Copyright 2020 MBARI                                             
##########################################################################
# Summary  : Makefile for Inspired Energy Battery system drivers
# Filename : Makefile
# Author   : Laughlin Barker
# Project  : 
# Version  : Version 1.1
# Created  : 01/01/2020
# Modified : 11/15/2020
# Archived :
##########################################################################

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

AUV_BIN_DIR = ../bin

DEBUG 	    = -g #-DCONSOLE_OUTPUT
EXCEPTION_HANDLING = -WC,-xs

## OPTIMIZE = -4 -Os
OPTIMIZE = 

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

CFLAGS	    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -D _QNX -D UNIX  
CPPFLAGS    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -D _QNX -D UNIX \
	         $(EXCEPTION_HANDLING)

INCLUDES    = 	-I. \
		-I.. \
		-I../inc/dorado-battery_comms_types \
		-I../../utils \
		-I../../framework \
		-I../../taskIF \
		-I/usr/include \
		-I../../DataLog \
		-I../../Simulator \
		-I../../LayeredControl \
		-I../../stlport/

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

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


OBJS	=	InspEnergyBattListener.o \
			InspEnergyBattServer.o \
			InspEnergyBattOutput.o \
			InspEnergyBattStatus.o \
			InspEnergyBattLog.o \
			utils.o \
			../inc/dorado-battery_comms_types/udp_types.o

TARGETS =	battListener \
			battServer

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


all:		$(TARGETS)

battListener:	_InspEnergyListener.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _InspEnergyListener.o $(OBJS) $(LIBS) -o $@

battServer:	_InspEnergyServer.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _InspEnergyServer.o $(OBJS) $(LIBS) -o $@

install:
		cp -f $(TARGETS) $(AUV)/bin/. 

##########################################################################
# 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 $@

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

%.o: %.c 
	    $(CC) $(CFLAGS) $(INCLUDES) $< -o $@	

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

DEST	    = .

MAKEFILE    = Makefile

include       $(OBJS:.o=.d)

depend:	

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

commit:
	cvs commit $(CC_SRCS) $MAKEFILE

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