kbuild: make cc-version available in kbuild files
[linux-3.10.git] / scripts / Makefile.build
index 8f4f5a3..2737765 100644 (file)
@@ -10,11 +10,12 @@ __build:
 # Read .config if it exist, otherwise ignore
 -include .config
 
+include scripts/Kbuild.include
+
 # The filename Kbuild has precedence over Makefile
-include $(if $(wildcard $(srctree)/$(src)/Kbuild), \
-                        $(srctree)/$(src)/Kbuild, $(srctree)/$(src)/Makefile)
+kbuild-dir := $(if $(filter /%,$(src)),$(src),$(srctree)/$(src))
+include $(if $(wildcard $(kbuild-dir)/Kbuild), $(kbuild-dir)/Kbuild, $(kbuild-dir)/Makefile)
 
-include scripts/Kbuild.include
 include scripts/Makefile.lib
 
 ifdef host-progs
@@ -179,10 +180,10 @@ endif
 define rule_cc_o_c
        $(if $($(quiet)cmd_checksrc),echo '  $($(quiet)cmd_checksrc)';)   \
        $(cmd_checksrc)                                                   \
-       $(if $($(quiet)cmd_cc_o_c),echo '  $(subst ','\'',$($(quiet)cmd_cc_o_c))';)  \
+       $(if $($(quiet)cmd_cc_o_c),echo '  $(call escsq,$($(quiet)cmd_cc_o_c))';)  \
        $(cmd_cc_o_c);                                                    \
        $(cmd_modversions)                                                \
-       scripts/basic/fixdep $(depfile) $@ '$(subst ','\'',$(cmd_cc_o_c))' > $(@D)/.$(@F).tmp;  \
+       scripts/basic/fixdep $(depfile) $@ '$(call escsq,$(cmd_cc_o_c))' > $(@D)/.$(@F).tmp;  \
        rm -f $(depfile);                                                 \
        mv -f $(@D)/.$(@F).tmp $(@D)/.$(@F).cmd
 endef