summaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 10 insertions, 0 deletions
diff --git a/Makefile b/Makefile
index 14a7f3c..9ae32d0 100644
--- a/Makefile
+++ b/Makefile
@@ -52,4 +52,14 @@ endif
BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware
KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/build-tools/makefiles/
+# If Kaleidoscope's Arduino libraries cannot be found, e.g. because
+# they reside outside of SKETCHBOOK_DIR, we fall back to assuming that
+# the hardware directory can be determined in relation to the position of
+# this Makefile.
+ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/avr/libraries/Kaleidoscope)","")
+ # Determine the path of this Makefile
+ MKFILE_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
+ BOARD_HARDWARE_PATH = $(MKFILE_DIR)/../../../..
+endif
+
include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk