From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from mail-pa0-x235.google.com ([2607:f8b0:400e:c03::235]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Yq543-0007qA-0U for barebox@lists.infradead.org; Wed, 06 May 2015 19:33:07 +0000 Received: by pacyx8 with SMTP id yx8so17970778pac.1 for ; Wed, 06 May 2015 12:32:41 -0700 (PDT) From: Andrey Smirnov Date: Wed, 6 May 2015 12:32:04 -0700 Message-Id: <1430940733-4415-10-git-send-email-andrew.smirnov@gmail.com> In-Reply-To: <1430940733-4415-1-git-send-email-andrew.smirnov@gmail.com> References: <1430940733-4415-1-git-send-email-andrew.smirnov@gmail.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "barebox" Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: [PATCH v3 09/18] Makefile.lib: Make 'check_file_size' more flexible To: barebox@lists.infradead.org Cc: Andrey Smirnov Make 'check_file_size' more flexible by not hardcoding the file whose size is going to be checked to '$@'. This way it is possible to use this subroutine to check the size of files other than the target of the rule. Signed-off-by: Andrey Smirnov --- Makefile | 2 +- arch/arm/pbl/Makefile | 2 +- arch/mips/pbl/Makefile | 2 +- scripts/Makefile.lib | 6 +++--- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index 372d18a..9ed0a1d 100644 --- a/Makefile +++ b/Makefile @@ -700,7 +700,7 @@ OBJCOPYFLAGS_barebox.bin = -O binary barebox.bin: barebox FORCE $(call if_changed,objcopy) ifndef CONFIG_PBL_IMAGE - $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) + $(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) endif # By default the uImage load address is 2MB below CONFIG_TEXT_BASE, diff --git a/arch/arm/pbl/Makefile b/arch/arm/pbl/Makefile index 4c1788d..1ff39db 100644 --- a/arch/arm/pbl/Makefile +++ b/arch/arm/pbl/Makefile @@ -22,7 +22,7 @@ endif $(obj)/zbarebox.bin: $(obj)/zbarebox FORCE $(call if_changed,objcopy) - $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) + $(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) $(Q)$(kecho) ' Barebox: fix size' $(Q)$(objtree)/scripts/fix_size -i -f $(objtree)/$@ $(FIX_SIZE) $(Q)$(kecho) ' Barebox: $@ is ready' diff --git a/arch/mips/pbl/Makefile b/arch/mips/pbl/Makefile index fea1f24..b03bca1 100644 --- a/arch/mips/pbl/Makefile +++ b/arch/mips/pbl/Makefile @@ -15,7 +15,7 @@ extra-y += piggy.gzip piggy.lz4 piggy.lzo piggy.lzma piggy.xzkern piggy.sh $(obj)/zbarebox.bin: $(obj)/zbarebox FORCE $(call if_changed,objcopy) - $(call cmd,check_file_size,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) + $(call cmd,check_file_size,$@,$(CONFIG_BAREBOX_MAX_IMAGE_SIZE)) $(Q)$(kecho) ' Barebox: $@ is ready' $(obj)/zbarebox.S: $(obj)/zbarebox FORCE diff --git a/scripts/Makefile.lib b/scripts/Makefile.lib index 57426d0..e991f33 100644 --- a/scripts/Makefile.lib +++ b/scripts/Makefile.lib @@ -388,10 +388,10 @@ quiet_cmd_ln = LN $@ cmd_ln = ln -sf $< $@ # Check size of a file -quiet_cmd_check_file_size = CHKSIZE $@ +quiet_cmd_check_file_size = CHKSIZE $2 cmd_check_file_size = set -e; \ - size=`stat -c%s $@`; \ - max_size=`printf "%d" $2`; \ + size=`stat -c%s $2`; \ + max_size=`printf "%d" $3`; \ if [ $$size -gt $$max_size ] ; \ then \ echo "$@ size $$size > of the maximum size $$max_size" >&2; \ -- 2.1.4 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox