Android.mk revision 12e3f22c7c17d9d23e1720c9d23b9ee09c7528c6
1ifneq ($(TARGET_USE_PRIVATE_LIBM),true)
2LOCAL_PATH:= $(call my-dir)
3
4bionic_coverage := false
5
6# TODO: this comes from from upstream's libc, not libm, but it's an
7# implementation detail that should have hidden visibility, so it needs
8# to be in whatever library the math code is in.
9libm_common_src_files := \
10    digittoint.c  \
11
12# TODO: this is not in the BSDs.
13libm_common_src_files += \
14    significandl.c \
15    sincos.c \
16
17libm_common_src_files += \
18    upstream-freebsd/lib/msun/bsdsrc/b_exp.c \
19    upstream-freebsd/lib/msun/bsdsrc/b_log.c \
20    upstream-freebsd/lib/msun/bsdsrc/b_tgamma.c \
21    upstream-freebsd/lib/msun/src/e_acos.c \
22    upstream-freebsd/lib/msun/src/e_acosf.c \
23    upstream-freebsd/lib/msun/src/e_acosh.c \
24    upstream-freebsd/lib/msun/src/e_acoshf.c \
25    upstream-freebsd/lib/msun/src/e_asin.c \
26    upstream-freebsd/lib/msun/src/e_asinf.c \
27    upstream-freebsd/lib/msun/src/e_atan2.c \
28    upstream-freebsd/lib/msun/src/e_atan2f.c \
29    upstream-freebsd/lib/msun/src/e_atanh.c \
30    upstream-freebsd/lib/msun/src/e_atanhf.c \
31    upstream-freebsd/lib/msun/src/e_cosh.c \
32    upstream-freebsd/lib/msun/src/e_coshf.c \
33    upstream-freebsd/lib/msun/src/e_exp.c \
34    upstream-freebsd/lib/msun/src/e_expf.c \
35    upstream-freebsd/lib/msun/src/e_fmod.c \
36    upstream-freebsd/lib/msun/src/e_fmodf.c \
37    upstream-freebsd/lib/msun/src/e_gamma.c \
38    upstream-freebsd/lib/msun/src/e_gammaf.c \
39    upstream-freebsd/lib/msun/src/e_gammaf_r.c \
40    upstream-freebsd/lib/msun/src/e_gamma_r.c \
41    upstream-freebsd/lib/msun/src/e_hypot.c \
42    upstream-freebsd/lib/msun/src/e_hypotf.c \
43    upstream-freebsd/lib/msun/src/e_j0.c \
44    upstream-freebsd/lib/msun/src/e_j0f.c \
45    upstream-freebsd/lib/msun/src/e_j1.c \
46    upstream-freebsd/lib/msun/src/e_j1f.c \
47    upstream-freebsd/lib/msun/src/e_jn.c \
48    upstream-freebsd/lib/msun/src/e_jnf.c \
49    upstream-freebsd/lib/msun/src/e_lgamma.c \
50    upstream-freebsd/lib/msun/src/e_lgammaf.c \
51    upstream-freebsd/lib/msun/src/e_lgammaf_r.c \
52    upstream-freebsd/lib/msun/src/e_lgamma_r.c \
53    upstream-freebsd/lib/msun/src/e_log10.c \
54    upstream-freebsd/lib/msun/src/e_log10f.c \
55    upstream-freebsd/lib/msun/src/e_log2.c \
56    upstream-freebsd/lib/msun/src/e_log2f.c \
57    upstream-freebsd/lib/msun/src/e_log.c \
58    upstream-freebsd/lib/msun/src/e_logf.c \
59    upstream-freebsd/lib/msun/src/e_pow.c \
60    upstream-freebsd/lib/msun/src/e_powf.c \
61    upstream-freebsd/lib/msun/src/e_remainder.c \
62    upstream-freebsd/lib/msun/src/e_remainderf.c \
63    upstream-freebsd/lib/msun/src/e_rem_pio2.c \
64    upstream-freebsd/lib/msun/src/e_rem_pio2f.c \
65    upstream-freebsd/lib/msun/src/e_scalb.c \
66    upstream-freebsd/lib/msun/src/e_scalbf.c \
67    upstream-freebsd/lib/msun/src/e_sinh.c \
68    upstream-freebsd/lib/msun/src/e_sinhf.c \
69    upstream-freebsd/lib/msun/src/e_sqrt.c \
70    upstream-freebsd/lib/msun/src/e_sqrtf.c \
71    upstream-freebsd/lib/msun/src/imprecise.c \
72    upstream-freebsd/lib/msun/src/k_cos.c \
73    upstream-freebsd/lib/msun/src/k_cosf.c \
74    upstream-freebsd/lib/msun/src/k_exp.c \
75    upstream-freebsd/lib/msun/src/k_expf.c \
76    upstream-freebsd/lib/msun/src/k_rem_pio2.c \
77    upstream-freebsd/lib/msun/src/k_sin.c \
78    upstream-freebsd/lib/msun/src/k_sinf.c \
79    upstream-freebsd/lib/msun/src/k_tan.c \
80    upstream-freebsd/lib/msun/src/k_tanf.c \
81    upstream-freebsd/lib/msun/src/s_asinh.c \
82    upstream-freebsd/lib/msun/src/s_asinhf.c \
83    upstream-freebsd/lib/msun/src/s_atan.c \
84    upstream-freebsd/lib/msun/src/s_atanf.c \
85    upstream-freebsd/lib/msun/src/s_carg.c \
86    upstream-freebsd/lib/msun/src/s_cargf.c \
87    upstream-freebsd/lib/msun/src/s_cbrt.c \
88    upstream-freebsd/lib/msun/src/s_cbrtf.c \
89    upstream-freebsd/lib/msun/src/s_ccosh.c \
90    upstream-freebsd/lib/msun/src/s_ccoshf.c \
91    upstream-freebsd/lib/msun/src/s_ceil.c \
92    upstream-freebsd/lib/msun/src/s_ceilf.c \
93    upstream-freebsd/lib/msun/src/s_cexp.c \
94    upstream-freebsd/lib/msun/src/s_cexpf.c \
95    upstream-freebsd/lib/msun/src/s_cimag.c \
96    upstream-freebsd/lib/msun/src/s_cimagf.c \
97    upstream-freebsd/lib/msun/src/s_conj.c \
98    upstream-freebsd/lib/msun/src/s_conjf.c \
99    upstream-freebsd/lib/msun/src/s_copysign.c \
100    upstream-freebsd/lib/msun/src/s_copysignf.c \
101    upstream-freebsd/lib/msun/src/s_cos.c \
102    upstream-freebsd/lib/msun/src/s_cosf.c \
103    upstream-freebsd/lib/msun/src/s_cproj.c \
104    upstream-freebsd/lib/msun/src/s_cprojf.c \
105    upstream-freebsd/lib/msun/src/s_creal.c \
106    upstream-freebsd/lib/msun/src/s_crealf.c \
107    upstream-freebsd/lib/msun/src/s_csinh.c \
108    upstream-freebsd/lib/msun/src/s_csinhf.c \
109    upstream-freebsd/lib/msun/src/s_csqrt.c \
110    upstream-freebsd/lib/msun/src/s_csqrtf.c \
111    upstream-freebsd/lib/msun/src/s_ctanh.c \
112    upstream-freebsd/lib/msun/src/s_ctanhf.c \
113    upstream-freebsd/lib/msun/src/s_erf.c \
114    upstream-freebsd/lib/msun/src/s_erff.c \
115    upstream-freebsd/lib/msun/src/s_exp2.c \
116    upstream-freebsd/lib/msun/src/s_exp2f.c \
117    upstream-freebsd/lib/msun/src/s_expm1.c \
118    upstream-freebsd/lib/msun/src/s_expm1f.c \
119    upstream-freebsd/lib/msun/src/s_fabs.c \
120    upstream-freebsd/lib/msun/src/s_fabsf.c \
121    upstream-freebsd/lib/msun/src/s_fdim.c \
122    upstream-freebsd/lib/msun/src/s_finite.c \
123    upstream-freebsd/lib/msun/src/s_finitef.c \
124    upstream-freebsd/lib/msun/src/s_floor.c \
125    upstream-freebsd/lib/msun/src/s_floorf.c \
126    upstream-freebsd/lib/msun/src/s_fma.c \
127    upstream-freebsd/lib/msun/src/s_fmaf.c \
128    upstream-freebsd/lib/msun/src/s_fmax.c \
129    upstream-freebsd/lib/msun/src/s_fmaxf.c \
130    upstream-freebsd/lib/msun/src/s_fmin.c \
131    upstream-freebsd/lib/msun/src/s_fminf.c \
132    upstream-freebsd/lib/msun/src/s_frexp.c \
133    upstream-freebsd/lib/msun/src/s_frexpf.c \
134    upstream-freebsd/lib/msun/src/s_ilogb.c \
135    upstream-freebsd/lib/msun/src/s_ilogbf.c \
136    upstream-freebsd/lib/msun/src/s_llrint.c \
137    upstream-freebsd/lib/msun/src/s_llrintf.c \
138    upstream-freebsd/lib/msun/src/s_llround.c \
139    upstream-freebsd/lib/msun/src/s_llroundf.c \
140    upstream-freebsd/lib/msun/src/s_log1p.c \
141    upstream-freebsd/lib/msun/src/s_log1pf.c \
142    upstream-freebsd/lib/msun/src/s_logb.c \
143    upstream-freebsd/lib/msun/src/s_logbf.c \
144    upstream-freebsd/lib/msun/src/s_lrint.c \
145    upstream-freebsd/lib/msun/src/s_lrintf.c \
146    upstream-freebsd/lib/msun/src/s_lround.c \
147    upstream-freebsd/lib/msun/src/s_lroundf.c \
148    upstream-freebsd/lib/msun/src/s_modf.c \
149    upstream-freebsd/lib/msun/src/s_modff.c \
150    upstream-freebsd/lib/msun/src/s_nan.c \
151    upstream-freebsd/lib/msun/src/s_nearbyint.c \
152    upstream-freebsd/lib/msun/src/s_nextafter.c \
153    upstream-freebsd/lib/msun/src/s_nextafterf.c \
154    upstream-freebsd/lib/msun/src/s_remquo.c \
155    upstream-freebsd/lib/msun/src/s_remquof.c \
156    upstream-freebsd/lib/msun/src/s_rint.c \
157    upstream-freebsd/lib/msun/src/s_rintf.c \
158    upstream-freebsd/lib/msun/src/s_round.c \
159    upstream-freebsd/lib/msun/src/s_roundf.c \
160    upstream-freebsd/lib/msun/src/s_scalbln.c \
161    upstream-freebsd/lib/msun/src/s_scalbn.c \
162    upstream-freebsd/lib/msun/src/s_scalbnf.c \
163    upstream-freebsd/lib/msun/src/s_signgam.c \
164    upstream-freebsd/lib/msun/src/s_significand.c \
165    upstream-freebsd/lib/msun/src/s_significandf.c \
166    upstream-freebsd/lib/msun/src/s_sin.c \
167    upstream-freebsd/lib/msun/src/s_sinf.c \
168    upstream-freebsd/lib/msun/src/s_tan.c \
169    upstream-freebsd/lib/msun/src/s_tanf.c \
170    upstream-freebsd/lib/msun/src/s_tanh.c \
171    upstream-freebsd/lib/msun/src/s_tanhf.c \
172    upstream-freebsd/lib/msun/src/s_tgammaf.c \
173    upstream-freebsd/lib/msun/src/s_trunc.c \
174    upstream-freebsd/lib/msun/src/s_truncf.c \
175    upstream-freebsd/lib/msun/src/w_cabs.c \
176    upstream-freebsd/lib/msun/src/w_cabsf.c \
177    upstream-freebsd/lib/msun/src/w_drem.c \
178    upstream-freebsd/lib/msun/src/w_dremf.c \
179
180libm_common_src_files += \
181    fake_long_double.c \
182    signbit.c \
183
184libm_ld_src_files = \
185    upstream-freebsd/lib/msun/src/e_acosl.c \
186    upstream-freebsd/lib/msun/src/e_acoshl.c \
187    upstream-freebsd/lib/msun/src/e_asinl.c \
188    upstream-freebsd/lib/msun/src/e_atan2l.c \
189    upstream-freebsd/lib/msun/src/e_atanhl.c \
190    upstream-freebsd/lib/msun/src/e_fmodl.c \
191    upstream-freebsd/lib/msun/src/e_hypotl.c \
192    upstream-freebsd/lib/msun/src/e_lgammal.c \
193    upstream-freebsd/lib/msun/src/e_remainderl.c \
194    upstream-freebsd/lib/msun/src/e_sqrtl.c \
195    upstream-freebsd/lib/msun/src/s_asinhl.c \
196    upstream-freebsd/lib/msun/src/s_atanl.c \
197    upstream-freebsd/lib/msun/src/s_cbrtl.c \
198    upstream-freebsd/lib/msun/src/s_ceill.c \
199    upstream-freebsd/lib/msun/src/s_copysignl.c \
200    upstream-freebsd/lib/msun/src/e_coshl.c \
201    upstream-freebsd/lib/msun/src/s_cosl.c \
202    upstream-freebsd/lib/msun/src/s_fabsl.c \
203    upstream-freebsd/lib/msun/src/s_floorl.c \
204    upstream-freebsd/lib/msun/src/s_fmal.c \
205    upstream-freebsd/lib/msun/src/s_fmaxl.c \
206    upstream-freebsd/lib/msun/src/s_fminl.c \
207    upstream-freebsd/lib/msun/src/s_modfl.c \
208    upstream-freebsd/lib/msun/src/s_frexpl.c \
209    upstream-freebsd/lib/msun/src/s_ilogbl.c \
210    upstream-freebsd/lib/msun/src/s_llrintl.c \
211    upstream-freebsd/lib/msun/src/s_llroundl.c \
212    upstream-freebsd/lib/msun/src/s_logbl.c \
213    upstream-freebsd/lib/msun/src/s_lrintl.c \
214    upstream-freebsd/lib/msun/src/s_lroundl.c \
215    upstream-freebsd/lib/msun/src/s_nextafterl.c \
216    upstream-freebsd/lib/msun/src/s_nexttoward.c \
217    upstream-freebsd/lib/msun/src/s_nexttowardf.c \
218    upstream-freebsd/lib/msun/src/s_remquol.c \
219    upstream-freebsd/lib/msun/src/s_rintl.c \
220    upstream-freebsd/lib/msun/src/s_roundl.c \
221    upstream-freebsd/lib/msun/src/s_scalbnl.c \
222    upstream-freebsd/lib/msun/src/e_sinhl.c \
223    upstream-freebsd/lib/msun/src/s_sinl.c \
224    upstream-freebsd/lib/msun/src/s_tanhl.c \
225    upstream-freebsd/lib/msun/src/s_tanl.c \
226    upstream-freebsd/lib/msun/src/s_truncl.c \
227
228libm_ld_src_files += \
229    upstream-freebsd/lib/msun/ld128/invtrig.c \
230    upstream-freebsd/lib/msun/ld128/e_lgammal_r.c \
231    upstream-freebsd/lib/msun/ld128/k_cosl.c \
232    upstream-freebsd/lib/msun/ld128/k_sinl.c \
233    upstream-freebsd/lib/msun/ld128/k_tanl.c \
234    upstream-freebsd/lib/msun/ld128/s_erfl.c \
235    upstream-freebsd/lib/msun/ld128/s_exp2l.c \
236    upstream-freebsd/lib/msun/ld128/s_expl.c \
237    upstream-freebsd/lib/msun/ld128/s_logl.c \
238    upstream-freebsd/lib/msun/ld128/s_nanl.c \
239
240# TODO: re-enable i387/e_sqrtf.S for x86, and maybe others.
241
242libm_common_cflags := \
243    -DFLT_EVAL_METHOD=0 \
244    -std=c99 \
245    -include $(LOCAL_PATH)/freebsd-compat.h \
246    -Wno-missing-braces \
247    -Wno-parentheses \
248    -Wno-sign-compare \
249    -Wno-uninitialized \
250    -Wno-unknown-pragmas \
251    -fvisibility=hidden \
252
253# Workaround the GCC "(long)fn -> lfn" optimization bug which will result in
254# self recursions for lrint, lrintf, and lrintl.
255# BUG: 14225968
256libm_common_cflags += -fno-builtin-rint -fno-builtin-rintf -fno-builtin-rintl
257
258libm_common_includes := $(LOCAL_PATH)/upstream-freebsd/lib/msun/src/
259
260libm_ld_includes := $(LOCAL_PATH)/upstream-freebsd/lib/msun/ld128/
261
262#
263# libm.a for target.
264#
265include $(CLEAR_VARS)
266ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
267# Clang has wrong long double sizes for x86.
268LOCAL_CLANG := false
269endif
270LOCAL_MODULE:= libm
271LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
272LOCAL_ARM_MODE := arm
273LOCAL_CFLAGS := $(libm_common_cflags)
274LOCAL_C_INCLUDES += $(libm_common_includes)
275LOCAL_SRC_FILES := $(libm_common_src_files)
276LOCAL_SYSTEM_SHARED_LIBRARIES := libc
277
278LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
279
280# arch-specific settings
281LOCAL_C_INCLUDES_arm := $(LOCAL_PATH)/arm
282LOCAL_SRC_FILES_arm := arm/fenv.c
283
284LOCAL_C_INCLUDES_arm64 := $(libm_ld_includes)
285LOCAL_SRC_FILES_arm64 := arm64/fenv.c $(libm_ld_src_files)
286
287LOCAL_C_INCLUDES_x86 := $(LOCAL_PATH)/i387
288LOCAL_SRC_FILES_x86 := i387/fenv.c
289
290LOCAL_C_INCLUDES_x86_64 := $(libm_ld_includes)
291LOCAL_SRC_FILES_x86_64 := amd64/fenv.c $(libm_ld_src_files)
292
293LOCAL_SRC_FILES_mips := mips/fenv.c
294
295LOCAL_C_INCLUDES_mips64 := $(libm_ld_includes)
296LOCAL_SRC_FILES_mips64 := mips/fenv.c $(libm_ld_src_files)
297
298include $(BUILD_STATIC_LIBRARY)
299
300#
301# libm.so for target.
302#
303include $(CLEAR_VARS)
304ifneq (,$(filter $(TARGET_ARCH),x86 x86_64))
305# Clang has wrong long double sizes for x86.
306LOCAL_CLANG := false
307endif
308LOCAL_MODULE:= libm
309LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk
310LOCAL_SYSTEM_SHARED_LIBRARIES := libc
311LOCAL_WHOLE_STATIC_LIBRARIES := libm
312
313LOCAL_NATIVE_COVERAGE := $(bionic_coverage)
314
315# We'd really like to do this for all architectures, but since this wasn't done
316# before, these symbols must continue to be exported on LP32 for binary
317# compatibility.
318LOCAL_LDFLAGS_arm64 := -Wl,--exclude-libs,libgcc.a
319LOCAL_LDFLAGS_mips64 := -Wl,--exclude-libs,libgcc.a
320LOCAL_LDFLAGS_x86_64 := -Wl,--exclude-libs,libgcc.a
321include $(BUILD_SHARED_LIBRARY)
322endif
323