From patchwork Mon Feb 24 02:12:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Masahiro Yamada X-Patchwork-Id: 323420 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id C340D2C00BA for ; Mon, 24 Feb 2014 13:13:11 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 46A454B60C; Mon, 24 Feb 2014 03:13:10 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id eoV6kzyZU6yp; Mon, 24 Feb 2014 03:13:10 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8B8124B60F; Mon, 24 Feb 2014 03:12:44 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 7974F4B5EC for ; Mon, 24 Feb 2014 03:12:41 +0100 (CET) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id pdML-sCr2fvB for ; Mon, 24 Feb 2014 03:12:37 +0100 (CET) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from smtp.mei.co.jp (smtp.mei.co.jp [133.183.100.20]) by theia.denx.de (Postfix) with ESMTP id 1B69A4B5D2 for ; Mon, 24 Feb 2014 03:12:33 +0100 (CET) Received: from mail-gw.jp.panasonic.com ([157.8.1.157]) by smtp.mei.co.jp (8.12.11.20060614/3.7W/kc-maile12) with ESMTP id s1O2CQ5P006593; Mon, 24 Feb 2014 11:12:26 +0900 (JST) Received: from epochmail.jp.panasonic.com ([157.8.1.130]) by mail.jp.panasonic.com (8.11.6p2/3.7W/kc-maili13) with ESMTP id s1O2CQJ06516; Mon, 24 Feb 2014 11:12:26 +0900 Received: by epochmail.jp.panasonic.com (8.12.11.20060308/3.7W/lomi17) id s1O2CQ3X007914; Mon, 24 Feb 2014 11:12:26 +0900 Received: from poodle by lomi17.jp.panasonic.com (8.12.11.20060308/3.7W) with ESMTP id s1O2CQFr007843; Mon, 24 Feb 2014 11:12:26 +0900 Received: from beagle.diag.org (beagle.diag.org [10.184.179.16]) by poodle (Postfix) with ESMTP id 4E4EB2743A5E; Mon, 24 Feb 2014 11:12:26 +0900 (JST) From: Masahiro Yamada To: u-boot@lists.denx.de Date: Mon, 24 Feb 2014 11:12:14 +0900 Message-Id: <1393207943-3725-7-git-send-email-yamada.m@jp.panasonic.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1393207943-3725-1-git-send-email-yamada.m@jp.panasonic.com> References: <1393207943-3725-1-git-send-email-yamada.m@jp.panasonic.com> Cc: Tom Rini Subject: [U-Boot] [PATCH v2 06/15] kbuild: use shorten logs objcopy rules X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de Signed-off-by: Masahiro Yamada --- Changes in v2: None Makefile | 41 +++++++++++++++++++++++++++++------------ examples/api/Makefile | 6 ++++-- examples/standalone/Makefile | 10 ++++++---- spl/Makefile | 19 +++++++++++++++++-- 4 files changed, 56 insertions(+), 20 deletions(-) diff --git a/Makefile b/Makefile index 05292ad..7a179cd 100644 --- a/Makefile +++ b/Makefile @@ -743,6 +743,9 @@ ifneq ($(CONFIG_SYS_TEXT_BASE),) LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE) endif +quiet_cmd_objcopy = OBJCOPY $@ +cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ + all: $(ALL-y) PHONY += dtbs @@ -752,27 +755,31 @@ dtbs dts/dt.dtb: checkdtc u-boot u-boot-dtb.bin: u-boot.bin dts/dt.dtb cat $^ >$@ -u-boot.hex: u-boot - $(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $< $@ +OBJCOPYFLAGS_u-boot.hex := -O ihex -u-boot.srec: u-boot - $(OBJCOPY) $(OBJCOPYFLAGS) -O srec $< $@ +OBJCOPYFLAGS_u-boot.srec := -O srec -u-boot.bin: u-boot - $(OBJCOPY) $(OBJCOPYFLAGS) -O binary $< $@ - $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) - $(BOARD_SIZE_CHECK) +u-boot.hex u-boot.srec: u-boot FORCE + $(call if_changed,objcopy) + +OBJCOPYFLAGS_u-boot.bin := -O binary + +u-boot.bin: u-boot FORCE + $(call if_changed,objcopy) + $(call DO_STATIC_RELA,$<,$@,$(CONFIG_SYS_TEXT_BASE)) + $(BOARD_SIZE_CHECK) u-boot.ldr: u-boot $(CREATE_LDR_ENV) $(LDR) -T $(CONFIG_BFIN_CPU) -c $@ $< $(LDR_FLAGS) $(BOARD_SIZE_CHECK) -u-boot.ldr.hex: u-boot.ldr - $(OBJCOPY) $(OBJCOPYFLAGS) -O ihex $< $@ -I binary +OBJCOPYFLAGS_u-boot.ldr.hex := -I binary -O ihex + +OBJCOPYFLAGS_u-boot.ldr.srec := -I binary -O srec -u-boot.ldr.srec: u-boot.ldr - $(OBJCOPY) $(OBJCOPYFLAGS) -O srec $< $@ -I binary +u-boot.ldr.hex u-boot.ldr.srec: u-boot.ldr FORCE + $(call if_changed,objcopy) # # U-Boot entry point, needed for booting of full-blown U-Boot @@ -1253,6 +1260,16 @@ quiet_cmd_rmdirs = $(if $(wildcard $(rm-dirs)),CLEAN $(wildcard $(rm-dirs))) quiet_cmd_rmfiles = $(if $(wildcard $(rm-files)),CLEAN $(wildcard $(rm-files))) cmd_rmfiles = rm -f $(rm-files) +# read all saved command lines + +targets := $(wildcard $(sort $(targets))) +cmd_files := $(wildcard .*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) + +ifneq ($(cmd_files),) + $(cmd_files): ; # Do not try to update included dependency files + include $(cmd_files) +endif + # Shorthand for $(Q)$(MAKE) -f scripts/Makefile.clean obj=dir # Usage: # $(Q)$(MAKE) $(clean)=dir diff --git a/examples/api/Makefile b/examples/api/Makefile index 09475f8..6c19830 100644 --- a/examples/api/Makefile +++ b/examples/api/Makefile @@ -40,8 +40,10 @@ OBJS += $(addprefix $(obj)/,$(notdir $(EXT_SOBJ_FILES-y))) $(obj)/demo: $(OBJS) $(LD) --gc-sections -Ttext $(LOAD_ADDR) -o $@ $^ $(PLATFORM_LIBS) -$(obj)/demo.bin: $(obj)/demo - $(OBJCOPY) -O binary $< $@ 2>/dev/null +# demo.bin is never genrated. Is this necessary? +OBJCOPYFLAGS_demo.bin := -O binary +$(obj)/demo.bin: $(obj)/demo FORCE + $(call if_changed,objcopy) # Rule to build generic library C files $(addprefix $(obj)/,$(notdir $(EXT_COBJ_FILES-y))): $(obj)/%.o: $(SRCTREE)/lib/%.c FORCE diff --git a/examples/standalone/Makefile b/examples/standalone/Makefile index 47c9d54..5f61043 100644 --- a/examples/standalone/Makefile +++ b/examples/standalone/Makefile @@ -72,8 +72,10 @@ $(obj)/%: $(obj)/%.o $(LIB) -o $@ -e $(SYM_PREFIX)$(notdir $(<:.o=)) $< $(LIB) \ -L$(gcclibdir) -lgcc -$(obj)/%.srec: $(obj)/% - $(OBJCOPY) -O srec $< $@ 2>/dev/null +$(obj)/%.srec: OBJCOPYFLAGS := -O srec +$(obj)/%.srec: $(obj)/% FORCE + $(call if_changed,objcopy) -$(obj)/%.bin: $(obj)/% - $(OBJCOPY) -O binary $< $@ 2>/dev/null +$(obj)/%.bin: OBJCOPYFLAGS := -O binary +$(obj)/%.bin: $(obj)/% FORCE + $(call if_changed,objcopy) diff --git a/spl/Makefile b/spl/Makefile index 02312ce..bcb70df 100644 --- a/spl/Makefile +++ b/spl/Makefile @@ -199,8 +199,13 @@ $(obj)/$(BOARD)-spl.bin: $(obj)/u-boot-spl.bin $(OBJTREE)/tools/mkexynosspl) $(VAR_SIZE_PARAM) $< $@ endif -$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN) - $(OBJCOPY) $(OBJCOPYFLAGS) $(SPL_OBJCFLAGS) -O binary $< $@ +quiet_cmd_objcopy = OBJCOPY $@ +cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@ + +OBJCOPYFLAGS_$(SPL_BIN).bin = $(SPL_OBJCFLAGS) -O binary + +$(obj)/$(SPL_BIN).bin: $(obj)/$(SPL_BIN) FORCE + $(call if_changed,objcopy) LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL) ifneq ($(CONFIG_SPL_TEXT_BASE),) @@ -228,6 +233,16 @@ cpp_flags := $(KBUILD_CPPFLAGS) $(CPPFLAGS) $(UBOOTINCLUDE) $(NOSTDINC_FLAGS) $(obj)/u-boot-spl.lds: $(LDSCRIPT) FORCE $(CPP) $(cpp_flags) $(LDPPFLAGS) -I$(obj). -ansi -D__ASSEMBLY__ -P - < $< > $@ +# read all saved command lines + +targets := $(wildcard $(sort $(targets))) +cmd_files := $(wildcard $(obj)/.*.cmd $(foreach f,$(targets),$(dir $(f)).$(notdir $(f)).cmd)) + +ifneq ($(cmd_files),) + $(cmd_files): ; # Do not try to update included dependency files + include $(cmd_files) +endif + PHONY += FORCE FORCE: