Merge "Add LOCAL_EXPORT_CFLAGS for Soong" am: a1c1e7d02f

am: 1cc4bfaad5

Change-Id: I13abbdc51cb28f94364449cdb34ea2cb80cbc503
This commit is contained in:
Dan Willemsen 2017-04-05 05:48:03 +00:00 committed by android-build-merger
commit 0320aea2fd
3 changed files with 23 additions and 10 deletions

View File

@ -1738,7 +1738,14 @@ $(LOCAL_INSTALLED_MODULE): | $(installed_static_library_notice_file_targets)
# Export includes # Export includes
########################################################### ###########################################################
export_includes := $(intermediates)/export_includes export_includes := $(intermediates)/export_includes
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(my_export_c_include_dirs) export_cflags := $(foreach d,$(my_export_c_include_dirs),-I $(d))
# Soong exports cflags instead of include dirs, so that -isystem can be included.
ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
export_cflags += $(LOCAL_EXPORT_CFLAGS)
else ifdef LOCAL_EXPORT_CFLAGS
$(call pretty-error,LOCAL_EXPORT_CFLAGS can only be used by Soong, use LOCAL_EXPORT_C_INCLUDE_DIRS instead)
endif
$(export_includes): PRIVATE_EXPORT_CFLAGS := $(export_cflags)
# Headers exported by whole static libraries are also exported by this library. # Headers exported by whole static libraries are also exported by this library.
export_include_deps := $(strip \ export_include_deps := $(strip \
$(foreach l,$(my_whole_static_libraries), \ $(foreach l,$(my_whole_static_libraries), \
@ -1761,10 +1768,8 @@ $(export_includes): PRIVATE_REEXPORTED_INCLUDES := $(export_include_deps)
$(export_includes) : $(my_export_c_include_deps) $(my_generated_sources) $(export_include_deps) $(LOCAL_EXPORT_C_INCLUDE_DEPS) $(export_includes) : $(my_export_c_include_deps) $(my_generated_sources) $(export_include_deps) $(LOCAL_EXPORT_C_INCLUDE_DEPS)
@echo Export includes file: $< -- $@ @echo Export includes file: $< -- $@
$(hide) mkdir -p $(dir $@) && rm -f $@.tmp && touch $@.tmp $(hide) mkdir -p $(dir $@) && rm -f $@.tmp && touch $@.tmp
ifdef my_export_c_include_dirs ifdef export_cflags
$(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ $(hide) echo "$(PRIVATE_EXPORT_CFLAGS)" >>$@.tmp
echo "-I $$d" >> $@.tmp; \
done
endif endif
ifdef export_include_deps ifdef export_include_deps
$(hide) for f in $(PRIVATE_REEXPORTED_INCLUDES); do \ $(hide) for f in $(PRIVATE_REEXPORTED_INCLUDES); do \
@ -1776,6 +1781,7 @@ endif
else \ else \
mv $@.tmp $@ ; \ mv $@.tmp $@ ; \
fi fi
export_cflags :=
# Kati adds restat=1 to ninja. GNU make does nothing for this. # Kati adds restat=1 to ninja. GNU make does nothing for this.
.KATI_RESTAT: $(export_includes) .KATI_RESTAT: $(export_includes)

View File

@ -68,6 +68,7 @@ LOCAL_DROIDDOC_USE_STANDARD_DOCLET:=
LOCAL_DX_FLAGS:= LOCAL_DX_FLAGS:=
LOCAL_EMMA_COVERAGE_FILTER:= LOCAL_EMMA_COVERAGE_FILTER:=
LOCAL_EMMA_INSTRUMENT:= LOCAL_EMMA_INSTRUMENT:=
LOCAL_EXPORT_CFLAGS:=
LOCAL_EXPORT_C_INCLUDE_DEPS:= LOCAL_EXPORT_C_INCLUDE_DEPS:=
LOCAL_EXPORT_C_INCLUDE_DIRS:= LOCAL_EXPORT_C_INCLUDE_DIRS:=
LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:= LOCAL_EXPORT_HEADER_LIBRARY_HEADERS:=

View File

@ -126,17 +126,23 @@ else # my_strip_module and my_pack_module_relocations not true
ifdef prebuilt_module_is_a_library ifdef prebuilt_module_is_a_library
export_includes := $(intermediates)/export_includes export_includes := $(intermediates)/export_includes
$(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) export_cflags := $(foreach d,$(LOCAL_EXPORT_C_INCLUDE_DIRS),-I $(d))
# Soong exports cflags instead of include dirs, so that -isystem can be included.
ifeq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
export_cflags += $(LOCAL_EXPORT_CFLAGS)
else ifdef LOCAL_EXPORT_CFLAGS
$(call pretty-error,LOCAL_EXPORT_CFLAGS can only be used by Soong, use LOCAL_EXPORT_C_INCLUDE_DIRS instead)
endif
$(export_includes): PRIVATE_EXPORT_CFLAGS := $(export_cflags)
$(export_includes): $(LOCAL_EXPORT_C_INCLUDE_DEPS) $(export_includes): $(LOCAL_EXPORT_C_INCLUDE_DEPS)
@echo Export includes file: $< -- $@ @echo Export includes file: $< -- $@
$(hide) mkdir -p $(dir $@) && rm -f $@ $(hide) mkdir -p $(dir $@) && rm -f $@
ifdef LOCAL_EXPORT_C_INCLUDE_DIRS ifdef export_cflags
$(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ $(hide) echo "$(PRIVATE_EXPORT_CFLAGS)" >$@
echo "-I $$d" >> $@; \
done
else else
$(hide) touch $@ $(hide) touch $@
endif endif
export_cflags :=
my_link_type := $(intermediates)/link_type my_link_type := $(intermediates)/link_type
$(my_link_type): PRIVATE_LINK_TYPE := native:$(if $(LOCAL_SDK_VERSION),ndk,platform) $(my_link_type): PRIVATE_LINK_TYPE := native:$(if $(LOCAL_SDK_VERSION),ndk,platform)