kbuild: add kbuild-file macro
[linux-2.6-block.git] / scripts / Kbuild.include
index 2bc08ace38a3b56a0bf95d3fd2b739c406d9dd3a..cbe28744637b72c3b7a26c09ed93a7d82e4c038c 100644 (file)
@@ -40,6 +40,11 @@ escsq = $(subst $(squote),'\$(squote)',$1)
 # Quote a string to pass it to C files. foo => '"foo"'
 stringify = $(squote)$(quote)$1$(quote)$(squote)
 
+###
+# The path to Kbuild or Makefile. Kbuild has precedence over Makefile.
+kbuild-dir = $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
+kbuild-file = $(or $(wildcard $(kbuild-dir)/Kbuild),$(kbuild-dir)/Makefile)
+
 ###
 # Easy method for doing a status message
        kecho := :