From eeb6d00637f49c60615bfd2d2e2373995f92bfd9 Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 26 Mar 2022 18:32:30 -0700 Subject: [PATCH] Change how and when we check for a working kaleidoscope hardware config * only check on specific makefile targets * use make's dependencies to propagate the check through the places we'd normally want it for sketch makefiles --- etc/makefiles/arduino-cli.mk | 36 +++++++++++++++++------------------- etc/makefiles/sketch.mk | 8 ++++---- 2 files changed, 21 insertions(+), 23 deletions(-) diff --git a/etc/makefiles/arduino-cli.mk b/etc/makefiles/arduino-cli.mk index b6541a04..68ea4ecc 100644 --- a/etc/makefiles/arduino-cli.mk +++ b/etc/makefiles/arduino-cli.mk @@ -55,26 +55,7 @@ endif # Otherwise, use the arduino-cli bundle export ARDUINO_DIRECTORIES_USER ?= $(ARDUINO_CONTENT)/user -# If we're not calling setup, we should freak out if the hardware -# definitions don't exist - -ifneq ($(MAKECMDGOALS),setup) - -ifeq ($(wildcard $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/boards.txt),) - -$(info Kaleidoscope hardware definitions not found in) -$(info $(ARDUINO_DIRECTORIES_USER)) -$(info ) -$(info You may be able to resolve this issue by running the following command) -$(info to initialize Kaleidoscope ) -$(info ) -$(info $(MAKE) -C $(KALEIDOSCOPE_DIR) setup ) -$(info ) -$(error ) - -endif -endif arduino_env = ARDUINO_DIRECTORIES_USER=$(ARDUINO_DIRECTORIES_USER) \ ARDUINO_DIRECTORIES_DATA=$(ARDUINO_DIRECTORIES_DATA) @@ -176,3 +157,20 @@ install-arduino-core-deps: $(QUIET) $(ARDUINO_CLI) core install "keyboardio:gd32-tools-only" +# If we're not calling setup, we should freak out if the hardware +# definitions don't exist + +.PHONY: kaleidoscope-hardware-configured + +kaleidoscope-hardware-configured: $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/platform.txt + +$(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/platform.txt: + $(info Kaleidoscope hardware definitions not found in) + $(info $(ARDUINO_DIRECTORIES_USER)) + $(info ) + $(info You may be able to resolve this issue by running the following command) + $(info to initialize Kaleidoscope ) + $(info ) + $(info $(MAKE) -C $(KALEIDOSCOPE_DIR) setup ) + $(info ) + $(error ) diff --git a/etc/makefiles/sketch.mk b/etc/makefiles/sketch.mk index a5c5ceb5..d54a7ef3 100644 --- a/etc/makefiles/sketch.mk +++ b/etc/makefiles/sketch.mk @@ -123,7 +123,7 @@ DEFAULT_GOAL: compile .PHONY: compile configure-arduino-cli install-arduino-core-kaleidoscope install-arduino-core-avr .PHONY: disassemble decompile size-map flash clean all test -all: compile +all: compile @: ## Do not remove this line, otherwise `make all` will trigger the `%` rule too. @@ -175,7 +175,7 @@ ifneq ($(KALEIDOSCOPE_LOCAL_LIB_DIR),) _arduino_local_libraries_prop = --libraries "${KALEIDOSCOPE_LOCAL_LIB_DIR}" endif -compile: +compile: kaleidoscope-hardware-configured $(QUIET) install -d "${OUTPUT_PATH}" @@ -205,7 +205,7 @@ endif .PHONY: ensure-device-port-defined -ensure-device-port-defined: +ensure-device-port-defined: kaleidoscope-hardware-configured @if [ -z $(KALEIDOSCOPE_DEVICE_PORT) ]; then \ echo "ERROR: Unable to detect keyboard serial port.";\ echo ;\ @@ -223,7 +223,7 @@ port_arg = --port $(KALEIDOSCOPE_DEVICE_PORT) endif -flash: +flash: compile $(info $(unescaped_flashing_instructions)) $(info ) $(info When you're ready to proceed, press 'Enter'.)