Home | History | Annotate | Download | only in core
      1 ifneq (,$(strip $(LOCAL_COPY_HEADERS)))
      2 ###########################################################
      3 ## Copy headers to the install tree
      4 ###########################################################
      5 $(call record-module-type,COPY_HEADERS)
      6 ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),)
      7   $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): LOCAL_COPY_HEADERS may not be used with host modules >&2)
      8   $(error done)
      9 endif
     10 
     11 # Modules linking against the SDK do not have the include path to use
     12 # COPY_HEADERS, so prevent them from exporting any either.
     13 ifdef LOCAL_SDK_VERSION
     14 $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Modules using LOCAL_SDK_VERSION may not use LOCAL_COPY_HEADERS >&2)
     15 $(error done)
     16 endif
     17 
     18 include $(BUILD_SYSTEM)/local_vndk.mk
     19 
     20 # If we're using the VNDK, only vendor modules using the VNDK may use
     21 # LOCAL_COPY_HEADERS. Platform libraries will not have the include path
     22 # present.
     23 ifdef BOARD_VNDK_VERSION
     24 ifndef LOCAL_USE_VNDK
     25 $(shell echo $(LOCAL_MODULE_MAKEFILE): $(LOCAL_MODULE): Only vendor modules using LOCAL_USE_VNDK may use LOCAL_COPY_HEADERS >&2)
     26 $(error done)
     27 endif
     28 endif
     29 
     30 # Create a rule to copy each header, and make the
     31 # all_copied_headers phony target depend on each
     32 # destination header.  copy-one-header defines the
     33 # actual rule.
     34 #
     35 $(foreach header,$(LOCAL_COPY_HEADERS), \
     36   $(eval _chFrom := $(LOCAL_PATH)/$(header)) \
     37   $(eval _chTo := \
     38       $(if $(LOCAL_COPY_HEADERS_TO),\
     39         $(TARGET_OUT_HEADERS)/$(LOCAL_COPY_HEADERS_TO)/$(notdir $(header)),\
     40         $(TARGET_OUT_HEADERS)/$(notdir $(header)))) \
     41   $(eval ALL_COPIED_HEADERS.$(_chTo).MAKEFILE += $(LOCAL_MODULE_MAKEFILE)) \
     42   $(eval ALL_COPIED_HEADERS.$(_chTo).SRC += $(_chFrom)) \
     43   $(if $(filter $(_chTo),$(ALL_COPIED_HEADERS)),, \
     44       $(eval ALL_COPIED_HEADERS += $(_chTo))) \
     45  )
     46 _chFrom :=
     47 _chTo :=
     48 
     49 endif # LOCAL_COPY_HEADERS
     50