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