NOTICE file only module

To pick up a NOTICE file in LOCAL_PATH and attach it to
/system/lib/libfoo.so, use the following syntax:

include $(CLEAR_VARS)
LOCAL_MODULE_CLASS := NOTICE_FILES
LOCAL_INSTALLED_MODULE := $(PRODUCT_OUT)/system/lib/libfoo.so
include $(BUILD_NOTICE_FILE)

Bug: 7460213
Change-Id: Ie692be72deab37be04d1b578578c131a0885a090
diff --git a/core/notice_files.mk b/core/notice_files.mk
index 2840e60..2c0a3d3 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -9,6 +9,16 @@
   notice_file :=
 endif
 
+ifeq ($(LOCAL_MODULE_CLASS),NOTICE_FILES)
+# If this is a NOTICE-only module, we don't include base_rule.mk,
+# so my_prefix is not set at this point.
+ifeq ($(LOCAL_IS_HOST_MODULE),true)
+  my_prefix := HOST_
+else
+  my_prefix := TARGET_
+endif
+endif
+
 ifdef notice_file
 
 # This relies on the name of the directory in PRODUCT_OUT matching where