-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
31 lines (23 loc) · 771 Bytes
/
Makefile
File metadata and controls
31 lines (23 loc) · 771 Bytes
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
MODEL=nano
DEVICE=/dev/ttyUSB0
ARDUINO_CLI=arduino-cli
all: build/ardecoder.ino.hex
sketch.yaml:
$(ARDUINO_CLI) core install arduino:avr && \
$(ARDUINO_CLI) board attach -b "arduino:avr:$(MODEL)" -p "$(DEVICE)" .
# Regenerate `sketch.yaml` whenever an argument is explicitly specified
sketch: sketch.yaml
ifneq "$(origin MODEL)" "file"
@$(ARDUINO_CLI) board attach -b "arduino:avr:$(MODEL)" . > /dev/null
endif
ifneq "$(origin DEVICE)" "file"
@$(ARDUINO_CLI) board attach -p "$(DEVICE)" . > /dev/null
endif
build/ardecoder.ino.hex: ardecoder.ino | sketch
mkdir -p build && \
$(ARDUINO_CLI) compile --build-path build $<
upload: build/ardecoder.ino.hex | sketch
$(ARDUINO_CLI) upload -vti $<
clean:
rm -fr sketch.yaml build
.PHONY: all upload clean sketch