1ifneq (,$(strip $(LOCAL_COPY_HEADERS))) 2########################################################### 3## Copy headers to the install tree 4########################################################### 5$(call record-module-type,COPY_HEADERS) 6ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),) 7 $(call pretty-error,LOCAL_COPY_HEADERS may not be used with host modules) 8endif 9 10# Modules linking against the SDK do not have the include path to use 11# COPY_HEADERS, so prevent them from exporting any either. 12ifdef LOCAL_SDK_VERSION 13 $(call pretty-error,Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS) 14endif 15 16include $(BUILD_SYSTEM)/local_vendor_product.mk 17 18# Modules in vendor or product may use LOCAL_COPY_HEADERS. 19# Platform libraries will not have the include path present. 20ifeq ($(call module-in-vendor-or-product),) 21 $(call pretty-error,Only modules in vendor or product may use LOCAL_COPY_HEADERS) 22endif 23 24# Clean up LOCAL_COPY_HEADERS_TO, since soong_ui will be comparing cleaned 25# paths to figure out which headers are obsolete and should be removed. 26LOCAL_COPY_HEADERS_TO := $(call clean-path,$(LOCAL_COPY_HEADERS_TO)) 27ifneq ($(filter /% .. ../%,$(LOCAL_COPY_HEADERS_TO)),) 28 $(call pretty-error,LOCAL_COPY_HEADERS_TO may not start with / or ../ : $(LOCAL_COPY_HEADERS_TO)) 29endif 30ifeq ($(LOCAL_COPY_HEADERS_TO),.) 31 LOCAL_COPY_HEADERS_TO := 32endif 33 34# Create a rule to copy each header, and make the 35# all_copied_headers phony target depend on each 36# destination header. copy-one-header defines the 37# actual rule. 38# 39$(foreach header,$(LOCAL_COPY_HEADERS), \ 40 $(eval _chFrom := $(LOCAL_PATH)/$(header)) \ 41 $(eval _chTo := \ 42 $(if $(LOCAL_COPY_HEADERS_TO),\ 43 $(TARGET_OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\ 44 $(TARGET_OUT_HEADERS)/$(notdir $(header)))) \ 45 $(eval ALL_COPIED_HEADERS.$(_chTo).MAKEFILE += $(LOCAL_MODULE_MAKEFILE)) \ 46 $(eval ALL_COPIED_HEADERS.$(_chTo).SRC += $(_chFrom)) \ 47 $(if $(filter $(_chTo),$(ALL_COPIED_HEADERS)),, \ 48 $(eval ALL_COPIED_HEADERS += $(_chTo))) \ 49 ) 50_chFrom := 51_chTo := 52 53endif # LOCAL_COPY_HEADERS 54