linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / scripts / Makefile.lib
index 2cb4935..550798f 100644 (file)
@@ -99,6 +99,11 @@ __a_flags    = $(_a_flags)
 __cpp_flags     = $(_cpp_flags)
 else
 
+# Prefix -I with $(srctree) if it is not an absolute path
+addtree = $(if $(filter-out -I/%,$(1)),$(patsubst -I%,-I$(srctree)/%,$(1))) $(1)
+# Find all -I options and call addtree
+flags = $(foreach o,$($(1)),$(if $(filter -I%,$(o)),$(call addtree,$(o)),$(o)))
+
 # -I$(obj) locates generated .h files
 # $(call addtree,-I$(obj)) locates .h files in srctree, from generated .c files
 #   and locates generated .h files