OSDN Git Service

import trunc()/truncf() for ISO C requirements, otherwise fortran can hit infinite...
[uclinux-h8/uClibc.git] / libm / Makefile.in
1 # Makefile for uClibc
2 #
3 # Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org>
4 #
5 # Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
6 #
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
10 # is as follows:
11 #
12 #     Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
13 #
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
17 #     is preserved.
18 #
19 # It has been ported to work with uClibc and generally behave
20 # by Erik Andersen <andersen@codepoet.org>
21 #
22
23 CFLAGS-libm := -DNOT_IN_libc -DIS_IN_libm $(SSP_ALL_CFLAGS)
24 CFLAGS-libm += -D_IEEE_LIBM
25
26 LDFLAGS-libm.so := $(LDFLAGS)
27
28 LIBS-libm.so := $(LIBS)
29
30 libm_FULL_NAME := libm-$(VERSION).so
31
32
33 # Fix builds for powerpc as there are different cores in this 
34 # section now.`
35 ifeq ($(TARGET_ARCH),powerpc)
36 ifeq ($(CONFIG_E500),y)
37 libm_ARCH_DIR:=$(top_srcdir)libm/$(TARGET_ARCH)/e500
38 libm_ARCH_OUT:=$(top_builddir)libm/$(TARGET_ARCH)/e500
39 else
40 libm_ARCH_DIR:=$(top_srcdir)libm/$(TARGET_ARCH)/classic
41 libm_ARCH_OUT:=$(top_builddir)libm/$(TARGET_ARCH)/classic
42 endif
43 else
44 libm_ARCH_DIR:=$(top_srcdir)libm/$(TARGET_ARCH)
45 libm_ARCH_OUT:=$(top_builddir)libm/$(TARGET_ARCH)
46 endif
47
48 libm_ARCH_fpu_DIR:=$(libm_ARCH_DIR)/fpu
49 libm_ARCH_fpu_OUT:=$(libm_ARCH_OUT)/fpu
50
51 ifeq ($(UCLIBC_HAS_FPU),y)
52 ifeq ($(DO_C99_MATH),y)
53 -include $(libm_ARCH_DIR)/Makefile.arch
54 endif
55 endif
56
57 FL_MSRC := float_wrappers.c
58
59 ifeq ($(DO_C99_MATH),y)
60 libm_CSRC := \
61         e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \
62         e_exp.c e_fmod.c e_gamma.c e_gamma_r.c e_hypot.c e_j0.c \
63         e_j1.c e_jn.c e_lgamma.c e_lgamma_r.c e_log.c e_log10.c \
64         e_pow.c e_remainder.c e_rem_pio2.c e_scalb.c e_sinh.c \
65         e_sqrt.c k_cos.c k_rem_pio2.c k_sin.c k_standard.c k_tan.c \
66         s_asinh.c s_atan.c s_cbrt.c s_ceil.c s_copysign.c s_cos.c \
67         s_erf.c s_expm1.c s_fabs.c s_finite.c s_floor.c s_frexp.c \
68         s_ilogb.c s_ldexp.c s_lib_version.c s_lrint.c s_lround.c s_llround.c \
69         s_log1p.c s_logb.c s_matherr.c s_modf.c s_nextafter.c s_round.c \
70         s_rint.c s_scalbn.c s_signgam.c s_significand.c s_sin.c s_tan.c \
71         s_tanh.c s_trunc.c w_acos.c w_acosh.c w_asin.c w_atan2.c w_atanh.c \
72         w_cabs.c w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c w_gamma_r.c \
73         w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c w_lgamma_r.c \
74         w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c \
75         w_sqrt.c fpmacros.c nan.c carg.c s_llrint.c
76 FL_MOBJ := \
77         acosf.o acoshf.o asinf.o asinhf.o atan2f.o atanf.o atanhf.o cbrtf.o \
78         ceilf.o copysignf.o cosf.o coshf.o erfcf.o erff.o exp2f.o expf.o \
79         expm1f.o fabsf.o fdimf.o floorf.o fmaf.o fmaxf.o fminf.o fmodf.o \
80         frexpf.o hypotf.o ilogbf.o ldexpf.o lgammaf.o llroundf.o log10f.o \
81         log1pf.o log2f.o logbf.o logf.o lrintf.o lroundf.o modff.o nearbyintf.o \
82         nextafterf.o powf.o remainderf.o remquof.o rintf.o roundf.o \
83         scalblnf.o scalbnf.o sinf.o sinhf.o sqrtf.o tanf.o tanhf.o \
84         tgammaf.o truncf.o cargf.o llrintf.o
85 else
86 # This list of math functions was taken from POSIX/IEEE 1003.1b-1993
87 libm_CSRC := \
88         w_acos.c w_asin.c s_atan.c w_atan2.c s_ceil.c s_cos.c \
89         w_cosh.c w_exp.c s_fabs.c s_floor.c w_fmod.c s_frexp.c \
90         s_ldexp.c w_log.c w_log10.c s_modf.c w_pow.c s_sin.c \
91         w_sinh.c w_sqrt.c s_tan.c s_tanh.c \
92         s_expm1.c s_scalbn.c s_copysign.c e_acos.c e_asin.c e_atan2.c \
93         k_cos.c e_cosh.c e_exp.c e_fmod.c e_log.c e_log10.c e_pow.c \
94         k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
95         s_finite.c
96 # We'll add sqrtf to avoid problems with libstdc++
97 FL_MOBJ := sqrtf.o
98 endif
99
100 libm_DIR := $(top_srcdir)libm
101 libm_OUT := $(top_builddir)libm
102
103 # assume that arch specific versions are provided as single sources/objects
104 ifeq ($(UCLIBC_HAS_FPU),y)
105 ifeq ($(DO_C99_MATH),y)
106 ifneq ($(strip $(libm_ARCH_OBJS)),)
107 ifeq ($(TARGET_ARCH),powerpc)
108 ifeq ($(CONFIG_E500),y)
109 CFLAGS-libm/$(TARGET_ARCH)/e500/ := $(CFLAGS-libm)
110 else
111 CFLAGS-libm/$(TARGET_ARCH)/classic/ := $(CFLAGS-libm)
112 endif
113 else
114 CFLAGS-libm/$(TARGET_ARCH)/ := $(CFLAGS-libm)
115 endif
116
117 # remove generic sources, if arch specific version is present
118 ifneq ($(strip $(libm_ARCH_SRC)),)
119 libm_CSRC := $(filter-out $(notdir $(libm_ARCH_SRC)),$(libm_CSRC))
120 endif
121
122 # remove generic objects built from multi-sources, if arch specific version is present
123 FL_MOBJ := $(filter-out $(notdir $(libm_ARCH_OBJS)),$(FL_MOBJ))
124
125 # we also try to remove % if s_% is in arch specific subdir
126 FL_MOBJ := $(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOBJ))
127 endif
128 endif
129 endif
130
131 libm_SRC := $(patsubst %.c,$(libm_DIR)/%.c,$(libm_CSRC))
132 libm_OBJ := $(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC))
133
134 libm_MSRC := $(libm_DIR)/$(FL_MSRC)
135 libm_MOBJ := $(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ))
136
137 ifneq ($(DOMULTI),n)
138 CFLAGS-libm += $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ))))
139 endif
140
141 libm_OBJS := $(libm_OBJ) $(libm_MOBJ)
142
143 ifeq ($(DOPIC),y)
144 libm-a-y += $(libm_OBJS:.o=.os)
145 else
146 libm-a-y += $(libm_OBJS)
147 endif
148 libm-so-y += $(libm_OBJS:.o=.os)
149
150 lib-a-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.a
151 lib-so-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.so
152 objclean-y += libm_clean
153
154 ifeq ($(DOMULTI),n)
155 ifeq ($(DOPIC),y)
156 $(top_builddir)lib/libm.so: $(top_builddir)lib/libm.a $(libc)
157 else
158 $(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a $(libc)
159 endif
160         $(call link.so,$(libm_FULL_NAME),$(MAJOR_VERSION))
161 else
162 $(top_builddir)lib/libm.so: $(libm_OUT)/libm.oS | $(libc)
163         $(call linkm.so,$(libm_FULL_NAME),$(MAJOR_VERSION))
164 endif
165
166 $(libm_OUT)/libm_so.a: $(libm-so-y)
167         $(Q)$(RM) $@
168         $(do_strip)
169         $(do_ar)
170
171 $(libm_OUT)/libm.oS: $(libm_SRC) $(libm_MSRC) $(libm_ARCH_SRC)
172         $(Q)$(RM) $@
173         $(compile-m)
174         $(do_t_strip)
175
176 $(top_builddir)lib/libm.a: $(libm-a-y)
177         $(Q)$(INSTALL) -d $(dir $@)
178         $(Q)$(RM) $@
179         $(do_strip)
180         $(do_ar)
181
182 $(libm_MOBJ): $(libm_MSRC)
183         $(compile.m)
184
185 $(libm_MOBJ:.o=.os): $(libm_MSRC)
186         $(compile.m)
187
188 libm_clean:
189         $(RM) $(libm_OUT)/{,*/,*/*/}*.{o,os,oS,a}