diff --git a/core/binary.mk b/core/binary.mk index d923b62b3..90a215686 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -339,11 +339,16 @@ my_asflags += -D__ASSEMBLY__ ########################################################### ifndef LOCAL_IS_HOST_MODULE ifdef LOCAL_SDK_VERSION -my_target_global_c_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include) +my_target_global_c_includes := +my_target_global_c_system_includes := $(my_ndk_stl_include_path) $(my_ndk_sysroot_include) my_target_global_cppflags := $(my_ndk_stl_cppflags) else -my_target_global_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES) \ +my_target_global_c_includes := $(SRC_HEADERS) \ + $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES) \ $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_INCLUDES) +my_target_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \ + $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES) \ + $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_C_SYSTEM_INCLUDES) my_target_global_cppflags := endif # LOCAL_SDK_VERSION @@ -360,6 +365,7 @@ my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LDFLAGS) endif # my_clang $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CONLYFLAGS := $(my_target_global_conlyflags) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(my_target_global_cppflags) @@ -367,8 +373,12 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_glob else # LOCAL_IS_HOST_MODULE -my_host_global_c_includes := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \ +my_host_global_c_includes := $(SRC_HEADERS) \ + $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_INCLUDES) \ $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_INCLUDES) +my_host_global_c_system_includes := $(SRC_SYSTEM_HEADERS) \ + $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)PROJECT_SYSTEM_INCLUDES) \ + $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)C_SYSTEM_INCLUDES) ifeq ($(my_clang),true) my_host_global_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_CFLAGS) @@ -383,6 +393,7 @@ my_host_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)GLOBAL_LDFLA endif # my_clang $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_host_global_c_includes) +$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_host_global_c_system_includes) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CFLAGS := $(my_host_global_cflags) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CONLYFLAGS := $(my_host_global_conlyflags) $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HOST_GLOBAL_CPPFLAGS := $(my_host_global_cppflags) diff --git a/core/config.mk b/core/config.mk index 915877e2d..02505168b 100644 --- a/core/config.mk +++ b/core/config.mk @@ -44,17 +44,17 @@ endif # TODO: Enforce some kind of layering; only add include paths # when a module links against a particular library. # TODO: See if we can remove most of these from the global list. -SRC_HEADERS := \ - $(TOPDIR)system/core/include \ - $(TOPDIR)system/media/audio/include \ - $(TOPDIR)hardware/libhardware/include \ - $(TOPDIR)hardware/libhardware_legacy/include \ - $(TOPDIR)hardware/ril/include \ - $(TOPDIR)libnativehelper/include \ - $(TOPDIR)frameworks/native/include \ - $(TOPDIR)frameworks/native/opengl/include \ - $(TOPDIR)frameworks/av/include \ - $(TOPDIR)frameworks/base/include +SRC_SYSTEM_HEADERS := \ + $(wildcard system/core/include) \ + $(wildcard system/media/audio/include) \ + $(wildcard hardware/libhardware/include) \ + $(wildcard hardware/libhardware_legacy/include) \ + $(wildcard hardware/ril/include) \ + $(wildcard libnativehelper/include) \ + $(wildcard frameworks/native/include) \ + $(wildcard frameworks/native/opengl/include) \ + $(wildcard frameworks/av/include) \ + $(wildcard frameworks/base/include) SRC_TARGET_DIR := $(TOPDIR)build/target SRC_API_DIR := $(TOPDIR)prebuilts/sdk/api SRC_SYSTEM_API_DIR := $(TOPDIR)prebuilts/sdk/system-api @@ -676,28 +676,34 @@ endif HOST_GLOBAL_LD_DIRS := -L$(HOST_OUT_INTERMEDIATE_LIBRARIES) TARGET_GLOBAL_LD_DIRS := -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES) -HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(HOST_OUT_HEADERS) -TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \ +HOST_PROJECT_INCLUDES := +HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_OUT_HEADERS) +TARGET_PROJECT_INCLUDES := +TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_OUT_HEADERS) \ $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \ $(TARGET_PRODUCT_KERNEL_HEADERS) ifdef TARGET_2ND_ARCH $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS := -L$($(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_INTERMEDIATE_LIBRARIES) $(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_INCLUDES := $(TARGET_PROJECT_INCLUDES) +$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_PROJECT_SYSTEM_INCLUDES := $(TARGET_PROJECT_SYSTEM_INCLUDES) endif ifdef HOST_2ND_ARCH $(HOST_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_LD_DIRS := -L$($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_INTERMEDIATE_LIBRARIES) $(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_INCLUDES := $(HOST_PROJECT_INCLUDES) +$(HOST_2ND_ARCH_VAR_PREFIX)HOST_PROJECT_SYSTEM_INCLUDES := $(HOST_PROJECT_SYSTEM_INCLUDES) endif ifdef HOST_CROSS_OS HOST_CROSS_GLOBAL_LD_DIRS := -L$(HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES) -HOST_CROSS_PROJECT_INCLUDES:= $(SRC_HEADERS) $(HOST_CROSS_OUT_HEADERS) +HOST_CROSS_PROJECT_INCLUDES := +HOST_CROSS_PROJECT_SYSTEM_INCLUDES := $(HOST_CROSS_OUT_HEADERS) ifdef HOST_CROSS_2ND_ARCH $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_GLOBAL_LD_DIRS := -L$($(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_OUT_INTERMEDIATE_LIBRARIES) $(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_INCLUDES:= $(HOST_CROSS_PROJECT_INCLUDES) +$(HOST_CROSS_2ND_ARCH_VAR_PREFIX)HOST_CROSS_PROJECT_SYSTEM_INCLUDES:= $(HOST_CROSS_PROJECT_SYSTEM_INCLUDES) endif endif diff --git a/core/definitions.mk b/core/definitions.mk index 52a54baec..914cb7b4c 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -1199,9 +1199,12 @@ define c-includes $(addprefix -I , $(PRIVATE_C_INCLUDES)) \ $$(cat $(PRIVATE_IMPORT_INCLUDES))\ $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),,\ + $(addprefix -I ,\ + $(filter-out $(PRIVATE_C_INCLUDES), \ + $(PRIVATE_GLOBAL_C_INCLUDES))) \ $(addprefix -isystem ,\ $(filter-out $(PRIVATE_C_INCLUDES), \ - $(PRIVATE_GLOBAL_C_INCLUDES)))) + $(PRIVATE_GLOBAL_C_SYSTEM_INCLUDES)))) endef ###########################################################