Add Header Library support to Make
We currently use static libraries without any source files to represent
header libraries, but Soong actually has cc_library_headers. So to
export those in a separate namespace from static libraries, implement
them in Make as well.
This also adds a nice pretty-warning / pretty-error macro that can be
used to print out standard warning messages pointing to the real source
file having the problem.
Test: Use a header library exported by Soong in a Make module
Change-Id: I3486539e247524cb82a20620745fc7be03014e14
diff --git a/core/header_library_internal.mk b/core/header_library_internal.mk
new file mode 100644
index 0000000..35ee1bc
--- /dev/null
+++ b/core/header_library_internal.mk
@@ -0,0 +1,21 @@
+###########################################################
+## Standard rules for building a header library.
+##
+## Additional inputs from base_rules.make:
+## None.
+###########################################################
+
+LOCAL_MODULE_CLASS := HEADER_LIBRARIES
+LOCAL_UNINSTALLABLE_MODULE := true
+ifneq ($(strip $(LOCAL_MODULE_STEM)$(LOCAL_BUILT_MODULE_STEM)),)
+$(error $(LOCAL_PATH): Cannot set module stem for a library)
+endif
+
+include $(BUILD_SYSTEM)/binary.mk
+
+ifneq ($(strip $(all_objects)),)
+$(call pretty-error,Header libraries may not have any sources)
+endif
+
+$(LOCAL_BUILT_MODULE):
+ $(hide) touch $@