1########################################################### 2## Track NOTICE files 3########################################################### 4 5module_license_metadata := $(call local-meta-intermediates-dir)/$(my_register_name).meta_lic 6 7$(foreach target,$(ALL_MODULES.$(my_register_name).BUILT) $(ALL_MODULES.$(my_register_name).INSTALLED) $(foreach bi,$(LOCAL_SOONG_BUILT_INSTALLED),$(call word-colon,1,$(bi))),\ 8 $(eval ALL_TARGETS.$(target).META_LIC := $(module_license_metadata))) 9 10$(foreach f,$(my_test_data) $(my_test_config),\ 11 $(if $(strip $(ALL_TARGETS.$(call word-colon,1,$(f)).META_LIC)), \ 12 $(call declare-copy-target-license-metadata,$(call word-colon,2,$(f)),$(call word-colon,1,$(f))), \ 13 $(eval ALL_TARGETS.$(call word-colon,2,$(f)).META_LIC := $(module_license_metadata)))) 14 15ALL_MODULES.$(my_register_name).META_LIC := $(strip $(ALL_MODULES.$(my_register_name).META_LIC) $(module_license_metadata)) 16 17ifdef LOCAL_SOONG_LICENSE_METADATA 18 # Soong modules have already produced a license metadata file, copy it to where Make expects it. 19 $(eval $(call copy-one-license-metadata-file, $(LOCAL_SOONG_LICENSE_METADATA), $(module_license_metadata),$(ALL_MODULES.$(my_register_name).BUILT),$(ALL_MODUES.$(my_register_name).INSTALLED))) 20else 21 # Make modules don't have enough information to produce a license metadata rule until after fix-notice-deps 22 # has been called, store the necessary information until later. 23 24 ifneq ($(LOCAL_NOTICE_FILE),) 25 notice_file:=$(strip $(LOCAL_NOTICE_FILE)) 26 else 27 notice_file:=$(strip $(wildcard $(LOCAL_PATH)/LICENSE $(LOCAL_PATH)/LICENCE $(LOCAL_PATH)/NOTICE)) 28 endif 29 30 ifeq ($(LOCAL_MODULE_CLASS),GYP) 31 # We ignore NOTICE files for modules of type GYP. 32 notice_file := 33 endif 34 35 ifeq ($(LOCAL_MODULE_CLASS),FAKE) 36 # We ignore NOTICE files for modules of type FAKE. 37 notice_file := 38 endif 39 40 # Soong generates stub libraries that don't need NOTICE files 41 ifdef LOCAL_NO_NOTICE_FILE 42 ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK)) 43 $(call pretty-error,LOCAL_NO_NOTICE_FILE should not be used by Android.mk files) 44 endif 45 notice_file := 46 endif 47 48 ifneq (,$(strip $(LOCAL_LICENSE_PACKAGE_NAME))) 49 license_package_name:=$(strip $(LOCAL_LICENSE_PACKAGE_NAME)) 50 else 51 license_package_name:= 52 endif 53 54 ifneq (,$(strip $(LOCAL_LICENSE_INSTALL_MAP))) 55 install_map:=$(strip $(LOCAL_LICENSE_INSTALL_MAP)) 56 else 57 install_map:= 58 endif 59 60 ifneq (,$(strip $(LOCAL_LICENSE_KINDS))) 61 license_kinds:=$(strip $(LOCAL_LICENSE_KINDS)) 62 else 63 license_kinds:=legacy_by_exception_only 64 endif 65 66 ifneq (,$(strip $(LOCAL_LICENSE_CONDITIONS))) 67 license_conditions:=$(strip $(LOCAL_LICENSE_CONDITIONS)) 68 else 69 license_conditions:=by_exception_only 70 endif 71 72 is_container:=$(strip $(LOCAL_MODULE_IS_CONTAINER)) 73 ifeq (,$(is_container)) 74 ifneq (,$(strip $(filter %.zip %.tar %.tgz %.tar.gz %.apk %.img %.srcszip %.apex, $(LOCAL_BUILT_MODULE)))) 75 is_container:=true 76 else 77 is_container:=false 78 endif 79 else ifneq (,$(strip $(filter-out true false,$(is_container)))) 80 $(error Unrecognized value '$(is_container)' for LOCAL_MODULE_IS_CONTAINER) 81 endif 82 83 ifeq (true,$(is_container)) 84 # Include shared libraries' notices for "container" types, but not for binaries etc. 85 notice_deps := \ 86 $(strip \ 87 $(foreach d, \ 88 $(LOCAL_REQUIRED_MODULES) \ 89 $(LOCAL_STATIC_LIBRARIES) \ 90 $(LOCAL_WHOLE_STATIC_LIBRARIES) \ 91 $(LOCAL_SHARED_LIBRARIES) \ 92 $(LOCAL_DYLIB_LIBRARIES) \ 93 $(LOCAL_RLIB_LIBRARIES) \ 94 $(LOCAL_PROC_MACRO_LIBRARIES) \ 95 $(LOCAL_HEADER_LIBRARIES) \ 96 $(LOCAL_STATIC_JAVA_LIBRARIES) \ 97 $(LOCAL_JAVA_LIBRARIES) \ 98 $(LOCAL_JNI_SHARED_LIBRARIES) \ 99 ,$(subst :,_,$(d)):static \ 100 ) \ 101 ) 102 else 103 notice_deps := \ 104 $(strip \ 105 $(foreach d, \ 106 $(LOCAL_REQUIRED_MODULES) \ 107 $(LOCAL_STATIC_LIBRARIES) \ 108 $(LOCAL_WHOLE_STATIC_LIBRARIES) \ 109 $(LOCAL_RLIB_LIBRARIES) \ 110 $(LOCAL_PROC_MACRO_LIBRARIES) \ 111 $(LOCAL_HEADER_LIBRARIES) \ 112 $(LOCAL_STATIC_JAVA_LIBRARIES) \ 113 ,$(subst :,_,$(d)):static \ 114 )$(foreach d, \ 115 $(LOCAL_SHARED_LIBRARIES) \ 116 $(LOCAL_DYLIB_LIBRARIES) \ 117 $(LOCAL_JAVA_LIBRARIES) \ 118 $(LOCAL_JNI_SHARED_LIBRARIES) \ 119 ,$(subst :,_,$(d)):dynamic \ 120 ) \ 121 ) 122 endif 123 ifeq ($(LOCAL_IS_HOST_MODULE),true) 124 notice_deps := $(strip $(notice_deps) $(foreach d,$(LOCAL_HOST_REQUIRED_MODULES),$(subst :,_,$(d)):static)) 125 else 126 notice_deps := $(strip $(notice_deps) $(foreach d,$(LOCAL_TARGET_REQUIRED_MODULES),$(subst :,_,$(d)):static)) 127 endif 128 129 ALL_MODULES.$(my_register_name).DELAYED_META_LIC := $(strip $(ALL_MODULES.$(my_register_name).DELAYED_META_LIC) $(module_license_metadata)) 130 ALL_MODULES.$(my_register_name).LICENSE_PACKAGE_NAME := $(strip $(license_package_name)) 131 ALL_MODULES.$(my_register_name).MODULE_TYPE := $(strip $(ALL_MODULES.$(my_register_name).MODULE_TYPE) $(LOCAL_MODULE_TYPE)) 132 ALL_MODULES.$(my_register_name).MODULE_CLASS := $(strip $(ALL_MODULES.$(my_register_name).MODULE_CLASS) $(LOCAL_MODULE_CLASS)) 133 ALL_MODULES.$(my_register_name).LICENSE_KINDS := $(ALL_MODULES.$(my_register_name).LICENSE_KINDS) $(license_kinds) 134 ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS := $(ALL_MODULES.$(my_register_name).LICENSE_CONDITIONS) $(license_conditions) 135 ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP := $(ALL_MODULES.$(my_register_name).LICENSE_INSTALL_MAP) $(install_map) 136 ALL_MODULES.$(my_register_name).NOTICE_DEPS := $(ALL_MODULES.$(my_register_name).NOTICE_DEPS) $(notice_deps) 137 ALL_MODULES.$(my_register_name).IS_CONTAINER := $(strip $(filter-out false,$(ALL_MODULES.$(my_register_name).IS_CONTAINER) $(is_container))) 138 ALL_MODULES.$(my_register_name).PATH := $(strip $(ALL_MODULES.$(my_register_name).PATH) $(local_path)) 139 140 ifdef notice_file 141 ALL_MODULES.$(my_register_name).NOTICES := $(ALL_MODULES.$(my_register_name).NOTICES) $(notice_file) 142 endif # notice_file 143endif 144 145