2 # Copyright (C) 2019 The Android-x86 Open Source Project
4 # Licensed under the standard MIT license.
5 # See the COPYRIGHT in the same directory.
8 LOCAL_PATH := $(call my-dir)
12 LOCAL_MODULE := libc-musl
13 LOCAL_MULTILIB := first
14 LOCAL_VENDOR_MODULE := true
15 LOCAL_MODULE_CLASS := SHARED_LIBRARIES
17 MUSL_ARCH := $(TARGET_ARCH)
18 MUSL_SRC_DIRS := $(addprefix $(LOCAL_PATH)/,src/* ldso)
19 MUSL_BASE_SRCS := $(sort $(wildcard $(addsuffix /*.c,$(MUSL_SRC_DIRS))))
20 MUSL_ARCH_SRCS := $(sort $(wildcard $(addsuffix /$(MUSL_ARCH)/*.[csS],$(MUSL_SRC_DIRS))))
21 MUSL_REPLACED_SRCS = $(addsuffix .c,$(subst $(MUSL_ARCH)/,,$(basename $(MUSL_ARCH_SRCS))))
23 LOCAL_SRC_FILES := $(subst $(LOCAL_PATH)/,,$(filter-out $(MUSL_REPLACED_SRCS),$(MUSL_BASE_SRCS)) $(MUSL_ARCH_SRCS))
25 LOCAL_C_INCLUDES := $(addprefix $(LOCAL_PATH)/, \
32 LOCAL_CFLAGS := -std=c99 -nostdinc \
33 -ffreestanding -fexcess-precision=standard -frounding-math \
34 -Wa,--noexecstack -D_XOPEN_SOURCE=700 -fomit-frame-pointer \
35 -fno-unwind-tables -fno-asynchronous-unwind-tables \
36 -ffunction-sections -fdata-sections \
37 -Werror=implicit-function-declaration -Werror=implicit-int \
38 -Werror=pointer-sign -Werror=pointer-arith \
41 intermediates := $(call local-generated-sources-dir)
43 LOCAL_GENERATED_SOURCES := \
44 $(intermediates)/bits/alltypes.h \
45 $(intermediates)/bits/syscall.h \
46 $(intermediates)/version.h
48 $(intermediates)/bits/alltypes.h: $(LOCAL_PATH)/tools/mkalltypes.sed $(LOCAL_PATH)/arch/$(MUSL_ARCH)/bits/alltypes.h.in $(LOCAL_PATH)/include/alltypes.h.in
51 $(intermediates)/bits/syscall.h: $(LOCAL_PATH)/arch/$(MUSL_ARCH)/bits/syscall.h.in | $(ACP)
53 sed -n -e s/__NR_/SYS_/p < $< >> $@
55 $(intermediates)/version.h: $(wildcard $(LOCAL_PATH)/VERSION $(LOCAL_PATH)/.git)
56 echo "#define VERSION \"$$(cd $(<D); sh tools/version.sh)\"" > $@
59 LOCAL_SANITIZE := never
60 LOCAL_SYSTEM_SHARED_LIBRARIES :=
62 LOCAL_NO_DEFAULT_COMPILER_FLAGS := true
63 LOCAL_NO_LIBCOMPILER_RT := true
64 LOCAL_NO_STANDARD_LIBRARIES := true
68 -Wl,--hash-style=both \
70 -Wl,--exclude-libs=ALL \
71 -Wl,--dynamic-list=$(LOCAL_PATH)/dynamic.list \
74 include $(BUILD_SHARED_LIBRARY)