forked from revk/ESP32-EnvMon
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
143 lines (106 loc) · 4.28 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
#
# This is a project Makefile. It is assumed the directory this Makefile resides in is a
# project subdirectory.
#
PROJECT_NAME := Env
SUFFIX := $(shell components/ESP32-RevK/buildsuffix)
MODELS := EnvMon2 EnvMon2-noco2 EnvMon2-nooled EnvMon2-flush EnvMon2-flush-nooled
all:
@echo Make: $(PROJECT_NAME)$(SUFFIX).bin
@idf.py build
@cp build/$(PROJECT_NAME).bin $(PROJECT_NAME)$(SUFFIX).bin
@echo Done: $(PROJECT_NAME)$(SUFFIX).bin
tools: envlog envgraph taspowerlog taspowersvg taspowerse
main/icons.h: $(patsubst %.svg,%.h,$(wildcard icons/*.svg))
cat icons/*.h > main/icons.h
icons/%.png: icons/%.svg
inkscape --export-png=$@ $<
icons/%.gray: icons/%.png
convert $< -resize 32x32 -depth 8 -grayscale average $@
icons/%.h: icons/%.gray
echo "const uint8_t icon_$(patsubst icons/%.h,%,$@)[]={" > $@
od -Anone -tx1 -v -w64 $< | sed 's/ \(.\). \(.\)./0x\1\2,/g' >> $@
echo "};" >> $@
set: wroom pico
pico:
components/ESP32-RevK/setbuildsuffix -S1-PICO-SSD1351
@make
wroom:
components/ESP32-RevK/setbuildsuffix -S1-SSD1351
@make
solo:
components/ESP32-RevK/setbuildsuffix -S1-SOLO-SSD1351
@make
flash:
idf.py flash
monitor:
idf.py monitor
clean:
idf.py clean
menuconfig:
idf.py menuconfig
#include $(IDF_PATH)/make/project.mk
pull:
git pull
git submodule update --recursive
update:
git submodule update --init --remote --merge --recursive
git commit -a -m "Library update"
# Set GPIO low (whichever CBUS is set to mode 8/GPIO)
bootmode: ftdizap/ftdizap
./ftdizap/ftdizap --cbus=0
# Flash with GPIO control using CBUS0 (FT230X design)
zap: bootmode flash
./ftdizap/ftdizap --cbus=1 --reset
# Program the FTDI
ftdi: ftdizap/ftdizap
./ftdizap/ftdizap --serial="RevK" --description="ESP32-EnvMon" --cbus3-mode=17 --self-powered=1
ftdizap/ftdizap: ftdizap/ftdizap.c
make -C ftdizap
SQLlib/sqllib.o: SQLlib/sqllib.c
make -C SQLlib
AXL/axl.o: AXL/axl.c
make -C AXL
AJL/ajl.o: AJL/ajl.c
make -C AJL
SQLINC=$(shell mariadb_config --include)
SQLLIB=$(shell mariadb_config --libs)
SQLVER=$(shell mariadb_config --version | sed 'sx\..*xx')
CCOPTS=${SQLINC} -I. -I/usr/local/ssl/include -D_GNU_SOURCE -g -Wall -funsigned-char -lm
OPTS=-L/usr/local/ssl/lib ${SQLLIB} ${CCOPTS}
envlog: envlog.c SQLlib/sqllib.o AJL/ajl.o
cc -O -o $@ $< -lpopt -lmosquitto -ISQLlib SQLlib/sqllib.o -IAJL AJL/ajl.o ${OPTS}
envgraph: envgraph.c SQLlib/sqllib.o AXL/axl.o
cc -O -o $@ $< -lpopt -lmosquitto -ISQLlib SQLlib/sqllib.o -IAXL AXL/axl.o -lcurl ${OPTS}
taspowerlog: taspowerlog.c SQLlib/sqllib.o AJL/ajl.o
cc -O -o $@ $< -lpopt -lmosquitto -ISQLlib SQLlib/sqllib.o -IAJL AJL/ajl.o ${OPTS}
taspowerse: taspowerse.c SQLlib/sqllib.o AJL/ajlcurl.o
cc -O -o $@ $< -lpopt -ISQLlib SQLlib/sqllib.o -IAJL AJL/ajlcurl.o -lcurl ${OPTS}
taspowersvg: taspowersvg.c SQLlib/sqllib.o AXL/axl.o
cc -O -o $@ $< -lpopt -lmosquitto -ISQLlib SQLlib/sqllib.o -IAXL AXL/axl.o -lcurl ${OPTS}
PCBCase/case: PCBCase/case.c
make -C PCBCase
scad: $(patsubst %,KiCad/%.scad,$(MODELS))
stl: $(patsubst %,KiCad/%.stl,$(MODELS))
%.stl: %.scad
echo "Making $@"
/Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD $< -o $@
echo "Made $@"
KiCad/EnvMon2.scad: KiCad/EnvMon2.kicad_pcb PCBCase/case Makefile
PCBCase/case -o $@ $< --top=10.4 --base=2 --ignore=D3,M1.1
KiCad/EnvMon2-noco2.scad: KiCad/EnvMon2.kicad_pcb PCBCase/case Makefile
PCBCase/case -o $@ $< --top=10.4 --base=2 --ignore=D3,M1.1 --edge2
KiCad/EnvMon2-nooled.scad: KiCad/EnvMon2.kicad_pcb PCBCase/case Makefile
PCBCase/case -o $@ $< --top=7.5 --base=2 --ignore=M1,SW1,SW2,SW3 --edge1
KiCad/EnvMon2-flush.scad: KiCad/EnvMon2.kicad_pcb PCBCase/case Makefile
PCBCase/case -o $@ $< --top=10.4 --base=2 --ignore=D3,M1.1 --spacing=100
@echo 'difference(){translate([spacing+86-4,-24,0])rotate([0,0,90])' >> $@
@cat PCBCase/models/blankplate.scad >> $@
@echo 'translate([spacing,0,0])translate([casewall,pcblength+casewall,height])rotate([180,0,0])hull()pcb(height+1,0);' >> $@
@echo '}' >> $@
KiCad/EnvMon2-flush-nooled.scad: KiCad/EnvMon2.kicad_pcb PCBCase/case Makefile
PCBCase/case -o $@ $< --top=7 --base=2 --ignore=M1,SW1,SW2,SW3 --spacing=100
@echo 'difference(){translate([spacing-6,-8,0])' >> $@
@cat PCBCase/models/blankplate.scad >> $@
@echo 'translate([spacing,0,0])translate([casewall,pcblength+casewall,height])rotate([180,0,0])hull()pcb(height+1,0);' >> $@
@echo '}' >> $@