##########################################################################
# Copyright 2020 MBARI                                             
##########################################################################
# Summary  : Makefile for Inspired Energy Battery Balls (linux devel)
# Filename : Makefile
# Author   : Laughlin Barker
# Project  : 
# Version  : Version 1.0
# Created  : 12/06/99
# Modified : 12/06/99
# Archived :
##########################################################################

CC	    = gcc
CCPP	    = gcc
LD	    = g++
AR 	    = ar
DEPEND_TOOL = gcc -M

AUV_BIN_DIR = ../bin

DEBUG 	    = -g
EXCEPTION_HANDLING =

## OPTIMIZE = -4 -Os
OPTIMIZE = -O0

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

CFLAGS	    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -DUNIX  -Wall -Wextra -pedantic -Werror -Wno-write-strings
CPPFLAGS    = -c $(DEBUG) $(MAP_OUTPUT) $(OPTIMIZE) -DUNIX \
	         $(EXCEPTION_HANDLING) -Wall -Wextra -pedantic -Werror -Wno-write-strings

INCLUDES    = 	-I.  \
		-I.. \
		-I../inc/battery_comms_types \
		-I../../utils \
		-I../../framework  \
		-I../../taskIF \
		-I../../DataLog \
		-I../../Simulator \
		-I../../LayeredControl \
		-I../../Reson7K

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

LIBS        =   

OBJS	=	InspEnergyBattListener.o \
			../inc/battery_comms_types/udp_types.o \
			InspEnergyBattServer.o \
			utils.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_DIR)/. 

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

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

%.d: %.c
	    @echo Generating dependencies for $?
	    @if ! $(DEPEND_TOOL) $(INCLUDES) $? > $@; then rm $@; fi

%.d: %.cc
	    @echo Generating dependencies for $?
	    @if ! $(DEPEND_TOOL) $(INCLUDES) $? > $@; then rm $@; fi

%.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)

update:
	cvs update $(CC_SRCS) $MAKEFILE

commit:
	cvs commit $(CC_SRCS) $MAKEFILE

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