2016-11-18 23:05:39 +01:00
|
|
|
ifneq (,$(strip $(LOCAL_COPY_HEADERS)))
|
2009-03-04 04:28:42 +01:00
|
|
|
###########################################################
|
|
|
|
## Copy headers to the install tree
|
|
|
|
###########################################################
|
2016-07-26 01:03:53 +02:00
|
|
|
$(call record-module-type,COPY_HEADERS)
|
2009-03-04 04:28:42 +01:00
|
|
|
ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
|
2019-12-27 01:27:36 +01:00
|
|
|
$(call pretty-error,LOCAL_COPY_HEADERS may not be used with host modules)
|
2009-03-04 04:28:42 +01:00
|
|
|
endif
|
|
|
|
|
2016-11-18 23:05:39 +01:00
|
|
|
# Modules linking against the SDK do not have the include path to use
|
|
|
|
# COPY_HEADERS, so prevent them from exporting any either.
|
|
|
|
ifdef LOCAL_SDK_VERSION
|
2019-12-27 01:27:36 +01:00
|
|
|
$(call pretty-error,Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS)
|
2016-11-18 23:05:39 +01:00
|
|
|
endif
|
|
|
|
|
2024-02-05 02:22:04 +01:00
|
|
|
include $(BUILD_SYSTEM)/local_vendor_product.mk
|
2016-11-18 23:05:39 +01:00
|
|
|
|
2024-02-05 02:22:04 +01:00
|
|
|
# Modules in vendor or product may use LOCAL_COPY_HEADERS.
|
|
|
|
# Platform libraries will not have the include path present.
|
|
|
|
ifeq ($(call module-in-vendor-or-product),)
|
|
|
|
$(call pretty-error,Only modules in vendor or product may use LOCAL_COPY_HEADERS)
|
2016-11-18 23:05:39 +01:00
|
|
|
endif
|
|
|
|
|
2019-12-27 01:27:36 +01:00
|
|
|
# Clean up LOCAL_COPY_HEADERS_TO, since soong_ui will be comparing cleaned
|
|
|
|
# paths to figure out which headers are obsolete and should be removed.
|
|
|
|
LOCAL_COPY_HEADERS_TO := $(call clean-path,$(LOCAL_COPY_HEADERS_TO))
|
|
|
|
ifneq ($(filter /% .. ../%,$(LOCAL_COPY_HEADERS_TO)),)
|
|
|
|
$(call pretty-error,LOCAL_COPY_HEADERS_TO may not start with / or ../ : $(LOCAL_COPY_HEADERS_TO))
|
|
|
|
endif
|
|
|
|
ifeq ($(LOCAL_COPY_HEADERS_TO),.)
|
|
|
|
LOCAL_COPY_HEADERS_TO :=
|
|
|
|
endif
|
|
|
|
|
2009-03-04 04:28:42 +01:00
|
|
|
# Create a rule to copy each header, and make the
|
|
|
|
# all_copied_headers phony target depend on each
|
|
|
|
# destination header. copy-one-header defines the
|
|
|
|
# actual rule.
|
|
|
|
#
|
|
|
|
$(foreach header,$(LOCAL_COPY_HEADERS), \
|
|
|
|
$(eval _chFrom := $(LOCAL_PATH)/$(header)) \
|
|
|
|
$(eval _chTo := \
|
2013-10-22 21:24:21 +02:00
|
|
|
$(if $(LOCAL_COPY_HEADERS_TO),\
|
2016-11-23 01:17:38 +01:00
|
|
|
$(TARGET_OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\
|
|
|
|
$(TARGET_OUT_HEADERS)/$(notdir $(header)))) \
|
2016-02-23 22:40:07 +01:00
|
|
|
$(eval ALL_COPIED_HEADERS.$(_chTo).MAKEFILE += $(LOCAL_MODULE_MAKEFILE)) \
|
|
|
|
$(eval ALL_COPIED_HEADERS.$(_chTo).SRC += $(_chFrom)) \
|
|
|
|
$(if $(filter $(_chTo),$(ALL_COPIED_HEADERS)),, \
|
|
|
|
$(eval ALL_COPIED_HEADERS += $(_chTo))) \
|
2009-03-04 04:28:42 +01:00
|
|
|
)
|
|
|
|
_chFrom :=
|
|
|
|
_chTo :=
|
2016-11-18 23:05:39 +01:00
|
|
|
|
|
|
|
endif # LOCAL_COPY_HEADERS
|