summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.kaleidoscope-builder.conf3
-rw-r--r--Makefile84
-rw-r--r--sketch.json6
3 files changed, 36 insertions, 57 deletions
diff --git a/.kaleidoscope-builder.conf b/.kaleidoscope-builder.conf
deleted file mode 100644
index e4a5db4..0000000
--- a/.kaleidoscope-builder.conf
+++ /dev/null
@@ -1,3 +0,0 @@
-# -*- mode: sh -*-
-
-DEFAULT_SKETCH=Model01-Firmware
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)
+ @:
diff --git a/sketch.json b/sketch.json
new file mode 100644
index 0000000..d65116c
--- /dev/null
+++ b/sketch.json
@@ -0,0 +1,6 @@
+{
+ "cpu": {
+ "fqbn": "keyboardio:avr:model01",
+ "port": ""
+ }
+} \ No newline at end of file