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
pull/1144/head
Jesse Vincent 3 years ago
parent 0a3bff2df4
commit eeb6d00637
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -55,26 +55,7 @@ endif
# Otherwise, use the arduino-cli bundle # Otherwise, use the arduino-cli bundle
export ARDUINO_DIRECTORIES_USER ?= $(ARDUINO_CONTENT)/user 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_env = ARDUINO_DIRECTORIES_USER=$(ARDUINO_DIRECTORIES_USER) \
ARDUINO_DIRECTORIES_DATA=$(ARDUINO_DIRECTORIES_DATA) ARDUINO_DIRECTORIES_DATA=$(ARDUINO_DIRECTORIES_DATA)
@ -176,3 +157,20 @@ install-arduino-core-deps:
$(QUIET) $(ARDUINO_CLI) core install "keyboardio:gd32-tools-only" $(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 )

@ -123,7 +123,7 @@ DEFAULT_GOAL: compile
.PHONY: compile configure-arduino-cli install-arduino-core-kaleidoscope install-arduino-core-avr .PHONY: compile configure-arduino-cli install-arduino-core-kaleidoscope install-arduino-core-avr
.PHONY: disassemble decompile size-map flash clean all test .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. @: ## 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}" _arduino_local_libraries_prop = --libraries "${KALEIDOSCOPE_LOCAL_LIB_DIR}"
endif endif
compile: compile: kaleidoscope-hardware-configured
$(QUIET) install -d "${OUTPUT_PATH}" $(QUIET) install -d "${OUTPUT_PATH}"
@ -205,7 +205,7 @@ endif
.PHONY: ensure-device-port-defined .PHONY: ensure-device-port-defined
ensure-device-port-defined: ensure-device-port-defined: kaleidoscope-hardware-configured
@if [ -z $(KALEIDOSCOPE_DEVICE_PORT) ]; then \ @if [ -z $(KALEIDOSCOPE_DEVICE_PORT) ]; then \
echo "ERROR: Unable to detect keyboard serial port.";\ echo "ERROR: Unable to detect keyboard serial port.";\
echo ;\ echo ;\
@ -223,7 +223,7 @@ port_arg = --port $(KALEIDOSCOPE_DEVICE_PORT)
endif endif
flash: flash: compile
$(info $(unescaped_flashing_instructions)) $(info $(unescaped_flashing_instructions))
$(info ) $(info )
$(info When you're ready to proceed, press 'Enter'.) $(info When you're ready to proceed, press 'Enter'.)

Loading…
Cancel
Save