From 063908a90e8a4d371d0e4907f580c1edbc6a1495 Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Wed, 27 Feb 2019 18:26:30 +0100 Subject: Fallback settings for BOARD_HARDWARE_PATH This commit allows the Makefile to check if the BOARD_HARDWARE_PATH it tried to determine based on the system specific Arduino installation is correct. This is done by checking for the Kaleidoscope library's existence. If Kaleidoscope is not found, the Makefile falls back to determining the hardware path relative to its own location. This even enables building from any location where a *.ino file lives without the requirement to checkout the kaleidoscope libraries into Arduino installation's hardware path or to symlink them there. The following now is possible > SOURCE_DIR= > cd $SOURCE_DIR > mkdir hardware > git clone --recursive hardware/keyboardio > BUILD_DIR= > cd $BUILD_DIR > make -f $SOURCE_DIR/hardware/keyboardio/avr/libraries/Model01-Firmware/Makefile for quick builds > SOURCE_DIR= > cd $SOURCE_DIR > mkdir hardware > git clone --recursive hardware/keyboardio > cd hardware/keyboardio/avr/libraries/Model01-Firmware make Signed-off-by: Florian Fleissner --- Makefile | 10 ++++++++++ 1 file changed, 10 insertions(+) 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 -- cgit v1.2.3 From 0e865cfc3411f900e04c2061d822f79d575db929 Mon Sep 17 00:00:00 2001 From: Florian Fleissner Date: Thu, 28 Feb 2019 12:45:55 +0100 Subject: Makefile now checks for rules.mk when autodetecting BOARD_HARDWARE_PATH Signed-off-by: Florian Fleissner --- Makefile | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 9ae32d0..7682689 100644 --- a/Makefile +++ b/Makefile @@ -56,10 +56,17 @@ KALEIDOSCOPE_PLUGIN_MAKEFILE_DIR ?= keyboardio/build-tools/makefiles/ # 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)","") +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 -- cgit v1.2.3