kbuild: fix make O=...
kbuild failed to locate Kbuild.include.
Teach kbuild how to find Kbuild files when using make O=...
Signed-off-by: Sam Ravnborg <sam@ravnborg.org>
---
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index ebed6a4..8f4f5a3 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -10,7 +10,9 @@
# Read .config if it exist, otherwise ignore
-include .config
-include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+# The filename Kbuild has precedence over Makefile
+include $(if $(wildcard $(srctree)/$(src)/Kbuild), \
+ $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile)
include scripts/Kbuild.include
include scripts/Makefile.lib
diff --git a/scripts/Makefile.clean b/scripts/Makefile.clean
index ff3e87d..9c978b7 100644
--- a/scripts/Makefile.clean
+++ b/scripts/Makefile.clean
@@ -7,7 +7,9 @@
.PHONY: __clean
__clean:
-include $(if $(wildcard $(obj)/Kbuild), $(obj)/Kbuild, $(obj)/Makefile)
+# The filename Kbuild has precedence over Makefile
+include $(if $(wildcard $(srctree)/$(src)/Kbuild), \
+ $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile)
# Figure out what we need to build from the various variables
# ==========================================================================