-
Notifications
You must be signed in to change notification settings - Fork 1
/
Makefile
46 lines (31 loc) · 993 Bytes
/
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
.SUFFIXES:
.SUFFIXES: .lua .d
# TODO: exclude config-example.lua and init.lua
SRC=$(wildcard src/*.lua) $(wildcard ustream/*.lua)
EXCLUDE=src/preupload.lua $(wildcard src/test_*.lua) $(wildcard ustream/test_*.lua) $(wildcard src/*example*.lua)
FILES=$(filter-out $(EXCLUDE),$(SRC))
DDIR=.deps
DEPS=$(patsubst %.lua,%.d,$(patsubst %,$(DDIR)/%,$(FILES)))
# UPLOADER=nodemcu-uploader --timeout 10 --port /dev/tty.wchusbserial*
UPLOADER=nodemcu-uploader --timeout 10 --port /dev/tty.usbserial-*
$(DDIR)/%.d: %.lua
luac-5.4 -p $<
$(UPLOADER) upload --compile $<:$(notdir $<)
mkdir -p $(dir $@)
touch $@
$(DDIR)/all.d: $(FILES)
$(UPLOADER) file remove init.lua
$(UPLOADER) node restart
sleep 2
$(UPLOADER) exec ./src/preupload.lua
make $(DEPS)
$(UPLOADER) upload -r src/init.lua:init.lua
touch $(DDIR)/all.d
upload: $(DDIR)/all.d
clean:
rm -rf $(DDIR)
format: clean
$(UPLOADER) file format
list:
$(UPLOADER) file list
.PHONY: upload format prepare list clean