##########################################################################
# Copyright 1999 MBARI                                             
##########################################################################
# Summary  : Makefile for CAmera Recorder and Logger module (CARL)
# Filename : Makefile
# Author   :
# Project  : 
# Version  :
# Created  : 01/07/2013
# Modified : 
# Archived :
##########################################################################
# Modification History:
#
##########################################################################

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)

INCLUDES    = 	-I.  \
	        -I.. \
	      	-I../utils \
	      	-I../framework  \
		-I../LayeredControl \
		-I../taskIF \
		-I../Simulator \
		-I../DataLog \
		-I../epiBatt \
		-I../seabird25p \
		-I../system \
		-I/usr/local/include \
	      	-I/usr/include           

LDFLAGS	    = 	-g -lmqueue -lcurl -lsocket
LIBPATH	    = 	/usr/lib:../lib:..

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

OBJS =	HtmlUtil.o \
			KiProLog.o \
			KiPro.o \
			EZ17.o \
			ModtronixLog.o \
			ModtronixOutput.o \
			Modtronix.o \
			EZMod.o \
			CARLServer.o

TARGETS =	htmlutil carlServer carlTest setupCARL kiProTest modtronixTest modtronix ezTalk


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


all:		$(TARGETS)

ezTalk:	ezTalk.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) ezTalk.o $(OBJS) $(LIBS) -L/usr/local/lib -o $@

htmlutil:	_htmlutil.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _htmlutil.o $(OBJS) -L/usr/local/lib $(LIBS) -o $@

kiProTest:	_kiProTest.o $(OBJS) $(LIBS)
	@echo "****\n****\tSeeing curl linking errors? Install onboard/curl first.\n****"
	$(LD) $(LDFLAGS) _kiProTest.o $(OBJS)  -L/usr/local/lib $(LIBS) -o $@

modtronix:	_modtronix.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _modtronix.o $(OBJS)  -L/usr/local/lib $(LIBS) -o $@

modtronixTest:	_modtronixTest.o $(OBJS) $(LIBS)
	$(LD) $(LDFLAGS) _modtronixTest.o $(OBJS)  -L/usr/local/lib $(LIBS) -o $@

carlServer:	_carlServer.o $(OBJS) $(LIBS)
	@echo "****\n****\tSeeing curl linking errors? Install onboard/curl first.\n****"
	$(LD) $(LDFLAGS) _carlServer.o $(OBJS)  -L/usr/local/lib $(LIBS) -o $@

carlTest:	_carlTest.o $(OBJS) $(LIBS)
	@echo "****\n****\tSeeing curl linking errors? Install onboard/curl first.\n****"
	$(LD) $(LDFLAGS) _carlTest.o $(OBJS)  -L/usr/local/lib $(LIBS) -o $@

setupCARL:	_setupCARL.o $(OBJS) $(LIBS)
	@echo "****\n****\tSeeing curl linking errors? Install onboard/curl first.\n****"
	$(LD) $(LDFLAGS) _setupCARL.o $(OBJS)  -L/usr/local/lib $(LIBS) -o $@

install:
		cp -fnv $(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
	    @echo "****\n****\tSeeing curl compilation errors? Install onboard/curl first.\n****"
	    $(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

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









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