idfhack/Makefile
2025-07-06 13:14:48 +02:00

60 lines
1.4 KiB
Makefile

# === Configuration ===
PORT ?= /dev/ttyUSB0
BAUD ?= 460800
TARGET ?= esp32
PROJECT := $(shell basename $(CURDIR))
BUILD_DIR := build
RELEASE_DIR := release
# === Tool Selection ===
ifeq ($(PODMAN),1)
IDF := podman run --rm -v $(PWD):/project:Z -w /project docker.io/espressif/idf:latest idf.py
ESPTOOL := podman run --rm -v $(PWD):/project:Z -w /project docker.io/espressif/idf:latest esptool.py
else
IDF := idf.py
ESPTOOL := esptool.py
endif
ifeq ($(origin IDF_PATH), undefined)
ifeq ($(origin PODMAN), undefined)
$(shell printf "\033[1;31mIDF_PATH is not set. Did you forget to source the ESP-IDF environment?\033[0m\n" 1>&2)
$(shell printf '\033[1;31mSource the ESP-IDF environment by: "$$ source ~/esp/esp-idf/export.sh"\033[0m\n' 1>&2)
endif
endif
help:
@echo -e "Makefile for IDFHack\n"
@echo -e "Use 'make <target> PODMAN=1' to run in podman.\n"
@echo "Available targets:"
@echo " build - Build the binary"
@echo " menuconfig - Start the idf configuration tui"
@echo " release - Assemble release artifacts"
@echo " clean - Clean the tree"
@echo " nuke - Really clean the tree"
@echo " help - Show this help message"
@echo -e ""
menuconfig:
$(IDF) menuconfig
build:
$(IDF) build
flash:
$(IDF) flash
qemu:
$(IDF) qemu
clean:
$(IDF) clean
rm -rf release
issues:
bash ./scripts/find_issues.sh ./main
nuke: clean
rm -rf build
rm -rf .cache
.PHONY: build clean nuke help