3 # Copyright (C) 2000-2008 Erik Andersen <andersen@uclibc.org>
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
7 # The routines included in this math library are derived from the
8 # math library for Apple's MacOS X/Darwin math library, which was
9 # itself swiped from FreeBSD. The original copyright information
12 # Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
14 # Developed at SunPro, a Sun Microsystems, Inc. business.
15 # Permission to use, copy, modify, and distribute this
16 # software is freely granted, provided that this notice
19 # It has been ported to work with uClibc and generally behave
20 # by Erik Andersen <andersen@codepoet.org>
23 subdirs
+= libm libm
/$(TARGET_ARCH
)
25 CFLAGS-libm
:= -DNOT_IN_libc
-DIS_IN_libm
$(SSP_ALL_CFLAGS
)
27 libm_DIR
:=$(top_srcdir
)libm
28 libm_OUT
:=$(top_builddir
)libm
30 libm_ARCH_DIR
:=$(libm_DIR
)/$(TARGET_ARCH
)
31 libm_ARCH_OUT
:=$(libm_OUT
)/$(TARGET_ARCH
)
33 ifneq ($(TARGET_SUBARCH
),)
34 libm_SUBARCH_DIR
:=$(libm_DIR
)/$(TARGET_ARCH
)/$(TARGET_SUBARCH
)
35 libm_SUBARCH_OUT
:=$(libm_OUT
)/$(TARGET_ARCH
)/$(TARGET_SUBARCH
)
38 ifeq ($(UCLIBC_HAS_FPU
),y
)
39 ifeq ($(DO_C99_MATH
),y
)
40 -include $(libm_ARCH_DIR
)/Makefile.arch
41 -include $(libm_SUBARCH_DIR
)/Makefile.arch
45 FL_MSRC
:= float_wrappers.c
46 LD_MSRC
:= ldouble_wrappers.c
48 ifeq ($(DO_C99_MATH
),y
)
50 e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \
51 e_exp.c e_exp10.c e_fmod.c e_hypot.c \
52 e_lgamma_r.c e_log.c e_log2.c e_log10.c \
53 e_pow.c e_remainder.c e_rem_pio2.c e_scalb.c e_sinh.c \
54 e_sqrt.c k_cos.c k_rem_pio2.c k_sin.c k_tan.c \
55 s_asinh.c s_atan.c s_cbrt.c s_ceil.c s_copysign.c s_cos.c \
56 s_erf.c s_expm1.c s_fabs.c s_finite.c s_floor.c s_frexp.c \
57 s_ilogb.c s_ldexp.c s_lib_version.c s_lrint.c s_lround.c s_llround.c \
58 s_log1p.c s_logb.c s_modf.c s_nextafter.c \
59 s_nextafterf.c s_round.c \
60 s_rint.c s_scalbn.c s_signgam.c s_significand.c s_sin.c s_tan.c \
63 nan.c carg.c s_llrint.c \
64 s_fpclassify.c s_fpclassifyf.c s_signbit.c s_signbitf.c \
65 s_isnan.c s_isnanf.c s_isinf.c s_isinff.c s_finitef.c \
66 s_fdim.c s_fma.c s_fmax.c s_fmin.c \
69 w_acos.c w_acosf.c w_acosl.c \
70 w_asin.c w_asinf.c w_asinl.c \
71 w_atan2.c w_atan2f.c w_atan2l.c \
72 w_hypot.c w_hypotf.c w_hypotl.c \
73 w_cosh.c w_coshf.c w_coshl.c \
74 w_exp.c w_expf.c w_expl.c \
75 w_exp2.c w_exp2f.c w_exp2l.c \
76 w_exp10.c w_exp10f.c w_exp10l.c \
77 w_lgamma_r.c w_lgammaf_r.c w_lgammal_r.c \
78 w_lgamma.c w_lgammaf.c w_lgammal.c \
79 w_tgamma.c w_tgammaf.c w_tgammal.c \
80 w_log.c w_logf.c w_logl.c \
81 w_log2.c w_log2f.c w_log2l.c \
82 w_log10.c w_log10f.c w_log10l.c \
83 w_pow.c w_powf.c w_powl.c \
84 w_sinh.c w_sinhf.c w_sinhl.c \
85 w_fmod.c w_fmodf.c w_fmodl.c \
86 w_sqrt.c w_sqrtf.c w_sqrtl.c \
87 w_remainder.c w_remainderf.c w_remainderl.c \
88 w_acosh.c w_acoshf.c w_acoshl.c \
89 w_atanh.c w_atanhf.c w_atanhl.c \
90 w_scalb.c w_scalbf.c w_scalbl.c
92 ifeq ($(UCLIBC_HAS_FENV
),y
)
93 libm_CSRC
+= k_standard.c k_standardf.c k_standardl.c
156 ifeq ($(UCLIBC_SUSV3_LEGACY
),y
)
160 # Do not (yet?) implement the float variants of bessel functions
161 ifeq (not-yet-implemented-
$(DO_XSI_MATH
),y
)
237 # Do not (yet?) implement the long double variants of bessel functions
238 ifeq (not-yet-implemented-
$(DO_XSI_MATH
),y
)
250 # This list of math functions was taken from POSIX/IEEE 1003.1b-1993
252 s_atan.c s_ceil.c s_cos.c \
253 s_fabs.c s_floor.c s_frexp.c \
254 s_ldexp.c s_modf.c s_sin.c \
256 s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \
257 k_cos.c e_cosh.c e_exp.c e_fmod.c e_log.c e_log10.c e_pow.c \
258 k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
259 s_finite.c e_exp10.c \
260 matherr_wrapers.c k_standart.c
262 # We'll add sqrtf to avoid problems with libstdc++
266 ifeq ($(DO_XSI_MATH
),y
)
268 e_j0.c e_j1.c e_jn.c \
269 w_j0.c w_j0f.c w_j0l.c \
270 w_j1.c w_j1f.c w_j1l.c \
271 w_jn.c w_jnf.c w_jnl.c
274 # assume that arch specific versions are provided as single sources/objects
275 ifeq ($(UCLIBC_HAS_FPU
),y
)
276 ifeq ($(DO_C99_MATH
),y
)
277 ifneq ($(strip $(libm_ARCH_OBJS
)),)
279 # remove generic sources, if arch specific version is present
280 ifneq ($(strip $(libm_ARCH_SRC
)),)
281 libm_CSRC
:= $(filter-out $(notdir $(libm_ARCH_SRC
)),$(libm_CSRC
))
284 # remove generic objects built from multi-sources, if arch specific version is present
285 FL_MOBJ
:= $(filter-out $(notdir $(libm_ARCH_OBJS
)),$(FL_MOBJ
))
286 LD_MOBJ
:= $(filter-out $(notdir $(libm_ARCH_OBJS
)),$(LD_MOBJ
))
288 # we also try to remove % if s_% is in arch specific subdir
289 FL_MOBJ
:= $(filter-out $(patsubst s_
%.o
,%.o
,$(notdir $(libm_ARCH_OBJS
))),$(FL_MOBJ
))
290 LD_MOBJ
:= $(filter-out $(patsubst s_
%.o
,%.o
,$(notdir $(libm_ARCH_OBJS
))),$(LD_MOBJ
))
295 libm_SRC
:= $(patsubst %.c
,$(libm_DIR
)/%.c
,$(libm_CSRC
))
296 libm_OBJ
:= $(patsubst $(libm_DIR
)/%.c
,$(libm_OUT
)/%.o
,$(libm_SRC
))
298 ifeq ($(strip $(UCLIBC_HAS_LONG_DOUBLE_MATH
)),y
)
299 libm_MSRC_LD
:= $(libm_DIR
)/$(LD_MSRC
)
300 libm_MOBJ_LD
:= $(patsubst %.o
,$(libm_OUT
)/%.o
,$(LD_MOBJ
))
302 libm_MSRC_FL
:= $(libm_DIR
)/$(FL_MSRC
)
303 libm_MOBJ_FL
:= $(patsubst %.o
,$(libm_OUT
)/%.o
,$(FL_MOBJ
))
305 libm_OBJS
:= $(libm_OBJ
) $(libm_MOBJ_FL
) $(libm_MOBJ_LD
)
308 libm-a-y
+= $(libm_OBJS
:.o
=.os
)
310 libm-a-y
+= $(libm_OBJS
)
312 libm-so-y
+= $(libm_OBJS
:.o
=.os
)
314 objclean-y
+= CLEAN_libm
316 $(libm_OUT
)/libm.oS
: $(libm_SRC
) $(libm_MSRC_FL
) $(libm_MSRC_LD
) $(libm_ARCH_SRC
)
320 $(libm_MOBJ_FL
): $(libm_MSRC_FL
)
323 $(libm_MOBJ_LD
): $(libm_MSRC_LD
)
326 $(libm_MOBJ_FL
:.o
=.os
): $(libm_MSRC_FL
)
329 $(libm_MOBJ_LD
:.o
=.os
): $(libm_MSRC_LD
)
332 # spare us from adding a gazillion dummy two-liner files
333 $(libm_MOBJ_FL
:.o
=.i
): $(libm_MSRC_FL
)
336 $(libm_MOBJ_LD
:.o
=.i
): $(libm_MSRC_LD
)
340 $(do_rm
) $(addprefix $(libm_OUT
)/,$(foreach e
, o os oS a
,$(foreach d
, *.
*/*.
*/*/*.
,$(d
)$(e
))))