summaryrefslogtreecommitdiff
path: root/Makefile
blob: 56430058d53fcd9bb7dd4eaa4574e3dfe8a53063 (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
#DEVICE := /dev/ttyACM1
# FreeBSD (via Linuxator).
# This requires installation of the linux-compatible-tty.conf devd script.
# Without this, `arduino-cli upload` will not work.
# You can however manually invoke avrdude on FreeBSD if everything fails.
DEVICE := /dev/ttyACM0

FQBN := arduino:avr:leonardo

ARDUINO_CLI := arduino-cli
#ARDUINO_CLI := ~/arduino-ide_2.2.1_Linux_64bit/resources/app/lib/backend/resources/arduino-cli

all: compile

install-deps:
	$(ARDUINO_CLI) core install arduino:avr
	$(ARDUINO_CLI) lib install DistanceSensor
	$(ARDUINO_CLI) lib install MIDIUSB
	@echo 'You have to install https://github.com/tttapa/Control-Surface manually.'

# For the legacy arduino-build that runs natively on FreeBSD.
# Not all libraries are compatible, though.
# Especially Control-Surface apparently needs a v2 core.
# arduino-builder -compile -hardware /usr/local/arduino/hardware -tools /usr/local/arduino/hardware/tools/ -tools /usr/local/arduino/tools-builder/ -core-api-version 10618 -libraries ~/Arduino/libraries -fqbn arduino:avr:leonardo -prefs "compiler.cpp.extra_flags=-DARDUINO_API_VERSION=1" -verbose shmotbox.ino
compile:
	$(ARDUINO_CLI) compile --clean --fqbn $(FQBN) .

# You may have to run this as root, but this will require installing
# the arduino:avr core into the root account as well.
# It therefore makes sense to have $(DEVICE) accessible as a regular user.
# On FreeBSD you have to be in the dialer group.
upload:
	$(ARDUINO_CLI) upload -p $(DEVICE) --fqbn $(FQBN) .

monitor:
	$(ARDUINO_CLI) monitor -p $(DEVICE) --fqbn $(FQBN) .