forked from innovationgarage/TTyGO
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
54 lines (42 loc) · 1.68 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
TTGOTERM:=/dev/ttyUSB0
LIBS:=OneButton U8g2
FQBN:=esp8266:esp8266:nodemcu
# FQBN:=arduino:avr:leonardo
FILE_FQBN:=$(subst :,.,$(FQBN))
ifeq ($(firstword $(subst :, ,$(FQBN))),esp8266)
PKG_PATH:=~/.arduino15/packages/esp8266
LIBS:=$(LIBS) ESP8266Scheduler
else
PKG_PATH:=~/.arduino15/packages/arduino/hardware/$(word 2, $(subst :, ,$(FQBN)))
endif
LIBDIR=~/Arduino/libraries
LIBDIRS:=$(patsubst %,$(LIBDIR)/%,$(LIBS))
.PHONY: all
all: TTyGO/TTyGO.$(FILE_FQBN).bin TTyGO/TTyGO.$(FILE_FQBN).elf
.PHONY: printenv
printenv:
echo TTGOTERM=$(TTGOTERM)
echo LIBS=$(LIBS)
echo FQBN=$(FQBN)
echo FILE_FQBN=$(FILE_FQBN)
echo PKG_PATH=$(PKG_PATH)
echo LIBDIR=$(LIBDIR)
echo LIBDIRS=$(LIBDIRS)
TTyGO/TTyGO.$(FILE_FQBN).bin TTyGO/TTyGO.$(FILE_FQBN).elf: TTyGO/*.ino TTyGO/*.h $(LIBDIRS) $(PKG_PATH)
~/bin/arduino-cli compile --fqbn $(FQBN) TTyGO -v
~/Arduino/libraries/%:
~/bin/arduino-cli lib install $(notdir $@)
~/.arduino15/packages/esp8266: ~/bin/arduino-cli
~/bin/arduino-cli core update-index --additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json
~/bin/arduino-cli core install esp8266:esp8266 --additional-urls http://arduino.esp8266.com/stable/package_esp8266com_index.json
~/.arduino15/packages/arduino/hardware/%: ~/bin/arduino-cli
~/bin/arduino-cli core update-index
~/bin/arduino-cli core install arduino:$(notdir $@)
~/bin/arduino-cli:
cd ~; curl -fsSL https://raw.githubusercontent.com/arduino/arduino-cli/master/install.sh | sh
.PHONY: upload
upload: TTyGO/TTyGO.$(FILE_FQBN).bin TTyGO/TTyGO.$(FILE_FQBN).elf
~/bin/arduino-cli upload -p $(TTGOTERM) --fqbn $(FQBN) TTyGO
.PHONY: clean
clean:
-rm TTyGO/TTyGO.*.bin TTyGO/TTyGO.*.elf TTyGO/TTyGO.*.hex