-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
69 lines (58 loc) · 1.86 KB
/
Makefile
File metadata and controls
69 lines (58 loc) · 1.86 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# Makefile for Arduino Nano Quantizer
# Uses arduino-cli for compilation and upload
# Configuration
ARDUINO_CLI ?= arduino-cli
BOARD_FQBN = arduino:avr:nano
SKETCH_DIR = .
SKETCH = $(SKETCH_DIR)/eurorack-quantizer-software.ino
PORT ?= /dev/ttyUSB0
BAUD_RATE ?= 115200
# Default target
.PHONY: all
all: compile
# Compile the sketch
.PHONY: compile
compile:
@echo "Compiling $(SKETCH)..."
$(ARDUINO_CLI) compile -vt --fqbn $(BOARD_FQBN) $(SKETCH_DIR)
# Upload to Arduino
.PHONY: upload
upload: compile
@echo "Uploading to $(PORT)..."
$(ARDUINO_CLI) upload -vt -p $(PORT) --fqbn $(BOARD_FQBN) $(SKETCH_DIR)
# Compile and upload in one step
.PHONY: build-upload
build-upload: upload
# Open serial monitor
.PHONY: monitor
monitor:
@echo "Opening serial monitor on $(PORT)..."
$(ARDUINO_CLI) monitor -p $(PORT) --config $(BAUD_RATE)
# Clean build artifacts
.PHONY: clean
clean:
@echo "Cleaning build artifacts..."
rm -rf $(SKETCH_DIR)/build
# List available ports
.PHONY: ports
ports:
$(ARDUINO_CLI) board list
# Check if arduino-cli is installed
.PHONY: check
check:
@which $(ARDUINO_CLI) > /dev/null || (echo "Error: $(ARDUINO_CLI) not found. Install it from https://arduino.github.io/arduino-cli/" && exit 1)
@echo "✓ $(ARDUINO_CLI) found"
# Help target
.PHONY: help
help:
@echo "Available targets:"
@echo " make compile - Compile the sketch"
@echo " make upload - Compile and upload to Arduino (uses PORT=$(PORT))"
@echo " make build-upload - Same as upload"
@echo " make monitor - Open serial monitor (uses PORT=$(PORT), BAUD_RATE=$(BAUD_RATE))"
@echo " make ports - List available serial ports"
@echo " make clean - Remove build artifacts"
@echo " make check - Verify arduino-cli is installed"
@echo ""
@echo "Override PORT: make upload PORT=/dev/ttyACM0"
@echo "Override ARDUINO_CLI: make compile ARDUINO_CLI=arduino-cli"