##############################################################################  
# Copyright 2017 MBARI.                                                      #
# MBARI Proprietary Information. All rights reserved.                        #
##############################################################################

# files and directories
LCM_TYPES	= lcm_types
INCLUDES	= -I.
			  
# tools
CC = gcc
CPP = g++

# compile and link flags
CFLAGS = -ansi -O2 -Wall -Wno-comment $(INCLUDES)
CPPFLAGS = -std=c++11 -O2 `pkg-config --cflags eigen3 opencv lcm`
CPPFLAGS += -Wall -Wno-comment $(INCLUDES)

LDFLAGS = `pkg-config --libs opencv lcm` -L/usr/local/share/OpenCV/3rdparty/lib/ 

# rules
all: mbot/double_array_t.hpp blobDetector mbot_types.jar

blobDetector: blobDetector.o lcmUtils.o
	$(CPP) -o $@ $^ $(LDFLAGS)

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

%.o: %.cpp
	$(CPP) $(CPPFLAGS) -o $@ -c $< 

mbot/%.hpp:
	lcm-gen -x $(LCM_TYPES)/*.lcm

mbot_types.jar:
	./buildjar.sh

clean:
	rm -f *.o 
	rm -rf mbot
	rm -f blobDetector
	rm -f mbot_types.jar
