forked from betaflight/unified-targets
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Makefile
33 lines (32 loc) · 1.55 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
test: check-unified-target-naming
check-unified-target-naming:
@for target_config in configs/default/*; do \
BOARD_NAME=$$(sed -n 's/^ *board_name \([^#]\+\).*$$/\1/p' $${target_config} | sed -e 's/[[:space:]]*$$//'); \
MANUFACTURER_ID=$$(sed -n 's/^ *manufacturer_id \+\([^#]\{1,4\}\).*$$/\1/p' $${target_config} | sed -e 's/[[:space:]]*$$//'); \
FILE_NAME=$$(basename $${target_config}); \
\
if [ $$(printf %s "$${BOARD_NAME}" | grep -c .) -gt 1 ]; then \
echo "More than one board_name found in Unified Target configuration $${target_config}."; \
exit 1; \
fi; \
\
if [ $$(printf %s "$${MANUFACTURER_ID}" | grep -c .) -gt 1 ]; then \
echo "More than one manufacturer_id found in Unified Target configuration $${target_config}."; \
exit 1; \
fi; \
\
if [ $$(echo "$${BOARD_NAME}" | grep -c '[^[:upper:][:digit:]_]') -ne 0 ]; then \
echo "Invalid characters found in board_name ($${BOARD_NAME}, allowed 'A'-'Z', '0'-'9', '_') in Unified Target configuration $${target_config}."; \
exit 1; \
fi; \
\
if [ $$(echo "$${MANUFACTURER_ID}" | grep -c '[^[:upper:][:digit:]_]') -ne 0 ]; then \
echo "Invalid characters found in manufacturer_id ($${MANUFACTURER_ID}, allowed 'A'-'Z', '0'-'9', '_') in Unified Target configuration $${target_config}."; \
exit 1; \
fi; \
\
if [ "$${FILE_NAME}" != "$${MANUFACTURER_ID}-$${BOARD_NAME}.config" ]; then \
echo "File name does not match board name ($${BOARD_NAME}) / manufacturer id ($${MANUFACTURER_ID}) in Unified Target configuration $${target_config}."; \
exit 1; \
fi; \
done