Files
lilygo-t-deck/emulator/Makefile
T
2026-11-11 22:03:40 +01:00

54 lines
1.6 KiB
Makefile

# SDL2 emulator for T-Deck example sketches (run the app on your PC)
#
# make build the MissileCommand emulator (default)
# make APP=CrtTerminal build the CRT terminal emulator
# make run [APP=...] build + launch the window
# make smoke [APP=...] headless test: N frames, dump the last frame
# make clean [APP=...] remove the binary + smoke frame
#
# The sketch is included by src/main.cpp as a single translation unit:
# -DAPP_INO='"<App>.ino"'. Apps with a sound_engine.cpp get it linked
# automatically (wildcard).
APP ?= MissileCommand
APP_DIR := ../examples/$(APP)
ifeq ($(APP),MissileCommand)
APP_TITLE := Missile Command
DEFS += -DEMU_APP_MISSILECOMMAND
endif
ifeq ($(APP),CrtTerminal)
APP_TITLE := CRT Terminal
endif
APP_TITLE ?= $(APP)
CXX ?= g++
CXXFLAGS ?= -std=gnu++17 -O2 -Wall -Wextra
SDLFLAGS := -I/usr/include/SDL2
INC := -Isrc/shim -I$(APP_DIR)
LIBS := -lSDL2 -lSDL2_ttf
DEFS += -DAPP_INO='"$(APP).ino"' -DAPP_NAME='"$(APP_TITLE)"'
SHIMS := $(wildcard src/shim/*.h) $(wildcard src/shim/driver/*.h)
SOUND_SRC := $(wildcard $(APP_DIR)/sound_engine.cpp)
EMU := $(APP)-emu
.PHONY: all run smoke clean
all: $(EMU)
$(EMU): src/main.cpp $(SOUND_SRC) $(APP_DIR)/$(APP).ino $(SHIMS)
$(CXX) $(CXXFLAGS) $(SDLFLAGS) $(INC) $(DEFS) \
src/main.cpp $(SOUND_SRC) -o $@ $(LIBS)
run: $(EMU)
./$(EMU)
# Headless smoke test: dummy video/audio, run N frames, save the last frame.
# Feed keys via --type "text" (queued a few chars per frame).
smoke: $(EMU)
./$(EMU) --frames 240 --dump smoke_frame.bmp
clean:
rm -f $(EMU) smoke_frame.bmp