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