-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMakefile
More file actions
92 lines (85 loc) · 3.57 KB
/
Copy pathMakefile
File metadata and controls
92 lines (85 loc) · 3.57 KB
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
fmt: node_modules/prettier/package.json links
clang-format --style=Google -i `find */src */include -name '*.h' -type f`
clang-format --style=Google -i `find */src */include -name '*.c' -type f`
clang-format --style=Google -i `find */src */include -name '*.cpp' -type f`
npx prettier --write */data/*.html
find . -name wifi_secrets.cpp -delete
links:
for i in [0-9]*; do (cd $$i;mkdir -p tools include src data);done
for i in [0-9]*; do (cd $$i;echo $$i; ln -sf ../prj_template/min_spiffs.csv .);done
for i in [0-9]*/tools; do (cd $$i;echo $$i; ln -sf ../../prj_template/tools/* .);done
for i in [0-9]*/include; do (cd $$i;echo $$i; ln -sf ../../prj_template/include/* .);done
for i in [0-9]*/data; do (cd $$i;echo $$i; ln -sf ../../prj_template/data/*.html .);done
for i in [0-9]*/src; do (cd $$i;echo $$i; ln -sf ../../prj_template/src/*.cpp .);done
for i in [0-9]*/src; do (cd $$i;echo $$i; ln -sf ../../../.private/private_wifi_secrets.cpp wifi_secrets.cpp);done
# Generate empty version.h if not present in project include
for i in [0-9]*; do \
if [ ! -f "$$i/include/version.h" ]; then \
echo "Creating empty version.h for $$i"; \
echo '// Auto-generated placeholder' > "$$i/include/version.h"; \
echo '#ifndef VERSION_H' >> "$$i/include/version.h"; \
echo '#define VERSION_H' >> "$$i/include/version.h"; \
echo '#define GIT_HASH "0000000"' >> "$$i/include/version.h"; \
echo '#define GIT_BRANCH "unknown"' >> "$$i/include/version.h"; \
echo '#define BUILD_TIME "1970-01-01 00:00:00"' >> "$$i/include/version.h"; \
echo '#define VERSION_STRING "unknown-0000000"' >> "$$i/include/version.h"; \
echo '#endif' >> "$$i/include/version.h"; \
fi \
done
# Update .gitignore
mv .gitignore .gitignore2
gawk 'skip==0{print} /##===/{skip=1}' .gitignore2 >.gitignore
find * -type l | sort >>.gitignore
rm .gitignore2
build: links
@echo "========================================"
@echo "Building all ESP32 projects"
@echo "========================================"
@rm -f /tmp/build_results.txt
@for i in [0-9]*; do \
echo -n "Building $$i... "; \
if (cd $$i && rm -fR .pio && pio run > /tmp/build.log 2>&1); then \
echo "✓ PASS"; \
echo "$$i: PASS" >> /tmp/build_results.txt; \
else \
echo "✗ FAIL"; \
echo "$$i: FAIL" >> /tmp/build_results.txt; \
cat /tmp/build.log; \
fi; \
done
@echo "========================================"
@echo "Build Summary"
@echo "========================================"
@if [ -f /tmp/build_results.txt ]; then \
echo "Passed: $$(grep -c ': PASS' /tmp/build_results.txt || echo 0)"; \
echo "Failed: $$(grep -c ': FAIL' /tmp/build_results.txt || echo 0)"; \
echo ""; \
if grep -q ': FAIL' /tmp/build_results.txt; then \
echo "Failed projects:"; \
grep ': FAIL' /tmp/build_results.txt | sed 's/: FAIL//'; \
fi; \
fi
@echo "========================================"
# Build single project (usage: make build-00_starter)
build-%:
@echo "Building $*..."
@cd $* && rm -rf .pio && pio run
# Clean all build artifacts
clean:
@echo "Cleaning build artifacts..."
@for i in [0-9]*; do \
rm -rf $$i/.pio; \
done
@rm -rf prj_template/.pio
@echo "Done."
# Static analysis on template (usage: make analyze)
analyze:
cppcheck --enable=warning,performance --inline-suppr --language=c++ --std=c++17 \
--suppress=unknownMacro \
--include=prj_template/include/tpl_system.h \
prj_template/src/*.cpp prj_template/include/*.h 2>&1 | grep -v "^Checking\|^$$"
# Run native unit tests (usage: make test)
test:
cd prj_template && pio test -e native
node_modules/prettier/package.json:
npm install --save-dev --save-exact prettier