##############################################################################
# Copyright 2026 Monterey Bay Aquarium Research Institute                    #
# Monterey Bay Aquarium Research Institute Proprietary Information.          #
# All rights reserved.                                                       #
##############################################################################
# files and directories
VPATH 		=

LCM_TYPES	= ../lcm-types

INCLUDES 	= -I.

# tools
CXX = g++

# set compile and link flags
CPPFLAGS = -std=c++11 -O2 `pkg-config --cflags lcm` -Wall $(INCLUDES)
LDFLAGS = `pkg-config --libs lcm` -pthread

# rules
ALL_APPS = 	lars_lcm_pub lars_udp_sim

all: lars/*.hpp $(ALL_APPS)

# check for changes to header files
*.o: lars_data.hpp lars_utils.hpp

lars_lcm_pub: lars_lcm_pub.o
	$(CXX) -o $@ $^ $(LDFLAGS)

lars_udp_sim: lars_udp_sim.o
	$(CXX) -o $@ $^ $(LDFLAGS)

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

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

.PHONY: clean
clean:
	rm -f *.o
	rm -rf lars
	rm -f $(ALL_APPS)
