-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
58 lines (47 loc) · 1.41 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
# Generic Makefile to build an Arduino Sketch under the same directory
# Antonio F. Torinsieiello
# nino@nino.com.br
# Path to your "arduino-cli"
# You can either use it from your Arduino IDE's installation
# Or you can download one from here:
# https://github.com/arduino/arduino-cli/releases
CLI?=/home/nino/bin/arduino-cli
# Setup your serial port
PORT?=/dev/ttyACM0
# Setup your board FQBN
# If you don't know what's your FQBN, try "make list" to list all installed board's FQBN
BOARD?=esp32:esp32:esp32
# Setup your sketch file name
#
# The exemple bellow will default to the first ".ino" file in the same
# directory of this Makefile under linux
SKETCH=`find ./ -name "*.ino" -print -quit`
# Print a screen width wide separator
hr=bash -c 'COLS=`tput cols`;x=1;dots=""; while [ $$x -le $$COLS ]; do dots="$$dots""-"; x=$$(( $$x + 1 )); done; dots=$${dots:0:$$COLS}; echo $$dots;'
all: upload
compile:
@${hr}
@echo Building...
@${hr}
@${CLI} -v compile --fqbn $(BOARD) $(SKETCH)
nocache:
@${hr}
@echo Clean and build (no cache)
@${hr}
@${CLI} -v compile --clean --upload -p $(PORT) --fqbn $(BOARD) $(SKETCH)
upload:
@${hr}
@echo Building and uploading aftwards
@${hr}
@${CLI} -v compile --upload -p $(PORT) --fqbn $(BOARD) $(SKETCH)
update:
@${hr}
@echo Updating arduino platform...
@${hr}
@${CLI} update
@${CLI} upgrade
list:
@${hr}
@echo Listing all installed board\'s FQBN
@${hr}
@${CLI} board listall