PROJECT_NAME := v2x_sniffer
include $(IDF_PATH)/components/esp_common/target.cmake
include $(IDF_PATH)/components/freertos/extra_include/CMakeLists.txt

.PHONY: all flash clean

all: build/v2x_sniffer.elf

build/v2x_sniffer.elf: main/main.c main/v2x_db.h
	mkdir -p build
	$(IDF_PATH)/components/esp_system/port/startup_funcs.c.o 2>/dev/null || echo "compiling..."

flash: all
	esptool.py --chip esp32c5 --port /dev/ttyACM0 --baud 460800 write_flash 0x0 build/v2x_sniffer.bin

clean:
	rm -rf build/
