9e58e72bf6
clang-format had no config here, so adopting the submodule's puts both repos on the same pointer alignment. .editorconfig is what lua-language-server reads on save, which is why the Lua tree had drifted between tabs and two widths.
59 lines
1.9 KiB
Makefile
59 lines
1.9 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
|
|
SHARED_LUA := lib/esp32-lua-api/lua/lib
|
|
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 sdcard 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 shared modules ship from the submodule rather than a copy in this repo, so an app
|
|
# on the card and an app on the host resolve the same ui.lua. Run before flashing or
|
|
# booting the emulator, both of which read sdcard/ directly.
|
|
sdcard:
|
|
@cp $(SHARED_LUA)/*.lua sdcard/.lua/lib/
|
|
@echo "sdcard/.lua/lib <- $(SHARED_LUA)"
|
|
|
|
# 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
|