-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMakefile
102 lines (74 loc) · 2.74 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
98
99
100
101
102
.PHONY: all clean upload fs uploadfs cleanfs htdocs src_htdocs pipenv
.DELETE_ON_ERROR:
# Don't emit native code because the ESP32 can't execute it from SPIRAM
MPY_CROSS_ARGS=-msmall-int-bits=31 -X emit=bytecode
PIPENV=$(CURDIR)/pipenv
PYTHON=$(PIPENV)/.venv/bin/python3
all:
platformio run
native:
platformio run -e native
clean: cleanfs
+$(MAKE) -C $(PIPENV) -L clean
rm -rf lib/micropython/port/build
rm -rf .pio/*
rm -f src/htdocs/*.gz.h
+$(MAKE) -C micropython/mpy-cross clean
+$(MAKE) -C app/pio/certs -L clean
upload:
platformio run -t upload
uploadfs: fs
platformio run -t uploadfs
htdocs: \
$(patsubst %.xml,src/%.xml.gz.h,$(wildcard htdocs/*.xml))
data:
mkdir -p data
fs: \
$(patsubst %.py,data/%.mpy,$(wildcard scripts/*.py)) \
$(patsubst %.json,data/%.cbor,$(wildcard buses/*.json)) \
$(patsubst %.toml,data/%.cbor,$(wildcard buses/*.toml)) \
$(patsubst %.yaml,data/%.cbor,$(wildcard buses/*.yaml)) \
$(patsubst %.json,data/%.cbor,$(wildcard presets/*.json)) \
$(patsubst %.toml,data/%.cbor,$(wildcard presets/*.toml)) \
$(patsubst %.yaml,data/%.cbor,$(wildcard presets/*.yaml)) \
$(patsubst %.json,data/%.cbor,$(wildcard profiles/*.json)) \
$(patsubst %.toml,data/%.cbor,$(wildcard profiles/*.toml)) \
$(patsubst %.yaml,data/%.cbor,$(wildcard profiles/*.yaml))
cleanfs:
rm -rf data
micropython/mpy-cross/mpy-cross:
+$(MAKE) -C micropython/mpy-cross
data/scripts: | data
mkdir -p data/scripts
data/scripts/%.mpy: scripts/%.py | data/scripts micropython/mpy-cross/mpy-cross
micropython/mpy-cross/mpy-cross $(MPY_CROSS_ARGS) -o $@ -s $(patsubst scripts/%,%,$<) $<
pipenv:
+$(MAKE) -C $(PIPENV) -L
data/buses: | data
mkdir -p data/buses
data/buses/%.cbor: buses/%.yaml | data/buses pipenv
$(PYTHON) $(PIPENV)/yaml2cbor.py $< $@
data/buses/%.cbor: buses/%.toml | data/buses pipenv
$(PYTHON) $(PIPENV)/toml2cbor.py $< $@
data/buses/%.cbor: buses/%.json | data/buses pipenv
$(PYTHON) $(PIPENV)/json2cbor.py $< $@
data/profiles: | data
mkdir -p data/profiles
data/profiles/%.cbor: profiles/%.yaml | data/profiles pipenv
$(PYTHON) $(PIPENV)/yaml2cbor.py $< $@
data/profiles/%.cbor: profiles/%.toml | data/profiles pipenv
$(PYTHON) $(PIPENV)/toml2cbor.py $< $@
data/profiles/%.cbor: profiles/%.json | data/profiles pipenv
$(PYTHON) $(PIPENV)/json2cbor.py $< $@
data/presets: | data
mkdir -p data/presets
data/presets/%.cbor: presets/%.yaml | data/presets pipenv
$(PYTHON) $(PIPENV)/yaml2cbor.py $< $@
data/presets/%.cbor: presets/%.toml | data/presets pipenv
$(PYTHON) $(PIPENV)/toml2cbor.py $< $@
data/presets/%.cbor: presets/%.json | data/presets pipenv
$(PYTHON) $(PIPENV)/json2cbor.py $< $@
src_htdocs:
mkdir -p src/htdocs
src/htdocs/%.gz.h: htdocs/% pipenv/gzip-embed.py | src_htdocs pipenv
$(PYTHON) $(PIPENV)/gzip-embed.py $< $@