Improve checks for include dirs outside the source tree
See the Changes.md addition for more details.
Test: treehugger (build_test on downstream branches)
Change-Id: I6ad6b454a6fccf93772fda26cfc7dd6bbfc07c40
diff --git a/core/binary.mk b/core/binary.mk
index 568766f..76fbc95 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -1289,9 +1289,13 @@
my_c_includes := $(foreach inc,$(my_c_includes),$(call clean-path,$(inc)))
-my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes)))
+my_outside_includes := $(filter-out $(OUT_DIR)/%,$(filter /%,$(my_c_includes)) $(filter ../%,$(my_c_includes)))
ifneq ($(my_outside_includes),)
-$(error $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ ifeq ($(BUILD_BROKEN_OUTSIDE_INCLUDE_DIRS),true)
+ $(call pretty-warning,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ else
+ $(call pretty-error,C_INCLUDES must be under the source or output directories: $(my_outside_includes))
+ endif
endif
# all_objects includes gen_o_objects which were part of LOCAL_GENERATED_SOURCES;