Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame] | 1 | ifneq (,$(strip $(LOCAL_COPY_HEADERS))) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 2 | ########################################################### |
| 3 | ## Copy headers to the install tree |
| 4 | ########################################################### |
Dan Willemsen | 3bf15e7 | 2016-07-25 16:03:53 -0700 | [diff] [blame] | 5 | $(call record-module-type,COPY_HEADERS) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 6 | ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),) |
Dan Willemsen | 13cb165 | 2019-12-26 16:27:36 -0800 | [diff] [blame] | 7 | $(call pretty-error,LOCAL_COPY_HEADERS may not be used with host modules) |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 8 | endif |
| 9 | |
Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame] | 10 | # Modules linking against the SDK do not have the include path to use |
| 11 | # COPY_HEADERS, so prevent them from exporting any either. |
| 12 | ifdef LOCAL_SDK_VERSION |
Dan Willemsen | 13cb165 | 2019-12-26 16:27:36 -0800 | [diff] [blame] | 13 | $(call pretty-error,Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS) |
Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame] | 14 | endif |
| 15 | |
| 16 | include $(BUILD_SYSTEM)/local_vndk.mk |
| 17 | |
| 18 | # If we're using the VNDK, only vendor modules using the VNDK may use |
| 19 | # LOCAL_COPY_HEADERS. Platform libraries will not have the include path |
| 20 | # present. |
| 21 | ifdef BOARD_VNDK_VERSION |
| 22 | ifndef LOCAL_USE_VNDK |
Dan Willemsen | 13cb165 | 2019-12-26 16:27:36 -0800 | [diff] [blame] | 23 | $(call pretty-error,Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS) |
Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame] | 24 | endif |
| 25 | endif |
| 26 | |
Dan Willemsen | 13cb165 | 2019-12-26 16:27:36 -0800 | [diff] [blame] | 27 | # Clean up LOCAL_COPY_HEADERS_TO, since soong_ui will be comparing cleaned |
| 28 | # paths to figure out which headers are obsolete and should be removed. |
| 29 | LOCAL_COPY_HEADERS_TO := $(call clean-path,$(LOCAL_COPY_HEADERS_TO)) |
| 30 | ifneq ($(filter /% .. ../%,$(LOCAL_COPY_HEADERS_TO)),) |
| 31 | $(call pretty-error,LOCAL_COPY_HEADERS_TO may not start with / or ../ : $(LOCAL_COPY_HEADERS_TO)) |
| 32 | endif |
| 33 | ifeq ($(LOCAL_COPY_HEADERS_TO),.) |
| 34 | LOCAL_COPY_HEADERS_TO := |
| 35 | endif |
| 36 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 37 | # Create a rule to copy each header, and make the |
| 38 | # all_copied_headers phony target depend on each |
| 39 | # destination header. copy-one-header defines the |
| 40 | # actual rule. |
| 41 | # |
| 42 | $(foreach header,$(LOCAL_COPY_HEADERS), \ |
| 43 | $(eval _chFrom := $(LOCAL_PATH)/$(header)) \ |
| 44 | $(eval _chTo := \ |
Colin Cross | a6c4ebd | 2013-10-22 12:24:21 -0700 | [diff] [blame] | 45 | $(if $(LOCAL_COPY_HEADERS_TO),\ |
Dan Willemsen | 6e51ef6 | 2016-11-22 16:17:38 -0800 | [diff] [blame] | 46 | $(TARGET_OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\ |
| 47 | $(TARGET_OUT_HEADERS)/$(notdir $(header)))) \ |
Dan Willemsen | 6f60f02 | 2016-02-23 13:40:07 -0800 | [diff] [blame] | 48 | $(eval ALL_COPIED_HEADERS.$(_chTo).MAKEFILE += $(LOCAL_MODULE_MAKEFILE)) \ |
| 49 | $(eval ALL_COPIED_HEADERS.$(_chTo).SRC += $(_chFrom)) \ |
| 50 | $(if $(filter $(_chTo),$(ALL_COPIED_HEADERS)),, \ |
| 51 | $(eval ALL_COPIED_HEADERS += $(_chTo))) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 52 | ) |
| 53 | _chFrom := |
| 54 | _chTo := |
Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame] | 55 | |
| 56 | endif # LOCAL_COPY_HEADERS |