From f02e5b97e26e5b5a783f89cf12fec39e80d7ab95 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Kijewski?= <rene.kijewski@fu-berlin.de> Date: Fri, 18 Apr 2014 21:01:48 +0200 Subject: [PATCH] make: show diffence in buildsizes for two folders --- Makefile.include | 50 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 48 insertions(+), 2 deletions(-) diff --git a/Makefile.include b/Makefile.include index 490107ef91..6768fc9957 100644 --- a/Makefile.include +++ b/Makefile.include @@ -31,7 +31,8 @@ CFLAGS += -DBOARD_$(BB) -DCPU_$(CPUDEF) export CFLAGS -export BINDIR =$(CURDIR)/bin/$(BOARD)/ +export BINDIRBASE ?= $(CURDIR)/bin +export BINDIR ?= $(abspath $(BINDIRBASE)/$(BOARD))/ ifeq ($(QUIET),1) AD=@ @@ -82,7 +83,7 @@ BASELIBS += $(BINDIR)$(BOARD)_base.a BASELIBS += $(BINDIR)${PROJECT}.a BASELIBS += $(USEPKG:%=${BINDIR}%.a) -.PHONY: all clean flash doc term objsize buildsize buildsizes +.PHONY: all clean flash doc term objsize buildsize buildsizes buildsizes-diff ## make script for your application. Build RIOT-base here! all: $(BINDIR)$(PROJECT).a @@ -187,6 +188,7 @@ buildtest: RIOTBASE=$${RIOTBASE} \ RIOTBOARD=$${RIOTBOARD} \ RIOTCPU=$${RIOTCPU} \ + BINDIRBASE=$${BINDIRBASE} \ $(MAKE) -B clean all 2>&1 >/dev/null) ; \ if [ "$${?}" = "0" ]; then \ $${ECHO} "$${GREEN}success$${RESET}"; \ @@ -238,5 +240,49 @@ buildsizes: RIOTBASE=$${RIOTBASE} \ RIOTBOARD=$${RIOTBOARD} \ RIOTCPU=$${RIOTCPU} \ + BINDIRBASE=$${BINDIRBASE} \ $(MAKE) buildsize 2>/dev/null | tail -n-1 | cut -f-4)" "$${BOARD}"; \ done; + +buildsizes-diff: SHELL=bash +buildsizes-diff: + @if [[ -z "$(BOARD_WHITELIST)" ]]; then \ + BOARDS=$$(find $(RIOTBOARD) -mindepth 1 -maxdepth 1 -type d \! -name \*-common -printf '%f\n' ); \ + else \ + BOARDS="$(BOARD_WHITELIST)"; \ + fi; \ + for BOARD in $(BOARD_BLACKLIST); do \ + BOARDS=$$(sed -e "s/ $${BOARD} / /" <<< " $${BOARDS} "); \ + done; \ + \ + GREEN='\033[1;32m'; RED='\033[1;31m'; RESET='\033[0m'; \ + \ + echo -e "text\tdata\tbss\tdec\tBOARD/BINDIRBASE\n"; \ + for BOARD in $$(tr ' ' '\n' <<< $${BOARDS} | sort); do \ + for BINDIRBASE in $${OLDBIN} $${NEWBIN}; do \ + env -i \ + HOME=$${HOME} \ + PATH=$${PATH} \ + BOARD=$${BOARD} \ + RIOTBASE=$${RIOTBASE} \ + RIOTBOARD=$${RIOTBOARD} \ + RIOTCPU=$${RIOTCPU} \ + BINDIRBASE=$${BINDIRBASE} \ + $(MAKE) buildsize 2>/dev/null | tail -n-1 | cut -f-4; \ + done | \ + while read -a OLD && read -a NEW; do \ + for I in 0 1 2 3; do \ + if [[ -n "$${NEW[I]}" && -n "$${OLD[I]}" ]]; then \ + DIFF=$$(($${NEW[I]} - $${OLD[I]})); \ + if [[ "$${DIFF}" -gt 0 ]]; then echo -ne "$${RED}"; fi; \ + if [[ "$${DIFF}" -lt 0 ]]; then echo -ne "$${GREEN}"; fi; \ + else \ + DIFF="$${RED}ERR"; \ + fi; \ + echo -ne "$${DIFF}\t$${RESET}"; \ + done; \ + echo "$${BOARD}"; \ + for I in 0 1 2 3; do echo -ne "$${OLD[I]-$${RED}ERR$${RESET}}\t"; done; echo -e "$${OLDBIN}"; \ + for I in 0 1 2 3; do echo -ne "$${NEW[I]-$${RED}ERR$${RESET}}\t"; done; echo -e "$${NEWBIN}\n"; \ + done; \ + done; -- GitLab