• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1LOCAL_PATH := $(call my-dir)
2
3android_support_c_includes := $(LOCAL_PATH)/include
4
5ifneq ($(filter $(NDK_KNOWN_DEVICE_ABI64S),$(TARGET_ARCH_ABI)),)
6# 64-bit ABIs
7android_support_sources := \
8    src/musl-locale/catclose.c \
9    src/musl-locale/catgets.c \
10    src/musl-locale/catopen.c
11
12else
13# 32-bit ABIs
14
15android_support_sources := \
16    src/locale_support.c \
17    src/math_support.c \
18    src/stdlib_support.c \
19    src/wchar_support.c \
20    src/locale/duplocale.c \
21    src/locale/freelocale.c \
22    src/locale/localeconv.c \
23    src/locale/newlocale.c \
24    src/locale/uselocale.c \
25    src/stdio/stdio_impl.c \
26    src/stdio/strtod.c \
27    src/stdio/vfprintf.c \
28    src/stdio/vfwprintf.c \
29    src/msun/e_log2.c \
30    src/msun/e_log2f.c \
31    src/msun/s_nan.c \
32    src/musl-ctype/iswalnum.c \
33    src/musl-ctype/iswalpha.c \
34    src/musl-ctype/iswblank.c \
35    src/musl-ctype/iswcntrl.c \
36    src/musl-ctype/iswctype.c \
37    src/musl-ctype/iswdigit.c \
38    src/musl-ctype/iswgraph.c \
39    src/musl-ctype/iswlower.c \
40    src/musl-ctype/iswprint.c \
41    src/musl-ctype/iswpunct.c \
42    src/musl-ctype/iswspace.c \
43    src/musl-ctype/iswupper.c \
44    src/musl-ctype/iswxdigit.c \
45    src/musl-ctype/towctrans.c \
46    src/musl-ctype/wcswidth.c \
47    src/musl-ctype/wctrans.c \
48    src/musl-ctype/wcwidth.c \
49    src/musl-locale/catclose.c \
50    src/musl-locale/catgets.c \
51    src/musl-locale/catopen.c \
52    src/musl-locale/iconv.c \
53    src/musl-locale/intl.c \
54    src/musl-locale/isalnum_l.c \
55    src/musl-locale/isalpha_l.c \
56    src/musl-locale/isblank_l.c \
57    src/musl-locale/iscntrl_l.c \
58    src/musl-locale/isdigit_l.c \
59    src/musl-locale/isgraph_l.c \
60    src/musl-locale/islower_l.c \
61    src/musl-locale/isprint_l.c \
62    src/musl-locale/ispunct_l.c \
63    src/musl-locale/isspace_l.c \
64    src/musl-locale/isupper_l.c \
65    src/musl-locale/iswalnum_l.c \
66    src/musl-locale/iswalpha_l.c \
67    src/musl-locale/iswblank_l.c \
68    src/musl-locale/iswcntrl_l.c \
69    src/musl-locale/iswctype_l.c \
70    src/musl-locale/iswdigit_l.c \
71    src/musl-locale/iswgraph_l.c \
72    src/musl-locale/iswlower_l.c \
73    src/musl-locale/iswprint_l.c \
74    src/musl-locale/iswpunct_l.c \
75    src/musl-locale/iswspace_l.c \
76    src/musl-locale/iswupper_l.c \
77    src/musl-locale/iswxdigit_l.c \
78    src/musl-locale/isxdigit_l.c \
79    src/musl-locale/langinfo.c \
80    src/musl-locale/strcasecmp_l.c \
81    src/musl-locale/strcoll.c \
82    src/musl-locale/strerror_l.c \
83    src/musl-locale/strfmon.c \
84    src/musl-locale/strftime_l.c \
85    src/musl-locale/strncasecmp_l.c \
86    src/musl-locale/strxfrm.c \
87    src/musl-locale/tolower_l.c \
88    src/musl-locale/toupper_l.c \
89    src/musl-locale/towctrans_l.c \
90    src/musl-locale/towlower_l.c \
91    src/musl-locale/towupper_l.c \
92    src/musl-locale/wcscoll.c \
93    src/musl-locale/wcsxfrm.c \
94    src/musl-locale/wctrans_l.c \
95    src/musl-locale/wctype_l.c \
96    src/musl-math/frexp.c \
97    src/musl-math/frexpf.c \
98    src/musl-math/frexpl.c \
99    src/musl-multibyte/btowc.c \
100    src/musl-multibyte/internal.c \
101    src/musl-multibyte/mblen.c \
102    src/musl-multibyte/mbrlen.c \
103    src/musl-multibyte/mbrtowc.c \
104    src/musl-multibyte/mbsinit.c \
105    src/musl-multibyte/mbsnrtowcs.c \
106    src/musl-multibyte/mbsrtowcs.c \
107    src/musl-multibyte/mbstowcs.c \
108    src/musl-multibyte/mbtowc.c \
109    src/musl-multibyte/wcrtomb.c \
110    src/musl-multibyte/wcsnrtombs.c \
111    src/musl-multibyte/wcsrtombs.c \
112    src/musl-multibyte/wcstombs.c \
113    src/musl-multibyte/wctob.c \
114    src/musl-multibyte/wctomb.c \
115    src/musl-stdio/printf.c \
116    src/musl-stdio/snprintf.c \
117    src/musl-stdio/sprintf.c \
118    src/musl-stdio/vprintf.c \
119    src/musl-stdio/vsprintf.c \
120    src/musl-stdio/swprintf.c \
121    src/musl-stdio/vwprintf.c \
122    src/musl-stdio/wprintf.c \
123    src/wcstox/floatscan.c \
124    src/wcstox/intscan.c \
125    src/wcstox/shgetc.c \
126    src/wcstox/wcstol.c \
127    src/wcstox/wcstod.c \
128
129# Replaces broken implementations in x86 libm.so
130ifeq (x86,$(TARGET_ARCH_ABI))
131android_support_sources += \
132    src/musl-math/scalbln.c \
133    src/musl-math/scalblnf.c \
134    src/musl-math/scalblnl.c \
135    src/musl-math/scalbnl.c \
136
137endif
138
139endif  # 64-/32-bit ABIs
140
141# This is only available as a static library for now.
142include $(CLEAR_VARS)
143LOCAL_MODULE := android_support
144LOCAL_SRC_FILES := $(android_support_sources)
145LOCAL_C_INCLUDES := $(android_support_c_includes)
146LOCAL_CFLAGS += -Drestrict=__restrict__ -ffunction-sections -fdata-sections -fvisibility=hidden
147LOCAL_CPPFLAGS += -fvisibility-inlines-hidden
148
149# These Clang warnings are triggered by the Musl sources. The code is fine,
150# but we don't want to modify it. TODO(digit): This is potentially dangerous,
151# see if there is a way to build the Musl sources in a separate static library
152# and have the main one depend on it, or include its object files.
153ifneq ($(TARGET_TOOLCHAIN),$(subst clang,,$(TARGET_TOOLCHAIN)))
154LOCAL_CFLAGS += \
155  -Wno-shift-op-parentheses \
156  -Wno-string-plus-int \
157  -Wno-dangling-else \
158  -Wno-bitwise-op-parentheses
159endif
160
161LOCAL_CFLAGS += $(android_support_cflags)
162LOCAL_EXPORT_CFLAGS := $(android_support_cflags)
163LOCAL_EXPORT_C_INCLUDES := $(android_support_c_includes)
164include $(BUILD_STATIC_LIBRARY)
165
166