summaryrefslogtreecommitdiffstats
path: root/Makefile
blob: 9d997a43f04821003cfe7b73a31083b948752e0b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# This makefile for a Kaleidoscope sketch pulls in all the targets
# required to build the example

#" /home/bjc/src/Kaleidoscope/.arduino/data/packages/keyboardio/tools/dfu-util/0.10.0-arduino1/dfu-util" --device 0x3496:0x0005 -D /tmp/kaleidoscope-bjc/output/3606415822-Model100.ino/Model100.ino.bin -R

# arduino-cli compile --fqbn keyboardio:gd32:keyboardio_model_100 --show-properties Model100.ino

_ARDUINO_CLI_COMPILE_CUSTOM_FLAGS=--build-property "runtime.tools.xpack-arm-none-eabi-gcc-9.3.1-1.3.path=/usr" --build-property "runtime.tools.dfu-util.path=/usr/sbin"
ARDUINO_DIRECTORIES_USER=$(HOME)/Arduino/
# ARDUINO_DIRECTORIES_DATA=
KALEIDOSCOPE_DIR=$(HOME)/Arduino/libraries/Kaleidoscope
#KALEIDOSCOPE_DIR=/tmp/Kaleidoscope


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

gdb: ${ELF_FILE_PATH}
	arm-none-eabi-gdb -x gdbinit.container ${ELF_FILE_PATH}

cp-elf: ${ELF_FILE_PATH}
	cp ${ELF_FILE_PATH} .

cp-bin: ${BIN_FILE_PATH}
	cp ${BIN_FILE_PATH} .

null-target:
	$(info You should never see this message)
	@: