forked from openkylin/platform_build
Build system support to export include paths
Bug: 5573756 With this change, we can set LOCAL_EXPORT_C_INCLUDE_DIRS in the module definition to export include dir paths. Paths in LOCAL_EXPORT_C_INCLUDE_DIRS should be relative to the top dir of the source tree. If a library (shared or static) exports some include paths, any module using it will import the include paths and add them to the compiler command line. Change-Id: I49aabc589d2cf214044d13ccd5532ef68209adf0
This commit is contained in:
parent
1985846eb0
commit
5f074803fb
|
@ -467,6 +467,26 @@ endif
|
|||
asm_objects := $(asm_objects_S) $(asm_objects_s)
|
||||
|
||||
|
||||
####################################################
|
||||
## Import includes
|
||||
####################################################
|
||||
import_includes := $(intermediates)/import_includes
|
||||
import_includes_deps := $(strip \
|
||||
$(foreach l, $(installed_shared_library_module_names), \
|
||||
$(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes) \
|
||||
$(foreach l, $(LOCAL_STATIC_LIBRARIES) $(LOCAL_WHOLE_STATIC_LIBRARIES), \
|
||||
$(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE))/export_includes))
|
||||
$(import_includes) : $(import_includes_deps)
|
||||
@echo Import includes file: $@
|
||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
||||
ifdef import_includes_deps
|
||||
$(hide) for f in $^; do \
|
||||
cat $$f >> $@; \
|
||||
done
|
||||
else
|
||||
$(hide) touch $@
|
||||
endif
|
||||
|
||||
###########################################################
|
||||
## Common object handling.
|
||||
###########################################################
|
||||
|
@ -492,7 +512,7 @@ ifndef LOCAL_NDK_VERSION
|
|||
LOCAL_C_INCLUDES += $(JNI_H_INCLUDE)
|
||||
endif
|
||||
|
||||
$(all_objects) : | $(LOCAL_GENERATED_SOURCES)
|
||||
$(all_objects) : | $(LOCAL_GENERATED_SOURCES) $(import_includes)
|
||||
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
|
||||
|
||||
###########################################################
|
||||
|
@ -592,6 +612,7 @@ $(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CPPFLAGS := $(LOCAL_CPPFLAGS)
|
|||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(LOCAL_C_INCLUDES)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(LOCAL_LDFLAGS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(LOCAL_LDLIBS)
|
||||
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_NO_CRT := $(LOCAL_NO_CRT)
|
||||
|
@ -616,3 +637,19 @@ all_libraries := \
|
|||
# are linked into this module. This will force them to be installed
|
||||
# when this module is.
|
||||
$(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
|
||||
|
||||
###########################################################
|
||||
# Export includes
|
||||
###########################################################
|
||||
export_includes := $(intermediates)/export_includes
|
||||
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS)
|
||||
$(export_includes) :
|
||||
@echo Export includes file: $< -- $@
|
||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
||||
ifdef LOCAL_EXPORT_C_INCLUDE_DIRS
|
||||
$(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \
|
||||
echo "-I $$d" >> $@; \
|
||||
done
|
||||
else
|
||||
$(hide) touch $@
|
||||
endif
|
||||
|
|
|
@ -44,6 +44,7 @@ LOCAL_CFLAGS:=
|
|||
LOCAL_CPPFLAGS:=
|
||||
LOCAL_RTTI_FLAG:=
|
||||
LOCAL_C_INCLUDES:=
|
||||
LOCAL_EXPORT_C_INCLUDE_DIRS:=
|
||||
LOCAL_LDFLAGS:=
|
||||
LOCAL_LDLIBS:=
|
||||
LOCAL_AAPT_FLAGS:=
|
||||
|
|
|
@ -875,6 +875,7 @@ define transform-cpp-to-o
|
|||
@echo "target $(PRIVATE_ARM_MODE) C++: $(PRIVATE_MODULE) <= $<"
|
||||
$(hide) $(PRIVATE_CXX) \
|
||||
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
|
||||
@$(PRIVATE_IMPORT_INCLUDES) \
|
||||
$(addprefix -isystem ,\
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(filter-out $(PRIVATE_C_INCLUDES), \
|
||||
|
@ -904,6 +905,7 @@ define transform-c-or-s-to-o-no-deps
|
|||
@mkdir -p $(dir $@)
|
||||
$(hide) $(PRIVATE_CC) \
|
||||
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
|
||||
@$(PRIVATE_IMPORT_INCLUDES) \
|
||||
$(addprefix -isystem ,\
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(filter-out $(PRIVATE_C_INCLUDES), \
|
||||
|
@ -965,6 +967,7 @@ define transform-host-cpp-to-o
|
|||
@echo "host C++: $(PRIVATE_MODULE) <= $<"
|
||||
$(hide) $(PRIVATE_CXX) \
|
||||
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
|
||||
@$(PRIVATE_IMPORT_INCLUDES) \
|
||||
$(addprefix -isystem ,\
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(filter-out $(PRIVATE_C_INCLUDES), \
|
||||
|
@ -992,6 +995,7 @@ define transform-host-c-or-s-to-o-no-deps
|
|||
@mkdir -p $(dir $@)
|
||||
$(hide) $(PRIVATE_CC) \
|
||||
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
|
||||
@$(PRIVATE_IMPORT_INCLUDES) \
|
||||
$(addprefix -isystem ,\
|
||||
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
|
||||
$(filter-out $(PRIVATE_C_INCLUDES), \
|
||||
|
|
|
@ -18,6 +18,9 @@ endif
|
|||
ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
|
||||
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
|
||||
endif
|
||||
ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
|
||||
$(error $(LOCAL_PATH): Can not set module stem for a library)
|
||||
endif
|
||||
|
||||
# Put the built modules of all shared libraries in a common directory
|
||||
# to simplify the link line.
|
||||
|
|
|
@ -13,6 +13,9 @@ endif
|
|||
ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
|
||||
LOCAL_MODULE_SUFFIX := .a
|
||||
endif
|
||||
ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
|
||||
$(error $(LOCAL_PATH): Can not set module stem for a library)
|
||||
endif
|
||||
LOCAL_UNINSTALLABLE_MODULE := true
|
||||
|
||||
LOCAL_IS_HOST_MODULE := true
|
||||
|
|
|
@ -84,7 +84,6 @@ GRANDFATHERED_ALL_PREBUILT := \
|
|||
libGLESv1_CM_tegra.so \
|
||||
libGLESv2_POWERVR_SGX530_121.so \
|
||||
libGLESv2_tegra.so \
|
||||
libmdmctrl.a \
|
||||
libmoto_ril.so \
|
||||
libpppd_plugin-ril.so \
|
||||
libril_rds.so \
|
||||
|
|
|
@ -27,6 +27,14 @@ ifeq (SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS))
|
|||
OVERRIDE_BUILT_MODULE_PATH := $($(my_prefix)OUT_INTERMEDIATE_LIBRARIES)
|
||||
endif
|
||||
|
||||
# Deal with the OSX library timestamp issue when installing
|
||||
# a prebuilt simulator library.
|
||||
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
|
||||
prebuilt_module_is_a_library := true
|
||||
else
|
||||
prebuilt_module_is_a_library :=
|
||||
endif
|
||||
|
||||
ifeq ($(LOCAL_STRIP_MODULE),true)
|
||||
ifdef LOCAL_IS_HOST_MODULE
|
||||
$(error Cannot strip host module LOCAL_PATH=$(LOCAL_PATH))
|
||||
|
@ -42,14 +50,13 @@ ifeq ($(LOCAL_STRIP_MODULE),true)
|
|||
else
|
||||
include $(BUILD_SYSTEM)/base_rules.mk
|
||||
built_module := $(LOCAL_BUILT_MODULE)
|
||||
endif
|
||||
|
||||
# Deal with the OSX library timestamp issue when installing
|
||||
# a prebuilt simulator library.
|
||||
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
|
||||
prebuilt_module_is_a_library := true
|
||||
else
|
||||
prebuilt_module_is_a_library :=
|
||||
ifdef prebuilt_module_is_a_library
|
||||
# Create a dummy export_includes.
|
||||
$(intermediates)/export_includes:
|
||||
$(hide) mkdir -p $(dir $@) && rm -f $@
|
||||
$(hide) touch $@
|
||||
endif
|
||||
endif
|
||||
|
||||
PACKAGES.$(LOCAL_MODULE).OVERRIDES := $(strip $(LOCAL_OVERRIDES_PACKAGES))
|
||||
|
@ -115,6 +122,13 @@ $(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
|
|||
else
|
||||
$(built_module) : $(LOCAL_PATH)/$(LOCAL_SRC_FILES) | $(ACP)
|
||||
$(transform-prebuilt-to-target)
|
||||
ifneq ($(prebuilt_module_is_a_library),)
|
||||
ifneq ($(LOCAL_IS_HOST_MODULE),)
|
||||
$(transform-host-ranlib-copy-hack)
|
||||
else
|
||||
$(transform-ranlib-copy-hack)
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -135,11 +149,3 @@ $(common_javalib_jar) : $(common_classes_jar) | $(ACP)
|
|||
# make sure the classes.jar and javalib.jar are built before $(LOCAL_BUILT_MODULE)
|
||||
$(built_module) : $(common_javalib_jar)
|
||||
endif # TARGET JAVA_LIBRARIES
|
||||
|
||||
ifneq ($(prebuilt_module_is_a_library),)
|
||||
ifneq ($(LOCAL_IS_HOST_MODULE),)
|
||||
$(transform-host-ranlib-copy-hack)
|
||||
else
|
||||
$(transform-ranlib-copy-hack)
|
||||
endif
|
||||
endif
|
||||
|
|
|
@ -16,6 +16,9 @@ endif
|
|||
ifneq ($(strip $(OVERRIDE_BUILT_MODULE_PATH)),)
|
||||
$(error $(LOCAL_PATH): Illegal use of OVERRIDE_BUILT_MODULE_PATH)
|
||||
endif
|
||||
ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
|
||||
$(error $(LOCAL_PATH): Can not set module stem for a library)
|
||||
endif
|
||||
|
||||
# Put the built targets of all shared libraries in a common directory
|
||||
# to simplify the link line.
|
||||
|
|
|
@ -14,6 +14,9 @@ ifeq ($(strip $(LOCAL_MODULE_SUFFIX)),)
|
|||
LOCAL_MODULE_SUFFIX := .a
|
||||
endif
|
||||
LOCAL_UNINSTALLABLE_MODULE := true
|
||||
ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
|
||||
$(error $(LOCAL_PATH): Can not set module stem for a library)
|
||||
endif
|
||||
|
||||
include $(BUILD_SYSTEM)/binary.mk
|
||||
|
||||
|
|
Loading…
Reference in New Issue