-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
42 lines (35 loc) · 1.44 KB
/
Copy pathMakefile
File metadata and controls
42 lines (35 loc) · 1.44 KB
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
# ------------------------------------------------------------
# User-configurable variables (override on the CLI if desired)
# ------------------------------------------------------------
BOARD ?= arduino:avr:nano:cpu=atmega328 # FQBN
PORT ?= /dev/ttyUSB0 # serial port
SKETCH ?= examples/FourWD_Demo # path to .ino folder
LIB_DIRS ?= libraries # extra libraries folder
TARGET_DIR ?= build # where artefacts go
# ------------------------------------------------------------
SKETCH_NAME := $(notdir $(SKETCH))
HEX := $(TARGET_DIR)/$(SKETCH_NAME).ino.hex
# ---------- default target ---------------------------------------------------
all: $(HEX)
# ---------- compile ----------------------------------------------------------
$(HEX):
@mkdir -p $(TARGET_DIR)
arduino-cli compile \
--fqbn $(BOARD) \
--output-dir $(TARGET_DIR) \
--libraries $(LIB_DIRS) \
$(SKETCH)
# ---------- flash ------------------------------------------------------------
upload: $(HEX)
arduino-cli upload \
--fqbn $(BOARD) \
-p $(PORT) \
--input-file $(HEX) \
$(SKETCH)
# ---------- serial monitor ---------------------------------------------------
monitor:
arduino-cli monitor -p $(PORT) -c baudrate=115200
# ---------- cleanup ----------------------------------------------------------
clean:
rm -rf $(TARGET_DIR)
.PHONY: all upload monitor clean