Skip to content

Commit 612401b

Browse files
committed
buildsystem: remove info-buildsizes, fix info-buildsizes-diff
1 parent 90ea940 commit 612401b

File tree

5 files changed

+30
-18
lines changed

5 files changed

+30
-18
lines changed

Makefile.include

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ GLOBAL_GOALS += info-boards-features-blacklisted \
232232
info-boards-features-conflicting \
233233
info-boards-features-missing \
234234
info-boards-supported \
235-
info-buildsizes info-buildsizes-diff \
235+
info-buildsizes-diff \
236236
generate-Makefile.ci \
237237
#
238238

dist/tools/zsh-completion/zsh-riot.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ function _riot {
9393
"info-build:show details to debug the build"
9494
"info-build-json:show details of the build as JSON"
9595
"info-buildsize:print the size of the firmware for the given board"
96-
"info-buildsizes:print the size of the firmware for every supported board"
96+
"info-buildsizes-diff:compare the size of two firmware builds for two given directories"
9797
"info-cpu:print the CPU family for the given board"
9898
"info-features-missing:list features missing by the given baord in regard to the given app"
9999
"info-features-provided:list features provided by the given board"

doc/doxygen/src/advanced-build-system-tricks.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -177,21 +177,24 @@ multiple git work trees or clones of the RIOT repository.
177177

178178
Comparing Build Sizes {#comparing-build-sizes}
179179
=====================
180-
There is a make target for build size comparison. You can use it like that:
180+
There is a make target for build size comparison. It will automatically check
181+
all the boards compiled in the `NEWBIN` and `OLDBIN` and compare them.
182+
For boards that do not have a complementary partner, a warning is generated.
183+
You can use it like that:
181184

182185
~~~~~~~~~~~~~~~~~~~
183186
$ cd RIOT/test/test_something
184187
185188
$ git checkout master
186-
$ BINDIRBASE=master-bin make buildtest
189+
$ BINDIRBASE=master-bin BOARD=native64 make all
187190
188191
$ git checkout my-branch
189-
$ BINDIRBASE=my-branch-bin make buildtest
192+
$ BINDIRBASE=my-branch-bin BOARD=native64 make all
190193
191194
$ OLDBIN=master-bin NEWBIN=my-branch-bin make info-buildsizes-diff
192195
text data bss dec BOARD/BINDIRBASE
193196
194-
0 0 0 0 avsextrem **← this line contains the diff**
197+
0 0 0 0 native64 **← this line contains the diff**
195198
57356 1532 96769 155657 master-bin
196199
57356 1532 96769 155657 my-branch-bin
197200

makefiles/info-global.inc.mk

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
.PHONY: info-buildsizes \
2-
info-buildsizes-diff \
1+
.PHONY: info-buildsizes-diff \
32
info-boards-supported \
43
info-boards-features-missing \
54
info-boards-features-blacklisted \
@@ -108,25 +107,29 @@ BOARDS := $(filter-out $(BOARDS_WITH_MISSING_FEATURES) \
108107
$(BOARDS_WITH_BLACKLISTED_FEATURES) \
109108
$(BOARDS_WITH_CONFLICTING_FEATURES), $(BOARDS))
110109

111-
info-buildsizes: SHELL=bash
112-
info-buildsizes:
113-
@echo -e " text\t data\t bss\t dec\tboard"; \
114-
for board in $(BOARDS); do \
115-
echo "$$(BOARD=$${board} $(MAKE) --no-print-directory info-buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$${board}"; \
116-
done;
117-
118110
info-buildsizes-diff: SHELL=bash
119111
info-buildsizes-diff:
120112
@echo -e "text\tdata\tbss\tdec\tBOARD/BINDIRBASE\n"; \
113+
COMMON_BOARDS=(); ONLY_OLD=(); ONLY_NEW=(); \
121114
for board in $(BOARDS); do \
115+
if [[ -e "$${OLDBIN}/$${board}" && -e "$${NEWBIN}/$${board}" ]]; then \
116+
COMMON_BOARDS+=($${board}); \
117+
elif [[ -e "$${OLDBIN}/$${board}" ]]; then \
118+
ONLY_OLD+=($${board}); \
119+
elif [[ -e "$${NEWBIN}/$${board}" ]]; then \
120+
ONLY_NEW+=($${board}); \
121+
fi; \
122+
done; \
123+
for board in "$${COMMON_BOARDS[@]}"; do \
122124
for BINDIRBASE in $${OLDBIN} $${NEWBIN}; do \
123-
BINDIRBASE=$${BINDIRBASE} BOARD=$${board} $(MAKE) info-buildsize --no-print-directory 2>/dev/null | tail -n-1 | cut -f-4; \
125+
env --unset=MAKEFLAGS BINDIRBASE=$${BINDIRBASE} BOARD=$${board} $(MAKE) info-buildsize --no-print-directory 2>/dev/null | tail -n-1 | cut -f-4; \
124126
done | \
125127
while read -a OLD && read -a NEW; do \
126128
for I in 0 1 2 3; do \
127129
if [[ -n "$${NEW[I]}" && -n "$${OLD[I]}" ]]; then \
128130
DIFF=$$(($${NEW[I]} - $${OLD[I]})); \
129131
if [[ "$${DIFF}" -gt 0 ]]; then $(COLOR_ECHO) -n "$(COLOR_RED)"; fi; \
132+
if [[ "$${DIFF}" -eq 0 ]]; then $(COLOR_ECHO) -n "$(COLOR_YELLOW)"; fi; \
130133
if [[ "$${DIFF}" -lt 0 ]]; then $(COLOR_ECHO) -n "$(COLOR_GREEN)"; fi; \
131134
else \
132135
DIFF="$(COLOR_RED)ERR"; \
@@ -137,7 +140,13 @@ info-buildsizes-diff:
137140
for I in 0 1 2 3; do echo -ne "$${OLD[I]-$(COLOR_RED)ERR$(COLOR_RESET)}\t"; done; echo -e "$${OLDBIN}"; \
138141
for I in 0 1 2 3; do echo -ne "$${NEW[I]-$(COLOR_RED)ERR$(COLOR_RESET)}\t"; done; echo -e "$${NEWBIN}\n"; \
139142
done; \
140-
done;
143+
done; \
144+
if [[ "$${#ONLY_OLD[@]}" -gt 0 ]]; then \
145+
$(COLOR_ECHO) "$(COLOR_YELLOW)Boards in OLDBIN without complementary NEWBIN: $${ONLY_OLD[*]}$(COLOR_RESET)"; \
146+
fi; \
147+
if [[ "$${#ONLY_NEW[@]}" -gt 0 ]]; then \
148+
$(COLOR_ECHO) "$(COLOR_YELLOW)Boards in NEWBIN without complementary OLDBIN: $${ONLY_NEW[*]}$(COLOR_RESET)"; \
149+
fi;
141150

142151
info-boards-supported:
143152
@echo $(BOARDS)

makefiles/info.inc.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
.PHONY: info-objsize info-buildsizes info-build info-boards-supported \
1+
.PHONY: info-objsize info-buildsize info-build info-boards-supported \
22
info-features-missing info-modules info-cpu \
33
info-features-provided info-features-required \
44
info-features-used info-kconfig-variables \

0 commit comments

Comments
 (0)