From 80c00d5e248b5595918c26928f103875dba79f6a Mon Sep 17 00:00:00 2001 From: Jesse Vincent Date: Sat, 21 Nov 2020 19:14:46 -0800 Subject: [PATCH] Update example and testing sketches to use new makefiles --- etc/Makefile.sketch | 48 +++++++++++ examples/Devices/EZ/ErgoDox/Makefile | 65 +++++++------- examples/Devices/KBDFans/KBD4x/Makefile | 65 +++++++------- examples/Devices/Keyboardio/Atreus/Makefile | 66 +++++++------- examples/Devices/Keyboardio/Imago/Makefile | 65 +++++++------- examples/Devices/Keyboardio/Model01/Makefile | 77 ++++++----------- examples/Devices/OLKB/Planck/Makefile | 65 +++++++------- .../Devices/SOFTHRUF/Splitography/Makefile | 62 +++++++------- examples/Devices/Technomancy/Atreus/Makefile | 65 +++++++------- examples/Devices/gHeavy/ButterStick/Makefile | 65 +++++++------- examples/Devices/gHeavy/FaunchPad/Makefile | 65 +++++++------- examples/Internal/Sketch_Exploration/Makefile | 65 +++++++------- testing/makefiles/delegate.mk | 85 +++++++------------ 13 files changed, 395 insertions(+), 463 deletions(-) create mode 100644 etc/Makefile.sketch diff --git a/etc/Makefile.sketch b/etc/Makefile.sketch new file mode 100644 index 00000000..19019b31 --- /dev/null +++ b/etc/Makefile.sketch @@ -0,0 +1,48 @@ +# This makefile for a Kaleidoscope sketch pulls in all the targets +# required to build the example + + + + +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 +search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope +endif + +sketch_makefile := etc/makefiles/sketch.mk + +$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate)))) + +ifneq ($(ks_dir),) + +$(info Using Kaleidoscope from $(ks_dir)) + +export KALEIDOSCOPE_DIR := $(ks_dir) +include $(ks_dir)/$(sketch_makefile) + +else + +$(info I can't find your Kaleidoscope installation.) +$(info ) +$(info I tried looking in:) +$(info ) +$(foreach candidate, $(search_path), $(info $(candidate))) +$(info ) +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) + +endif + + +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/EZ/ErgoDox/Makefile b/examples/Devices/EZ/ErgoDox/Makefile index 996bde98..19019b31 100644 --- a/examples/Devices/EZ/ErgoDox/Makefile +++ b/examples/Devices/EZ/ErgoDox/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/KBDFans/KBD4x/Makefile b/examples/Devices/KBDFans/KBD4x/Makefile index c408b29b..19019b31 100644 --- a/examples/Devices/KBDFans/KBD4x/Makefile +++ b/examples/Devices/KBDFans/KBD4x/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/Keyboardio/Atreus/Makefile b/examples/Devices/Keyboardio/Atreus/Makefile index 79f017a0..19019b31 100644 --- a/examples/Devices/Keyboardio/Atreus/Makefile +++ b/examples/Devices/Keyboardio/Atreus/Makefile @@ -1,56 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 -else -SKETCHBOOK_DIR ?= $(HOME)/Arduino -PACKAGE_DIR ?= $(HOME)/.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 +search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope +endif -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) +sketch_makefile := etc/makefiles/sketch.mk +$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate)))) +ifneq ($(ks_dir),) -ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") +$(info Using Kaleidoscope from $(ks_dir)) -ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") +export KALEIDOSCOPE_DIR := $(ks_dir) +include $(ks_dir)/$(sketch_makefile) -$(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) +else + +$(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/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/Keyboardio/Imago/Makefile b/examples/Devices/Keyboardio/Imago/Makefile index 996bde98..19019b31 100644 --- a/examples/Devices/Keyboardio/Imago/Makefile +++ b/examples/Devices/Keyboardio/Imago/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/Keyboardio/Model01/Makefile b/examples/Devices/Keyboardio/Model01/Makefile index dc5e9463..19019b31 100644 --- a/examples/Devices/Keyboardio/Model01/Makefile +++ b/examples/Devices/Keyboardio/Model01/Makefile @@ -1,71 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 -else -SKETCHBOOK_DIR ?= $(HOME)/Arduino -PACKAGE_DIR ?= $(HOME)/.arduino15 -endif - - -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) -ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") +ifneq ($(KALEIDOSCOPE_DIR),) +search_path += $(KALEIDOSCOPE_DIR) +endif -ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") +ifneq ($(ARDUINO_DIRECTORIES_USER),) +search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope +endif -$(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 ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - +ifeq ($(shell uname -s),Darwin) +search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope +else +search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope endif -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ +sketch_makefile := etc/makefiles/sketch.mk -endif +$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate)))) -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ +ifneq ($(ks_dir),) -ifneq ("$(wildcard $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk)","") +$(info Using Kaleidoscope from $(ks_dir)) -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +export KALEIDOSCOPE_DIR := $(ks_dir) +include $(ks_dir)/$(sketch_makefile) else -$(info ****************************************************************************) -$(info I can't find an installed copy of Kaleidoscope's source code.) +$(info I can't find your Kaleidoscope installation.) $(info ) -$(info This usually means you're attempting to build a device's firmware from a git) -$(info checkout without having previously told Arduino where to find Kaleidoscope.) +$(info I tried looking in:) $(info ) -$(info It is probably the case that you want to move or symlink your git checkout ) -$(info of the Kaleidoscope bundle to the directory: ) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio ) -$(info ****************************************************************************) - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif + + +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/OLKB/Planck/Makefile b/examples/Devices/OLKB/Planck/Makefile index 996bde98..19019b31 100644 --- a/examples/Devices/OLKB/Planck/Makefile +++ b/examples/Devices/OLKB/Planck/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/SOFTHRUF/Splitography/Makefile b/examples/Devices/SOFTHRUF/Splitography/Makefile index 5d721383..19019b31 100644 --- a/examples/Devices/SOFTHRUF/Splitography/Makefile +++ b/examples/Devices/SOFTHRUF/Splitography/Makefile @@ -1,52 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(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 I tried looking in:) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info or) -$(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/Technomancy/Atreus/Makefile b/examples/Devices/Technomancy/Atreus/Makefile index 996bde98..19019b31 100644 --- a/examples/Devices/Technomancy/Atreus/Makefile +++ b/examples/Devices/Technomancy/Atreus/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/gHeavy/ButterStick/Makefile b/examples/Devices/gHeavy/ButterStick/Makefile index 996bde98..19019b31 100644 --- a/examples/Devices/gHeavy/ButterStick/Makefile +++ b/examples/Devices/gHeavy/ButterStick/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Devices/gHeavy/FaunchPad/Makefile b/examples/Devices/gHeavy/FaunchPad/Makefile index 996bde98..19019b31 100644 --- a/examples/Devices/gHeavy/FaunchPad/Makefile +++ b/examples/Devices/gHeavy/FaunchPad/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/examples/Internal/Sketch_Exploration/Makefile b/examples/Internal/Sketch_Exploration/Makefile index 996bde98..19019b31 100644 --- a/examples/Internal/Sketch_Exploration/Makefile +++ b/examples/Internal/Sketch_Exploration/Makefile @@ -1,55 +1,48 @@ -# This stub makefile for a Kaleidoscope example pulls in all the targets +# 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 I can't find your Kaleidoscope installation.) $(info ) -$(info $(PACKAGE_DIR)/packages/keyboardio/ which was installed using Arduino) +$(info I tried looking in:) $(info ) -$(info or) +$(foreach candidate, $(search_path), $(info $(candidate))) $(info ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - -endif - -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ - - +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) endif -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/avr/build-tools/makefiles/ - -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: diff --git a/testing/makefiles/delegate.mk b/testing/makefiles/delegate.mk index c170e383..19019b31 100644 --- a/testing/makefiles/delegate.mk +++ b/testing/makefiles/delegate.mk @@ -1,73 +1,48 @@ -# This stub makefile for a Kaleidoscope plugin pulls in -# all targets from the Kaleidoscope-Plugin library - -UNAME_S := $(shell uname -s) - -ifeq ($(UNAME_S),Darwin) -SKETCHBOOK_DIR ?= $(HOME)/Documents/Arduino -PACKAGE_DIR ?= $(HOME)/Library/Arduino15 -else -SKETCHBOOK_DIR ?= $(HOME)/Arduino -PACKAGE_DIR ?= $(HOME)/.arduino15 -endif - - -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) +# This makefile for a Kaleidoscope sketch pulls in all the targets +# required to build the example -ifneq ("$(wildcard $(ARDUINO_INSTALLED_ENV)/boards.txt)","") -ifneq ("$(wildcard $(MANUALLY_INSTALLED_ENV)/boards.txt)","") +ifneq ($(KALEIDOSCOPE_DIR),) +search_path += $(KALEIDOSCOPE_DIR) +endif -$(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 ) -$(info $(SKETCHBOOK_DIR)/hardware/keyboardio/ which was installed by hand.) -$(info ) -$(info ***************************************************************************) -$(info ) - +ifneq ($(ARDUINO_DIRECTORIES_USER),) +search_path += $(ARDUINO_DIRECTORIES_USER)/hardware/keyboardio/avr/libraries/Kaleidoscope endif -BOARD_HARDWARE_PATH = $(ARDUINO_INSTALLED_ENV) -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= build-tools/makefiles/ -KALEIDOSCOPE_BUILDER_DIR ?= $(ARDUINO_INSTALLED_ENV)/libraries/Kaleidoscope/bin/ +ifeq ($(shell uname -s),Darwin) +search_path += $(HOME)/Documents/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope +else +search_path += $(HOME)/Arduino/hardware/keyboardio/avr/libraries/Kaleidoscope +endif +sketch_makefile := etc/makefiles/sketch.mk +$(foreach candidate, $(search_path), $(if $(wildcard $(candidate)/$(sketch_makefile)), $(eval ks_dir ?= $(candidate)))) -endif +ifneq ($(ks_dir),) +$(info Using Kaleidoscope from $(ks_dir)) -BOARD_HARDWARE_PATH ?= $(SKETCHBOOK_DIR)/hardware -KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/build-tools/makefiles/ +export KALEIDOSCOPE_DIR := $(ks_dir) +include $(ks_dir)/$(sketch_makefile) -# 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 +else -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 I can't find your Kaleidoscope installation.) +$(info ) +$(info I tried looking in:) $(info ) +$(foreach candidate, $(search_path), $(info $(candidate))) +$(info ) +$(info The easiest way to fix this is to set the 'KALEIDOSCOPE_DIR' environment) +$(info variable to the location of your Kaleidoscope directory.) + endif -include $(BOARD_HARDWARE_PATH)/$(KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR)/rules.mk +null-target: + $(info You should never see this message) + @: