summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libm/Makefile29
-rw-r--r--libm/powerpc/Makefile60
-rw-r--r--libm/powerpc/ceilfloor.c (renamed from libm/ceilfloor.c)7
-rw-r--r--libm/powerpc/frexpldexp.c (renamed from libm/frexpldexp.c)3
-rw-r--r--libm/powerpc/logb.c (renamed from libm/logb.c)3
-rw-r--r--libm/powerpc/rndint.c (renamed from libm/rndint.c)12
-rw-r--r--libm/powerpc/scalb.c (renamed from libm/scalb.c)2
-rw-r--r--libm/powerpc/sign.c (renamed from libm/sign.c)2
-rw-r--r--libm/s_ceil.c3
-rw-r--r--libm/s_copysign.c3
-rw-r--r--libm/s_floor.c2
-rw-r--r--libm/s_frexp.c2
-rw-r--r--libm/s_ldexp.c2
-rw-r--r--libm/s_logb.c2
-rw-r--r--libm/s_modf.c2
-rw-r--r--libm/s_rint.c2
-rw-r--r--libm/w_scalb.c2
17 files changed, 88 insertions, 50 deletions
diff --git a/libm/Makefile b/libm/Makefile
index c82ca3f..e9c7c80 100644
--- a/libm/Makefile
+++ b/libm/Makefile
@@ -22,6 +22,14 @@
TOPDIR=../
include $(TOPDIR)Rules.mak
+ifeq ($(TARGET_ARCH),$(wildcard $(TARGET_ARCH)))
+DIRS = $(TARGET_ARCH)
+else
+DIRS =
+endif
+ALL_SUBDIRS = powerpc
+
+
LIBM=libm.a
LIBM_SHARED=libm.so
LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).so
@@ -43,8 +51,7 @@ CSRC = e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c\
w_cosh.c w_drem.c w_exp.c w_fmod.c w_gamma.c w_gamma_r.c\
w_hypot.c w_j0.c w_j1.c w_jn.c w_lgamma.c w_lgamma_r.c\
w_log.c w_log10.c w_pow.c w_remainder.c w_scalb.c w_sinh.c\
- w_sqrt.c ceilfloor.c fpmacros.c frexpldexp.c logb.c rndint.c\
- scalb.c sign.c
+ w_sqrt.c fpmacros.c
else
CSRC = w_acos.c w_asin.c s_atan.c w_atan2.c s_ceil.c s_cos.c \
w_cosh.c w_exp.c s_expm1.c s_fabs.c s_floor.c w_fmod.c \
@@ -59,9 +66,9 @@ OBJS=$(COBJS)
ifneq ($(strip $(HAS_FLOATING_POINT)),true)
-all: clean
+all: clean subdirs
else
-all: $(OBJS) $(COBJS1) $(LIBM)
+all: $(OBJS) $(LIBM) subdirs
endif
$(LIBM): ar-target
@@ -90,11 +97,21 @@ $(COBJS): %.o : %.c
$(STRIPTOOL) -x -R .note -R .comment $*.o
$(OBJ): Makefile
-$(COBJS1): Makefile
tags:
ctags -R
-clean:
+clean: subdirs_clean
rm -f *.[oa] *~ core $(LIBM_SHARED)* $(LIBM_SHARED_FULLNAME)*
+subdirs: $(patsubst %, _dir_%, $(DIRS))
+subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
+
+$(patsubst %, _dir_%, $(DIRS)) : dummy
+ $(MAKE) -C $(patsubst _dir_%, %, $@)
+
+$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)) : dummy
+ $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
+
+.PHONY: dummy
+
diff --git a/libm/powerpc/Makefile b/libm/powerpc/Makefile
new file mode 100644
index 0000000..7464ee0
--- /dev/null
+++ b/libm/powerpc/Makefile
@@ -0,0 +1,60 @@
+# Makefile for uClibc's math library
+# Copyright (C) 2001 by Lineo, inc.
+#
+# This math library is derived primarily from the Cephes Math Library,
+# copyright by Stephen L. Moshier <moshier@world.std.com>
+#
+# This program is free software; you can redistribute it and/or modify it under
+# the terms of the GNU Library General Public License as published by the Free
+# Software Foundation; either version 2 of the License, or (at your option) any
+# later version.
+#
+# This program is distributed in the hope that it will be useful, but WITHOUT
+# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
+# FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more
+# details.
+#
+# You should have received a copy of the GNU Library General Public License
+# along with this program; if not, write to the Free Software Foundation, Inc.,
+# 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+#
+
+TOPDIR=../../
+include $(TOPDIR)Rules.mak
+
+LIBM=../libm.a
+TARGET_CC= $(TOPDIR)extra/gcc-uClibc/$(TARGET_ARCH)-uclibc-gcc
+TARGET_CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
+
+ifeq ($(strip $(DO_C99_MATH)),true)
+CSRC = ceilfloor.c frexpldexp.c logb.c rndint.c scalb.c sign.c
+else
+CSRC =
+endif
+COBJS=$(patsubst %.c,%.o, $(CSRC))
+OBJS=$(COBJS)
+
+
+ifneq ($(strip $(HAS_FLOATING_POINT)),true)
+all: clean
+else
+all: $(OBJS) $(LIBM)
+endif
+
+$(LIBM): ar-target
+
+ar-target: $(OBJS)
+ $(AR) $(ARFLAGS) $(LIBM) $(OBJS)
+
+$(COBJS): %.o : %.c
+ $(TARGET_CC) $(TARGET_CFLAGS) -c $< -o $@
+ $(STRIPTOOL) -x -R .note -R .comment $*.o
+
+$(OBJ): Makefile
+
+tags:
+ ctags -R
+
+clean:
+ rm -f *.[oa] *~ core $(LIBM_SHARED)* $(LIBM_SHARED_FULLNAME)*
+
diff --git a/libm/ceilfloor.c b/libm/powerpc/ceilfloor.c
index 9607435..d5947ab 100644
--- a/libm/ceilfloor.c
+++ b/libm/powerpc/ceilfloor.c
@@ -1,4 +1,3 @@
-#if defined(__ppc__)
/*******************************************************************************
* *
* File ceilfloor.c, *
@@ -22,10 +21,6 @@
* *
*******************************************************************************/
-#if !defined(__ppc__)
-#define asm(x)
-#endif
-
static const double twoTo52 = 4503599627370496.0;
static const unsigned long signMask = 0x80000000ul;
@@ -176,4 +171,4 @@ double floor ( double x )
*******************************************************************************/
return ( x );
}
-#endif /* __ppc__ */
+
diff --git a/libm/frexpldexp.c b/libm/powerpc/frexpldexp.c
index dbb6fcc..6b759f9 100644
--- a/libm/frexpldexp.c
+++ b/libm/powerpc/frexpldexp.c
@@ -1,4 +1,3 @@
-#if defined(__ppc__)
/*******************************************************************************
* *
* File frexpldexp.c, *
@@ -70,4 +69,4 @@ double frexp ( double value, int *eptr )
argument.words.hi = ( argument.words.hi & 0x800fffff ) | 0x3fe00000;
return argument.dbl;
}
-#endif /* __ppc__ */
+
diff --git a/libm/logb.c b/libm/powerpc/logb.c
index da2a27d..3a410ba 100644
--- a/libm/logb.c
+++ b/libm/powerpc/logb.c
@@ -1,4 +1,3 @@
-#if defined(__ppc__)
/*******************************************************************************
* *
* File logb.c, *
@@ -101,4 +100,4 @@ double logb ( double x )
return ( xInHex.dbl - klTod );
}
}
-#endif /* __ppc__ */
+
diff --git a/libm/rndint.c b/libm/powerpc/rndint.c
index 7f8c183..1b7a9ec 100644
--- a/libm/rndint.c
+++ b/libm/powerpc/rndint.c
@@ -47,10 +47,6 @@
#include <limits.h>
#include <math.h>
-#if !defined(__ppc__)
-#define asm(x)
-#endif
-
#define SET_INVALID 0x01000000UL
typedef union
@@ -108,7 +104,6 @@ static const DblInHex TOWARDZERO = {{ 0x00000000, 0x00000001 }};
* Now a bit twidling version that is about %30 faster. *
*******************************************************************************/
-#if defined(__ppc__)
double rint ( double x )
{
DblInHex argument;
@@ -159,7 +154,6 @@ double rint ( double x )
*******************************************************************************/
return ( x );
}
-#endif /* __ppc__ */
/*******************************************************************************
* *
@@ -176,9 +170,7 @@ double rint ( double x )
double nearbyint ( double x )
{
double y;
-#if defined(__ppc__)
double OldEnvironment;
-#endif /* __ppc__ */
y = twoTo52;
@@ -400,10 +392,8 @@ long int roundtol ( double x )
DblInHex argument, OldEnvironment;
register unsigned long int xhi;
register long int target;
-#if defined(__ppc__)
const DblInHex kTZ = {{ 0x0, 0x1 }};
const DblInHex kUP = {{ 0x0, 0x2 }};
-#endif /* __ppc__ */
argument.dbl = x;
xhi = argument.words.hi & 0x7ffffffful; // high 32 bits of x
@@ -568,7 +558,6 @@ double trunc ( double x )
* modf is the double implementation. *
*******************************************************************************/
-#if defined(__ppc__)
double modf ( double x, double *iptr )
{
register double OldEnvironment, xtrunc;
@@ -629,4 +618,3 @@ double modf ( double x, double *iptr )
return ( argument.dbl );
}
}
-#endif /* __ppc__ */
diff --git a/libm/scalb.c b/libm/powerpc/scalb.c
index 03d2de9..98a2b7d 100644
--- a/libm/scalb.c
+++ b/libm/powerpc/scalb.c
@@ -1,4 +1,3 @@
-#if defined(__ppc__)
/***********************************************************************
** File: scalb.c
**
@@ -84,4 +83,3 @@ double scalb ( double x, int n )
xInHex.words.hi = ( ( unsigned long ) ( n + 1023 ) ) << 20;
return ( x * xInHex.dbl );
}
-#endif /* __ppc__ */
diff --git a/libm/sign.c b/libm/powerpc/sign.c
index 524d6af..0bf2f38 100644
--- a/libm/sign.c
+++ b/libm/powerpc/sign.c
@@ -1,4 +1,3 @@
-#if defined(__ppc__)
/*******************************************************************************
* *
* File sign.c, *
@@ -55,4 +54,3 @@ double copysign ( double arg2, double arg1 )
return y.dbl;
}
-#endif /* __ppc__ */
diff --git a/libm/s_ceil.c b/libm/s_ceil.c
index f17b314..8616d0f 100644
--- a/libm/s_ceil.c
+++ b/libm/s_ceil.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_ceil.c 5.1 93/09/24 */
/*
* ====================================================
@@ -79,4 +78,4 @@ static double huge = 1.0e300;
INSERT_WORDS(x,i0,i1);
return x;
}
-#endif /* !__ppc__ */
+
diff --git a/libm/s_copysign.c b/libm/s_copysign.c
index 666c34a..63261fc 100644
--- a/libm/s_copysign.c
+++ b/libm/s_copysign.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_copysign.c 5.1 93/09/24 */
/*
* ====================================================
@@ -37,4 +36,4 @@ static char rcsid[] = "$NetBSD: s_copysign.c,v 1.8 1995/05/10 20:46:57 jtc Exp $
SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
return x;
}
-#endif
+
diff --git a/libm/s_floor.c b/libm/s_floor.c
index 375dc5a..5a36b2d 100644
--- a/libm/s_floor.c
+++ b/libm/s_floor.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_floor.c 5.1 93/09/24 */
/*
* ====================================================
@@ -80,4 +79,3 @@ static double huge = 1.0e300;
INSERT_WORDS(x,i0,i1);
return x;
}
-#endif /* !__ppc__ */
diff --git a/libm/s_frexp.c b/libm/s_frexp.c
index f187d84..bfc9dba 100644
--- a/libm/s_frexp.c
+++ b/libm/s_frexp.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_frexp.c 5.1 93/09/24 */
/*
* ====================================================
@@ -58,4 +57,3 @@ two54 = 1.80143985094819840000e+16; /* 0x43500000, 0x00000000 */
SET_HIGH_WORD(x,hx);
return x;
}
-#endif /* !__ppc__ */
diff --git a/libm/s_ldexp.c b/libm/s_ldexp.c
index 5e7313e..085823a 100644
--- a/libm/s_ldexp.c
+++ b/libm/s_ldexp.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_ldexp.c 5.1 93/09/24 */
/*
* ====================================================
@@ -31,4 +30,3 @@ static char rcsid[] = "$NetBSD: s_ldexp.c,v 1.6 1995/05/10 20:47:40 jtc Exp $";
if(!finite(value)||value==0.0) errno = ERANGE;
return value;
}
-#endif /* !__ppc__ */
diff --git a/libm/s_logb.c b/libm/s_logb.c
index 7ec1c36..02bb99f 100644
--- a/libm/s_logb.c
+++ b/libm/s_logb.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_logb.c 5.1 93/09/24 */
/*
* ====================================================
@@ -41,4 +40,3 @@ static char rcsid[] = "$NetBSD: s_logb.c,v 1.8 1995/05/10 20:47:50 jtc Exp $";
else
return (double) (ix-1023);
}
-#endif /* !__ppc__ */
diff --git a/libm/s_modf.c b/libm/s_modf.c
index 2d3e537..9d71c01 100644
--- a/libm/s_modf.c
+++ b/libm/s_modf.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_modf.c 5.1 93/09/24 */
/*
* ====================================================
@@ -82,4 +81,3 @@ static double one = 1.0;
}
}
}
-#endif /* !__ppc__ */
diff --git a/libm/s_rint.c b/libm/s_rint.c
index b2d9c0e..8808857 100644
--- a/libm/s_rint.c
+++ b/libm/s_rint.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)s_rint.c 5.1 93/09/24 */
/*
* ====================================================
@@ -85,4 +84,3 @@ TWO52[2]={
w = TWO52[sx]+x;
return w-TWO52[sx];
}
-#endif /* !__ppc__ */
diff --git a/libm/w_scalb.c b/libm/w_scalb.c
index bde5f70..50026be 100644
--- a/libm/w_scalb.c
+++ b/libm/w_scalb.c
@@ -1,4 +1,3 @@
-#if !defined(__ppc__)
/* @(#)w_scalb.c 5.1 93/09/24 */
/*
* ====================================================
@@ -59,4 +58,3 @@ static char rcsid[] = "$NetBSD: w_scalb.c,v 1.6 1995/05/10 20:49:48 jtc Exp $";
return z;
#endif
}
-#endif /* !__ppc__ */