summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHeinrich Schuchardt <xypron.glpk@gmx.de>2019-04-02 19:19:04 +0200
committerTom Rini <trini@konsulko.com>2019-06-07 11:03:39 -0400
commitb275030e50bcf3b6c2b3d1eb05f1d4fad5317e01 (patch)
treec46c2abdaacd7a53cb135bfc97995edee4fd0622
parentdbbb1c43f26cb28b64df80b72fffbaf2801e8a30 (diff)
Makefile: reusable function for BOARD_SIZE_CHECK
Carve out function size_check from macro BOARD_SIZE_CHECK. This will allow us to reuse the function for other file size checks. Depending on the value of CONFIG_BOARD_SIZE_LIMIT an error like the following is thrown: u-boot-dtb.img exceeds file size limit: limit: 409516 bytes actual: 444346 bytes excess: 34830 bytes make: *** [Makefile:1212: u-boot-dtb.img] Error 1 Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
-rw-r--r--Makefile24
1 files changed, 14 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index 07106138e9..e3c1088623 100644
--- a/Makefile
+++ b/Makefile
@@ -337,6 +337,19 @@ endif
# KBUILD_MODULES := 1
#endif
+define size_check
+ actual=$$( wc -c $1 | awk '{print $$1}'); \
+ limit=$$( printf "%d" $2 ); \
+ if test $$actual -gt $$limit; then \
+ echo "$1 exceeds file size limit:" >&2; \
+ echo " limit: $$limit bytes" >&2; \
+ echo " actual: $$actual bytes" >&2; \
+ echo " excess: $$((actual - limit)) bytes" >&2; \
+ exit 1; \
+ fi
+endef
+export size_check
+
export KBUILD_MODULES KBUILD_BUILTIN
export KBUILD_CHECKSRC KBUILD_SRC KBUILD_EXTMOD
@@ -778,16 +791,7 @@ LDPPFLAGS += \
#########################################################################
ifneq ($(CONFIG_BOARD_SIZE_LIMIT),)
-BOARD_SIZE_CHECK = \
- @actual=`wc -c $@ | awk '{print $$1}'`; \
- limit=`printf "%d" $(CONFIG_BOARD_SIZE_LIMIT)`; \
- if test $$actual -gt $$limit; then \
- echo "$@ exceeds file size limit:" >&2 ; \
- echo " limit: $$limit bytes" >&2 ; \
- echo " actual: $$actual bytes" >&2 ; \
- echo " excess: $$((actual - limit)) bytes" >&2; \
- exit 1; \
- fi
+BOARD_SIZE_CHECK= @ $(call size_check,$@,$(CONFIG_BOARD_SIZE_LIMIT))
else
BOARD_SIZE_CHECK =
endif