Files
slate32/Makefile
T
2026-08-06 15:28:44 -04:00

51 lines
1.5 KiB
Makefile

# Run inside `nix develop`, which provides pio, lua and a compiler.
# LUA is pinned to 5.4 to match the interpreter vendored into the firmware.
LUA ?= lua
CXX ?= c++
CXXFLAGS ?= -std=c++11 -Wall -Wextra
BUILD_DIR := .pio/build/esp32-32e
LUA_TESTS := test/keyboard.lua test/settings_calibration.lua test/statusbar_dirty.lua test/settings_busy.lua test/ble.lua
.PHONY: test test-lua test-cpp test-shared compiledb build upload monitor clean format
# C++ only: Lua is formatted on save by lua-language-server, which reads the
# same .editorconfig, so a second Lua formatter here would only fight it.
format:
@clang-format -i $(shell find src test -name '*.cpp' -o -name '*.h')
@$(MAKE) -C lib/esp32-lua-api format
# The layout engine, the shared modules and the API declarations are tested in
# lib/esp32-lua-api; what is left here is this firmware's own Lua and gfx.
test: test-cpp test-lua test-shared
test-shared:
@$(MAKE) -C lib/esp32-lua-api test
test-lua:
@$(LUA) -e 'assert(_VERSION == "Lua 5.4", "tests need Lua 5.4 to match the firmware, got " .. _VERSION)'
@for t in $(LUA_TESTS); do printf '%-32s ' "$$t"; $(LUA) "$$t" || exit 1; done
test-cpp: $(BUILD_DIR)/round_rect_test
@printf '%-32s ' test/round_rect_test.cpp; $(BUILD_DIR)/round_rect_test
$(BUILD_DIR)/round_rect_test: test/round_rect_test.cpp src/gfx/round_rect.h
@mkdir -p $(@D)
@$(CXX) $(CXXFLAGS) $< -o $@
compiledb:
pio run -t compiledb
build:
pio run
upload:
pio run -t upload
monitor:
pio device monitor
clean:
pio run -t clean
rm -f $(BUILD_DIR)/round_rect_test