Add basic musl support to make
There are still devices that set BUILD_BROKEN_USES_BUILD_HOST_* and
build host modules in Make. Add basic support for building against
libc_musl in Make when USE_HOST_MUSL is set.
Bug: 258535366
Test: build a host tool defined in Android.mk file in internal branch
Change-Id: I9150be749bbeaac2ac5a33b2cf915004aa3033df
diff --git a/core/binary.mk b/core/binary.mk
index 1ad9be8..6320726 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -19,7 +19,11 @@
# supply that, for example, when building libc itself.
ifdef LOCAL_IS_HOST_MODULE
ifeq ($(LOCAL_SYSTEM_SHARED_LIBRARIES),none)
+ ifdef USE_HOST_MUSL
+ my_system_shared_libraries := libc_musl
+ else
my_system_shared_libraries :=
+ endif
else
my_system_shared_libraries := $(LOCAL_SYSTEM_SHARED_LIBRARIES)
endif
@@ -348,9 +352,11 @@
else # LOCAL_IS_HOST_MODULE
# Add -ldl, -lpthread, -lm and -lrt to host builds to match the default behavior of
# device builds
- my_ldlibs += -ldl -lpthread -lm
- ifneq ($(HOST_OS),darwin)
- my_ldlibs += -lrt
+ ifndef USE_HOST_MUSL
+ my_ldlibs += -ldl -lpthread -lm
+ ifneq ($(HOST_OS),darwin)
+ my_ldlibs += -lrt
+ endif
endif
endif