-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
119 lines (96 loc) · 2.84 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
# GENERATOR?="Unix Makefiles"
# GENERATOR_COMMAND?="make"
# GENERATOR_ARGS?="--no-print-directory"
GENERATOR?="Ninja"
GENERATOR_COMMAND?="ninja"
GENERATOR_ARGS?=
DEVICE?=/dev/ttyACM0
SAMPLE?=shell
TOOLCHAIN_FILE?=cmake/avr6-atmega2560.cmake
BAUDRATE?=115200
QEMU?=OFF
# if QEMU is enabled, set CMAKE_BUILD_TYPE to Debug by default
ifeq ($(QEMU),ON)
CMAKE_BUILD_TYPE?=Debug
else
CMAKE_BUILD_TYPE?=Release
endif
all: single
.PHONY: single cmake multiple upload monitor qemu run_qemu format clean piogen arduino_gen gen flash
cmake:
cmake -S . -B build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCMAKE_GENERATOR=$(GENERATOR) \
-DPROG_DEV=$(DEVICE) \
-DBAUDRATE=$(BAUDRATE) \
-DQEMU=$(QEMU) \
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
multiple:
cmake -S . -B build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCMAKE_GENERATOR=$(GENERATOR) \
-DPROG_DEV=$(DEVICE) \
-DBAUDRATE=$(BAUDRATE) \
-DQEMU=$(QEMU) \
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
$(GENERATOR_COMMAND) -C build $(GENERATOR_ARGS)
single:
cmake -S . -B build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCMAKE_GENERATOR=$(GENERATOR) \
-DENABLE_SINGLE_SAMPLE=$(SAMPLE) \
-DPROG_DEV=$(DEVICE) \
-DBAUDRATE=$(BAUDRATE) \
-DQEMU=$(QEMU) \
-DCMAKE_BUILD_TYPE=$(CMAKE_BUILD_TYPE)
$(GENERATOR_COMMAND) -C build $(GENERATOR_ARGS)
drv-timer:
cmake -S . -B build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCMAKE_GENERATOR=$(GENERATOR) \
-DENABLE_SINGLE_SAMPLE=$@ \
-DPROG_DEV=$(DEVICE) \
-DBAUDRATE=$(BAUDRATE) \
-DQEMU=ON \
-DCMAKE_BUILD_TYPE=Debug
$(GENERATOR_COMMAND) -C build $(GENERATOR_ARGS)
drv-i2c-tcn75:
cmake -S . -B build \
-DCMAKE_EXPORT_COMPILE_COMMANDS=ON \
-DCMAKE_TOOLCHAIN_FILE=$(TOOLCHAIN_FILE) \
-DCMAKE_GENERATOR=$(GENERATOR) \
-DENABLE_SINGLE_SAMPLE=$@ \
-DPROG_DEV=$(DEVICE) \
-DBAUDRATE=$(BAUDRATE) \
-DQEMU=OFF \
-DCMAKE_BUILD_TYPE=Release
$(GENERATOR_COMMAND) -C build $(GENERATOR_ARGS)
upload:
$(GENERATOR_COMMAND) -C build upload $(GENERATOR_ARGS)
flash: upload
monitor:
$(GENERATOR_COMMAND) -C build monitor $(GENERATOR_ARGS)
qemu:
$(GENERATOR_COMMAND) -C build qemu $(GENERATOR_ARGS)
debug: qemu
run_qemu:
$(GENERATOR_COMMAND) -C build run_qemu $(GENERATOR_ARGS)
format:
find src -iname *.h -o -iname *.c -o -iname *.cpp | xargs clang-format -i
find examples -iname *.h -o -iname *.c -o -iname *.cpp -o -iname *.ino | xargs clang-format -i
clean:
rm -rf build
piogen:
python3 ./scripts/piogen.py
arduino_gen:
python3 ./scripts/arduinogen.py
arduino_lint:
arduino-lint --compliance strict --library-manager update
metrics:
scripts/metrics-build-examples-default.sh
# Prepare for release
publish: piogen arduino_gen format clean multiple metrics arduino_lint