aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile
diff options
context:
space:
mode:
authorBrian Cully <bjc@kublai.com>2021-02-27 21:56:42 -0500
committerBrian Cully <bjc@kublai.com>2021-02-27 21:57:40 -0500
commitee9e08f48aed3344b236d51a4e23139352fbaea1 (patch)
tree1f1613c88879bda63f6fc746c043e1aac0dd712d /Makefile
parentc056b242816eaa3c992f6803857274c46f1a831b (diff)
downloadModel01-Firmware-ee9e08f48aed3344b236d51a4e23139352fbaea1.tar.gz
Model01-Firmware-ee9e08f48aed3344b236d51a4e23139352fbaea1.zip
Update to new build system.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile84
1 files changed, 30 insertions, 54 deletions
diff --git a/Makefile b/Makefile
index 7682689..19019b3 100644
--- a/Makefile
+++ b/Makefile
@@ -1,72 +1,48 @@
-# This stub makefile for a Kaleidoscope plugin pulls in
-# all targets from the Kaleidoscope-Plugin library
+# This makefile for a Kaleidoscope sketch pulls in all the targets
+# required to build the example
-UNAME_S := $(shell uname -s)
-ifeq ($(UNAME_S),Darwin)
-SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino
-PACKAGE_DIR ?= $(HOME)/Library/Arduino15
+
+
+ifneq ($(KALEIDOSCOPE_DIR),)
+search_path += $(KALEIDOSCOPE_DIR)
+endif
+
+ifneq ($(ARDUINO_DIRECTORIES_USER),)
+search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope
+endif
+
+ifeq ($(shell uname -s),Darwin)
+search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
else
-SKETCHBOOK_DIR ?= $(HOME)/Arduino
-PACKAGE_DIR ?= $(HOME)/.arduino15
+search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope
endif
+sketch_makefile := etc/makefiles/sketch.mk
-ARDUINO_INSTALLED_ENV=$(shell ls -dt $(PACKAGE_DIR)/packages/keyboardio/hardware/avr 2>/dev/null |head -n 1)
-MANUALLY_INSTALLED_ENV=$(shell ls -dt $(SKETCHBOOK_DIR)/hardware/keyboardio/avr 2>/dev/null |head -n 1)
+$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate))))
+ifneq ($(ks_dir),)
+$(info Using Kaleidoscope from $(ks_dir))
-ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","")
+export KALEIDOSCOPE_DIR := $(ks_dir)
+include $(ks_dir)/$(sketch_makefile)
-ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","")
+else
-$(info ***************************************************************************)
-$(info It appears that you have installed two copies of Kaleidoscope. One copy was)
-$(info installed using Arduino's "Board Manager", while the other was installed by)
-$(info hand, probably using "git".)
-$(info )
-$(info This will likely cause some trouble as you try to build keyboard firmware)
-$(info using Kaleidoscope. You may want to remove either: )
-$(info )
-$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino)
-$(info )
-$(info or)
+$(info I can't find your Kaleidoscope installation.)
$(info )
-$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.)
+$(info I tried looking in:)
$(info )
-$(info ***************************************************************************)
+$(foreach candidate, $(search_path), $(info $(candidate)))
$(info )
-
-endif
-
-BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV)
-KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/
-KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/
-
-
-
-endif
-
-
-BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware
-KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/build-tools/makefiles/
+$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment)
+$(info variable to the location of your Kaleidoscope directory.)
-# 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/build-tools/makefiles/rules.mk)","")
- # Determine the path of this Makefile
- MKFILE_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
- BOARD_HARDWARE_PATH = $(MKFILE_DIR)/../../../..
endif
-ifeq ("$(wildcard $(BOARD_HARDWARE_PATH)/keyboardio/build-tools/makefiles/rules.mk)","")
-$(info ***************************************************************************)
-$(info Unable to autodetect a proper BOARD_HARDWARE_PATH. Please define it manually.)
-$(info ***************************************************************************)
-$(info )
-endif
-include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk
+null-target:
+ $(info You should never see this message)
+ @: