forked from xfjx/TonUINO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
97 lines (84 loc) · 2.64 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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#
# TonUINO Makefile
#
# Author: Alexander Willner
# Date: 2020-01-03
# Config
## Arduino Nano (old bootloader)
MCU ?= arduino:avr:nano:cpu=atmega328old
BOARD ?= arduino:avr
SERIAL ?= /dev/cu.usbserial-1420
## Main
SKETCH ?= Tonuino
## Helper
OS = $(shell uname -s)
.PHONY: help
info:
$(info TonUINO Makefile)
$(info ================)
$(info )
$(info Configured to use MCU "$(MCU)" attached to port "$(SERIAL)".)
$(info )
$(info Available commands:)
$(info - help : get support from the community)
$(info - install : installation of required binaries (arduino-cli))
$(info - init : initialize environment (arduino-cli))
$(info - compile : create binary)
$(info - upload : store binary on board flash)
$(info - find : get information about the pluged-in board)
$(info - test : run some basic tests on the code)
$(info - clean : delete temporary files)
$(info - feedback : provide feedback and report issues)
@true
help:
@python -m webbrowser "http://discourse.voss.earth"
install:
ifeq ($(OS),Darwin)
ifeq (, $(shell which brew))
$(error "No brew in PATH, consider installing http://brew.sh")
else
@brew install platformio arduino-cli
endif
endif
ifeq ($(OS),Linux)
ifeq (, $(shell which arduino-cli))
@curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
endif
ifeq (, $(shell which platformio))
@pip install setuptools wheel
@pip install -U platformio
endif
endif
init:
@arduino-cli config init
@arduino-cli core update-index
@arduino-cli core install $(BOARD)
@arduino-cli lib install "DFPlayer Mini Mp3 by Makuna"
@arduino-cli lib install "MFRC522"
@arduino-cli lib install "JC_Button"
@platformio lib install 1561 # DFPlayer Mini Mp3 by Makuna
@platformio lib install 2284 # EEPROM
@platformio lib install 77 # JC_Button
@platformio lib install 63 # MFRC522
prepare:
@mkdir -p "$(SKETCH)" ; echo "folder is only for backwards compatibility" > "$(SKETCH)/DO-NOT-EDIT"
@if [ "$(SKETCH)/$(SKETCH).ino" -nt "./$(SKETCH).ino" ]; then echo "ERROR: do not edit files in TonUINO/!"; exit 1; fi;
@cp -p "./$(SKETCH).ino" "$(SKETCH)/$(SKETCH).ino"
compile: prepare *.ino
@arduino-cli compile --fqbn $(MCU) --warnings none "$(SKETCH)"
find:
@arduino-cli board list
upload: compile
@arduino-cli upload -p $(SERIAL) --fqbn $(MCU) --verify "$(SKETCH)"
test: prepare
@arduino-cli compile --fqbn $(MCU) --warnings more "$(SKETCH)"
ifneq (, $(shell which pio))
@pio test -e native
endif
check: *.ino
@cppcheck --enable=all --std=c++20 --language=c++ *.ino *.h
clean:
@rm -rf "$(SKETCH)"
@rm -rf ".pio/build/"
feedback:
@python -m webbrowser "https://github.com/alexanderwillner/tonuino/issues"