aboutsummaryrefslogtreecommitdiff
path: root/arduino/makefile
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-06-15 15:32:37 +0200
committerLoek Le Blansch <loek@pipeframe.xyz>2024-06-15 15:32:37 +0200
commit310a0a145a807706e68200be6cf28f18f6886fd0 (patch)
treedf16110469b0598c88e2b5e59ec6d838d037a012 /arduino/makefile
parent8de1733ca506dc7b7d4b66dca1b33c22e76dc855 (diff)
add arduino code for simulated sensor
Diffstat (limited to 'arduino/makefile')
-rw-r--r--arduino/makefile31
1 files changed, 31 insertions, 0 deletions
diff --git a/arduino/makefile b/arduino/makefile
new file mode 100644
index 0000000..e712b62
--- /dev/null
+++ b/arduino/makefile
@@ -0,0 +1,31 @@
+BUILD_DIR ?= build
+TARGET = $(BUILD_DIR)/main.elf
+
+CMFLAGS += --fresh
+CMFLAGS += --log-level WARNING
+CMFLAGS += -Wno-deprecated
+
+export SERIAL_PORT ?= /dev/ttyACM0
+.PHONY: FORCE
+
+all: FORCE $(TARGET)
+
+flash: upload-main;
+upload-main: $(TARGET)
+
+$(BUILD_DIR)/build.ninja: CMakeLists.txt
+ @mkdir -p $(BUILD_DIR)
+ @cmake -B $(BUILD_DIR) -G Ninja $(CMFLAGS)
+
+$(TARGET): $(BUILD_DIR)/build.ninja FORCE
+ @ninja -C $(BUILD_DIR)
+
+clean: FORCE
+ $(RM) -r $(BUILD_DIR)
+
+# Forward any unknown targets to Ninja
+ifneq ($(MAKECMDGOALS),)
+%::
+ @ninja -C $(BUILD_DIR) $@
+endif
+