-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
56 lines (39 loc) · 1.43 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
######################################################################
# Makefile user configuration
######################################################################
# Path to nodemcu-uploader (https://github.com/kmpm/nodemcu-uploader)
NODEMCU-UPLOADER ?= nodemcu-uploader
# Serial port
SERIALPORT?=/dev/cu.usbserial-A9OZ31TX
SPEED?=115200
NODEMCU-COMMAND=$(NODEMCU-UPLOADER) -p $(SERIALPORT) -b $(SPEED)
######################################################################
SOURCEDIR = src
BUILDDIR = build
SOURCES := $(wildcard $(SOURCEDIR)/*.lua)
SOURCES := $(filter-out $(wildcard */*.example.*), $(SOURCES))
SOURCES := $(filter-out $(wildcard */*_test.*), $(SOURCES))
TARGETS := $(patsubst $(SOURCEDIR)/%.lua, $(BUILDDIR)/%.lua, $(SOURCES))
.PHONY: default all clean terminal format ls
default: $(BUILDDIR) $(TARGETS)
help:
@echo " make to upload only changed files"
@echo " make all to upload all files"
@echo " make terminal to start lua terminal on ESP"
@echo " make ls to list files on ESP"
@echo " make format to remove all files from ESP"
@echo $(TEST)
all: clean default
$(BUILDDIR):
mkdir -p $@
$(BUILDDIR)/%.lua: $(SOURCEDIR)/%.lua
$(NODEMCU-COMMAND) upload $<:$(notdir $<) --verify=raw
cp -v $< $@
clean:
rm -rf $(BUILDDIR)
terminal:
rlwrap --always-readline $(NODEMCU-COMMAND) terminal
format:
$(NODEMCU-COMMAND) file format
ls:
$(NODEMCU-COMMAND) file list