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