A handful of changes to make the makefiles lazier to shave off a few % of execution time

pull/999/head
Jesse Vincent 4 years ago
parent 8bb344b29d
commit f0983e8011
No known key found for this signature in database
GPG Key ID: 122F5DF7108E4046

@ -17,7 +17,10 @@ endif
# Build path config # Build path config
TMPDIR ?= /tmp TMPDIR ?= /tmp
export KALEIDOSCOPE_DIR ?= $(abspath $(mkfile_dir)/../..) ifeq ($(KALEIDOSCOPE_DIR),)
export KALEIDOSCOPE_DIR := $(abspath $(mkfile_dir)/../..)
endif
KALEIDOSCOPE_BIN_DIR ?= $(KALEIDOSCOPE_DIR)/bin KALEIDOSCOPE_BIN_DIR ?= $(KALEIDOSCOPE_DIR)/bin
KALEIDOSCOPE_ETC_DIR ?= $(KALEIDOSCOPE_DIR)/etc KALEIDOSCOPE_ETC_DIR ?= $(KALEIDOSCOPE_DIR)/etc
@ -74,7 +77,7 @@ endif
system_arduino_cli=$(shell command -v arduino-cli || true) system_arduino_cli := $(shell command -v arduino-cli || true)
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)

@ -33,8 +33,9 @@ endif
# but since we'd just return an empty value in that case, why bother? # but since we'd just return an empty value in that case, why bother?
GIT_VERSION := $(shell git -C "$(SKETCH_DIR)" describe --abbrev=6 --dirty --alway 2>/dev/null || echo 'unknown') GIT_VERSION := $(shell git -C "$(SKETCH_DIR)" describe --abbrev=6 --dirty --alway 2>/dev/null || echo 'unknown')
SKETCH_IDENTIFIER ?= $(shell echo "${SKETCH_FILE_PATH}" | cksum | cut -d ' ' -f 1)-$(SKETCH_FILE_NAME) ifeq ($(SKETCH_IDENTIFIER),)
SKETCH_IDENTIFIER := $(shell echo "${SKETCH_FILE_PATH}" | cksum | cut -d ' ' -f 1)-$(SKETCH_FILE_NAME)
endif
BUILD_PATH ?= $(KALEIDOSCOPE_BUILD_PATH)/$(SKETCH_IDENTIFIER) BUILD_PATH ?= $(KALEIDOSCOPE_BUILD_PATH)/$(SKETCH_IDENTIFIER)
OUTPUT_PATH ?= $(KALEIDOSCOPE_OUTPUT_PATH)/$(SKETCH_IDENTIFIER) OUTPUT_PATH ?= $(KALEIDOSCOPE_OUTPUT_PATH)/$(SKETCH_IDENTIFIER)
@ -106,7 +107,9 @@ endif
# Flashing related config # Flashing related config
ifneq ($(FQBN),) ifneq ($(FQBN),)
KALEIDOSCOPE_DEVICE_PORT ?= $(shell $(ARDUINO_CLI) board list --format=text | grep $(FQBN) |cut -d' ' -f 1) ifeq ($(KALEIDOSCOPE_DEVICE_PORT),)
KALEIDOSCOPE_DEVICE_PORT = $(shell $(ARDUINO_CLI) board list --format=text | grep $(FQBN) |cut -d' ' -f 1)
endif
endif endif
flashing_instructions := $(call _arduino_prop,build.flashing_instructions) flashing_instructions := $(call _arduino_prop,build.flashing_instructions)
@ -194,16 +197,18 @@ endif
#TODO (arduino team) I'd love to do this with their json output #TODO (arduino team) I'd love to do this with their json output
#but it's short some of the data we kind of need #but it's short some of the data we kind of need
flash: .PHONY: ensure-device-port-defined
ifeq ($(KALEIDOSCOPE_DEVICE_PORT),)
$(info ERROR: Unable to detect keyboard serial port.)
$(info )
$(info Arduino should autodetect it, but you could also set )
$(info KALEIDOSCOPE_DEVICE_PORT to your keyboard's serial port.)
$(info )
$(error )
endif ensure-device-port-defined:
@if [ -z $(KALEIDOSCOPE_DEVICE_PORT) ]; then \
echo "ERROR: Unable to detect keyboard serial port.";\
echo ;\
echo "Arduino should autodetect it, but you could also set";\
echo "KALEIDOSCOPE_DEVICE_PORT to your keyboard's serial port.";\
echo ;\
exit -1;fi
flash: ensure-device-port-defined
$(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