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)),) |
| 7 | my_prefix := HOST_ |
| 8 | else |
| 9 | my_prefix := TARGET_ |
| 10 | endif |
| 11 | |
Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame^] | 12 | # Modules linking against the SDK do not have the include path to use |
| 13 | # COPY_HEADERS, so prevent them from exporting any either. |
| 14 | ifdef LOCAL_SDK_VERSION |
| 15 | $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS >&2) |
| 16 | $(error done) |
| 17 | endif |
| 18 | |
| 19 | include $(BUILD_SYSTEM)/local_vndk.mk |
| 20 | |
| 21 | # If we're using the VNDK, only vendor modules using the VNDK may use |
| 22 | # LOCAL_COPY_HEADERS. Platform libraries will not have the include path |
| 23 | # present. |
| 24 | ifdef BOARD_VNDK_VERSION |
| 25 | ifndef LOCAL_USE_VNDK |
| 26 | $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS >&2) |
| 27 | $(error done) |
| 28 | endif |
| 29 | endif |
| 30 | |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 31 | # Create a rule to copy each header, and make the |
| 32 | # all_copied_headers phony target depend on each |
| 33 | # destination header. copy-one-header defines the |
| 34 | # actual rule. |
| 35 | # |
| 36 | $(foreach header,$(LOCAL_COPY_HEADERS), \ |
| 37 | $(eval _chFrom := $(LOCAL_PATH)/$(header)) \ |
| 38 | $(eval _chTo := \ |
Colin Cross | a6c4ebd | 2013-10-22 12:24:21 -0700 | [diff] [blame] | 39 | $(if $(LOCAL_COPY_HEADERS_TO),\ |
| 40 | $($(my_prefix)OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\ |
| 41 | $($(my_prefix)OUT_HEADERS)/$(notdir $(header)))) \ |
Dan Willemsen | 6f60f02 | 2016-02-23 13:40:07 -0800 | [diff] [blame] | 42 | $(eval ALL_COPIED_HEADERS.$(_chTo).MAKEFILE += $(LOCAL_MODULE_MAKEFILE)) \ |
| 43 | $(eval ALL_COPIED_HEADERS.$(_chTo).SRC += $(_chFrom)) \ |
| 44 | $(if $(filter $(_chTo),$(ALL_COPIED_HEADERS)),, \ |
| 45 | $(eval ALL_COPIED_HEADERS += $(_chTo))) \ |
The Android Open Source Project | 88b6079 | 2009-03-03 19:28:42 -0800 | [diff] [blame] | 46 | ) |
| 47 | _chFrom := |
| 48 | _chTo := |
Dan Willemsen | bab0fa6 | 2016-11-18 14:05:39 -0800 | [diff] [blame^] | 49 | |
| 50 | endif # LOCAL_COPY_HEADERS |