kbuild: fix a bug in regeneration of linker scripts
authorMasahiro Yamada <yamada.m@jp.panasonic.com>
Wed, 9 Apr 2014 11:10:43 +0000 (20:10 +0900)
committerTom Rini <trini@ti.com>
Fri, 11 Apr 2014 14:08:42 +0000 (10:08 -0400)
In some use cases, SPL linker script was not updated even when
it should be.

For instance,

  $ make tricoder_config all
    [ build complete ]
  ... modify include/configs/tricoder.h
  $ make

spl/u-boot-spl.lds should be updated in this case, but it wasn't.

To fix this problem, linker scripts generation should be handled
by $(call if_changed_dep,...) rather than by $(call if_changed,...).

Signed-off-by: Masahiro Yamada <yamada.m@jp.panasonic.com>
Reported-by: Andreas Bießmann <andreas.devel@googlemail.com>
Tested-by: Andreas Bießmann <andreas.devel@googlemail.com>
Makefile
spl/Makefile

index b807e5cd5c80351e6f5704904a29cdd49192f20a..b2937e95e1ba15b2c42889db7dfd7a81e64302dc 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1053,11 +1053,11 @@ depend dep:
 
 # ---------------------------------------------------------------------------
 quiet_cmd_cpp_lds = LDS     $@
-cmd_cpp_lds = $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ \
-               -x assembler-with-cpp -P -o $@ $<
+cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
+               -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $<
 
 u-boot.lds: $(LDSCRIPT) prepare FORCE
-       $(call if_changed,cpp_lds)
+       $(call if_changed_dep,cpp_lds)
 
 PHONY += nand_spl
 nand_spl: prepare
index 9f5dbf4f3bfbf70523ccd24ab7b9c0c92f5d93f9..6fec2522a8c90f3598237f46b7592a0fef8ab206 100644 (file)
@@ -231,11 +231,11 @@ $(u-boot-spl-dirs):
        $(Q)$(MAKE) $(build)=$@
 
 quiet_cmd_cpp_lds = LDS     $@
-cmd_cpp_lds = $(CPP) $(cpp_flags) $(LDPPFLAGS) -ansi -D__ASSEMBLY__ \
-               -x assembler-with-cpp -P -o $@ $<
+cmd_cpp_lds = $(CPP) -Wp,-MD,$(depfile) $(cpp_flags) $(LDPPFLAGS) -ansi \
+               -D__ASSEMBLY__ -x assembler-with-cpp -P -o $@ $<
 
 $(obj)/u-boot-spl.lds: $(LDSCRIPT) FORCE
-       $(call if_changed,cpp_lds)
+       $(call if_changed_dep,cpp_lds)
 
 # read all saved command lines