-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
58 lines (47 loc) · 1.96 KB
/
Makefile
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
# Default build architecture and board
TARGET ?= adafruit:samd:adafruit_feather_m0
CORE = $(shell echo $(TARGET) | cut -d: -f1,2)
LIBS ?= "StepperDriver" "Adafruit BluefruitLE nRF51"
# Where to save the Arduino support files, this should match what is in arduino-cli.yaml
ARDUINO_DIR ?= .arduino
default:
#################################################################################################
# Initial setup: make .arduino/arduino-cli setup
#
# Build all the examples: make all TARGET=adafruit:samd:adafruit_feather_m0
#
# Install more cores: make core TARGET=adafruit:samd:adafruit_feather_m0
# (edit arduino-cli.yaml and add repository if needed)
#################################################################################################
# See https://arduino.github.io/arduino-cli/installation/
ARDUINO_CLI_URL = https://downloads.arduino.cc/arduino-cli/arduino-cli_latest_Linux_64bit.tar.gz
ARDUINO_CLI ?= $(ARDUINO_DIR)/arduino-cli --config-file arduino-cli.yaml
COMPILE = $(ARDUINO_CLI) compile --warnings all --fqbn $(TARGET)
all: PanoController
PanoController:: examples/PanoController core
$(ARDUINO_CLI) compile --warnings all --fqbn $(TARGET) --output-dir build $<
ls -l build
# Remove built objects
clean:
rm -rfv build
core: $(ARDUINO_DIR)/arduino-cli
$(ARDUINO_CLI) core install $(CORE)
for lib in $(LIBS); do \
$(ARDUINO_CLI) lib install "$${lib}" || true ; \
done
$(ARDUINO_DIR)/arduino-cli: # Download and install arduino-cli
$(ARDUINO_DIR)/arduino-cli:
mkdir -p $(ARDUINO_DIR)
cd $(ARDUINO_DIR)
curl -L -s $(ARDUINO_CLI_URL) \
| tar xfz - -C $(ARDUINO_DIR) arduino-cli
chmod 755 $@
$(ARDUINO_CLI) version
setup: # Configure cores and libraries for arduino-cli (which it will download if missing)
setup: $(ARDUINO_DIR)/arduino-cli
mkdir -p $(ARDUINO_DIR)/libraries
ln -sf $(CURDIR) $(ARDUINO_DIR)/libraries/
$(ARDUINO_CLI) config dump
$(ARDUINO_CLI) core update-index
$(ARDUINO_CLI) core list
.PHONY: clean all setup PanoController