LDFLAGS_u-boot += -Ttext $(CONFIG_SYS_TEXT_BASE)
endif
+quiet_cmd_objcopy = OBJCOPY $@
+cmd_objcopy = $(OBJCOPY) $(OBJCOPYFLAGS) $(OBJCOPYFLAGS_$(@F)) $< $@
+
all: $(ALL-y)
PHONY += dtbs
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
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
$(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
-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)
$(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),)
$(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: