From e843e9da835f058e09810cfeba7c60d0b270e7b3 Mon Sep 17 00:00:00 2001
From: David Phillips <david@yeah.nah.nz>
Date: Sat, 27 Feb 2021 20:31:17 +1300
Subject: Move unity-test-runner to submodule

---
 Makefile | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

(limited to 'Makefile')

diff --git a/Makefile b/Makefile
index 05c24bc..6ba3a4f 100644
--- a/Makefile
+++ b/Makefile
@@ -13,7 +13,8 @@ SIM_ELF = build/altimeter_sim.elf
 
 # options for native (i.e. unit test)
 UNITY_SRC ?= unity/src
-CFLAGS += -Wall -Wextra -I$(UNITY_SRC) -g3
+TEST_RUNNER ?= unity-test-runner
+CFLAGS += -Wall -Wextra -I$(UNITY_SRC) -I$(TEST_RUNNER) -g3
 LDFLAGS += -lm
 
 # options for cross-compile
@@ -30,7 +31,7 @@ AVR_COMMON_LDFLAGS += -Wl,-u,vfprintf -lprintf_flt
 AVR_LDFLAGS += $(AVR_COMMON_LDFLAGS) -mmcu=$(MCU)
 SIM_LDFLAGS += $(AVR_COMMON_LDFLAGS) -mmcu=$(SIM_MCU)
 
-$(shell mkdir -p build/{real,sim,native{,/$(UNITY_SRC)}})
+$(shell mkdir -p build/{real,sim,native{,/$(UNITY_SRC),/$(TEST_RUNNER)}})
 
 all: build/altimeter_sim.elf build/altimeter.hex test size
 
@@ -56,7 +57,7 @@ NATIVE_DIR = $(BUILD_DIR)/native
 
 TEST_OBJ = \
 	$(NATIVE_DIR)/$(UNITY_SRC)/unity.o \
-	$(NATIVE_DIR)/test_runner.o \
+	$(NATIVE_DIR)/$(TEST_RUNNER)/test_runner.o \
 	$(NATIVE_DIR)/test_util.o \
 	$(NATIVE_DIR)/test_data_manager.o \
 	$(NATIVE_DIR)/data_manager.o \
@@ -80,11 +81,11 @@ SIM_OBJ = \
 ALL_OBJ = $(TEST_OBJ) $(REAL_OBJ) $(SIM_OBJ)
 ALL_SOURCE = $(ALL_OBJ:.o=.c)
 
-test: build/native/test_runner
+test: build/native/unity-test-runner/test_runner
 	./$^
 
-build/native/test_runner: $(TEST_OBJ)
-	$(CC) $(LDFLAGS) -Wl,-T,linker_list.lds -o $@ $^
+build/native/unity-test-runner/test_runner: $(TEST_OBJ)
+	$(CC) $(LDFLAGS) -Wl,-T,$(TEST_RUNNER)/linker_list.lds -o $@ $^
 
 # ELF for real hardware. No mock/sim hardware included (except barometer,
 # haven't written that code yet)
-- 
cgit v1.1