]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - Makefile
Merge branch 'master' of git://git.denx.de/u-boot-coldfire
[karo-tx-uboot.git] / Makefile
index fffc188f9ac023f42c3ec7c612a98a5e1e35fefa..c30f90af8cff5a1490b36fd4132f229f25895e69 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -936,8 +936,19 @@ u-boot.sha1:       u-boot.bin
 u-boot.dis:    u-boot
                $(OBJDUMP) -d $< > $@
 
+# If .u-boot.cfg.d is still present, then either:
+# a) The previous build used a Makefile that used if_changed rather than
+#    if_changed_dep when building u-boot.cfg, and hence any later builds will
+#    be unaware of the dependencies for u-boot.cfg. In this case, we must
+#    delete u-boot.cfg to force it and .u-boot.cfg.cmd to be rebuilt the
+#    correct way.
+# b) The previous build failed or was interrupted while building u-boot.cfg,
+#    so deleting u-boot.cfg isn't going to cause any additional work.
+ifneq ($(wildcard $(obj)/.u-boot.cfg.d),)
+  unused := $(shell rm -f $(obj)/u-boot.cfg)
+endif
 u-boot.cfg:    include/config.h FORCE
-       $(call if_changed,cpp_cfg)
+       $(call if_changed_dep,cpp_cfg)
 
 # Check that this build does not use CONFIG options that we don't know about
 # unless they are in Kconfig. All the existing CONFIG options are whitelisted,