From 57d79ee296ccdc7eac4c8415b2a3e94ab111e808 Mon Sep 17 00:00:00 2001 From: Dejvino Date: Mon, 16 Nov 2026 21:01:15 +0100 Subject: [PATCH] emulator-template: Rebuild when the sketch file changes The $(EMU) target only depended on main.cpp and shim.h, so editing the sketch (.cpp) did not trigger a rebuild - stale binaries silently ran. Add the sketch to the prerequisites; propagate to cyberspace-demo copy. --- cyberspace-demo/Makefile | 4 +++- emulator-template/Makefile | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cyberspace-demo/Makefile b/cyberspace-demo/Makefile index 540acea..626e5b8 100644 --- a/cyberspace-demo/Makefile +++ b/cyberspace-demo/Makefile @@ -41,7 +41,9 @@ all: $(EMU) # Compile + link: main.cpp includes the sketch .cpp, forming one TU. # -DAPP_INO makes the sketch's .ino filename available to #ifdef EMULATOR. -$(EMU): $(EMU_MAIN) $(SHIMS) +# Depend on the sketch too, or sketch edits won't trigger a rebuild. +SKETCH := $(APP_DIR)/$(APP).cpp +$(EMU): $(EMU_MAIN) $(SHIMS) $(SKETCH) $(CXX) $(CXXFLAGS) $(SDLFLAGS) $(INC) $(DEFS) \ $(EMU_MAIN) -o $@ $(LIBS) diff --git a/emulator-template/Makefile b/emulator-template/Makefile index bf20909..ae4cf37 100644 --- a/emulator-template/Makefile +++ b/emulator-template/Makefile @@ -41,7 +41,9 @@ all: $(EMU) # Compile + link: main.cpp includes the sketch .cpp, forming one TU. # -DAPP_INO makes the sketch's .ino filename available to #ifdef EMULATOR. -$(EMU): $(EMU_MAIN) $(SHIMS) +# Depend on the sketch too, or sketch edits won't trigger a rebuild. +SKETCH := $(APP_DIR)/$(APP).cpp +$(EMU): $(EMU_MAIN) $(SHIMS) $(SKETCH) $(CXX) $(CXXFLAGS) $(SDLFLAGS) $(INC) $(DEFS) \ $(EMU_MAIN) -o $@ $(LIBS)