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
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 \
ifneq ($(strip $(HAS_FLOATING_POINT)),true)
-all: clean
+all: clean subdirs
else
-all: $(OBJS) $(COBJS1) $(LIBM)
+all: $(OBJS) $(LIBM) subdirs
endif
$(LIBM): ar-target
$(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
+
--- /dev/null
+# 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)*
+
-#if defined(__ppc__)
/*******************************************************************************
* *
* File ceilfloor.c, *
* *
*******************************************************************************/
-#if !defined(__ppc__)
-#define asm(x)
-#endif
-
static const double twoTo52 = 4503599627370496.0;
static const unsigned long signMask = 0x80000000ul;
*******************************************************************************/
return ( x );
}
-#endif /* __ppc__ */
+
-#if defined(__ppc__)
/*******************************************************************************
* *
* File frexpldexp.c, *
argument.words.hi = ( argument.words.hi & 0x800fffff ) | 0x3fe00000;
return argument.dbl;
}
-#endif /* __ppc__ */
+
-#if defined(__ppc__)
/*******************************************************************************
* *
* File logb.c, *
return ( xInHex.dbl - klTod );
}
}
-#endif /* __ppc__ */
+
#include <limits.h>
#include <math.h>
-#if !defined(__ppc__)
-#define asm(x)
-#endif
-
#define SET_INVALID 0x01000000UL
typedef union
* Now a bit twidling version that is about %30 faster. *
*******************************************************************************/
-#if defined(__ppc__)
double rint ( double x )
{
DblInHex argument;
*******************************************************************************/
return ( x );
}
-#endif /* __ppc__ */
/*******************************************************************************
* *
double nearbyint ( double x )
{
double y;
-#if defined(__ppc__)
double OldEnvironment;
-#endif /* __ppc__ */
y = twoTo52;
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
* modf is the double implementation. *
*******************************************************************************/
-#if defined(__ppc__)
double modf ( double x, double *iptr )
{
register double OldEnvironment, xtrunc;
return ( argument.dbl );
}
}
-#endif /* __ppc__ */
-#if defined(__ppc__)
/***********************************************************************
** File: scalb.c
**
xInHex.words.hi = ( ( unsigned long ) ( n + 1023 ) ) << 20;
return ( x * xInHex.dbl );
}
-#endif /* __ppc__ */
-#if defined(__ppc__)
/*******************************************************************************
* *
* File sign.c, *
return y.dbl;
}
-#endif /* __ppc__ */
-#if !defined(__ppc__)
/* @(#)s_ceil.c 5.1 93/09/24 */
/*
* ====================================================
INSERT_WORDS(x,i0,i1);
return x;
}
-#endif /* !__ppc__ */
+
-#if !defined(__ppc__)
/* @(#)s_copysign.c 5.1 93/09/24 */
/*
* ====================================================
SET_HIGH_WORD(x,(hx&0x7fffffff)|(hy&0x80000000));
return x;
}
-#endif
+
-#if !defined(__ppc__)
/* @(#)s_floor.c 5.1 93/09/24 */
/*
* ====================================================
INSERT_WORDS(x,i0,i1);
return x;
}
-#endif /* !__ppc__ */
-#if !defined(__ppc__)
/* @(#)s_frexp.c 5.1 93/09/24 */
/*
* ====================================================
SET_HIGH_WORD(x,hx);
return x;
}
-#endif /* !__ppc__ */
-#if !defined(__ppc__)
/* @(#)s_ldexp.c 5.1 93/09/24 */
/*
* ====================================================
if(!finite(value)||value==0.0) errno = ERANGE;
return value;
}
-#endif /* !__ppc__ */
-#if !defined(__ppc__)
/* @(#)s_logb.c 5.1 93/09/24 */
/*
* ====================================================
else
return (double) (ix-1023);
}
-#endif /* !__ppc__ */
-#if !defined(__ppc__)
/* @(#)s_modf.c 5.1 93/09/24 */
/*
* ====================================================
}
}
}
-#endif /* !__ppc__ */
-#if !defined(__ppc__)
/* @(#)s_rint.c 5.1 93/09/24 */
/*
* ====================================================
w = TWO52[sx]+x;
return w-TWO52[sx];
}
-#endif /* !__ppc__ */
-#if !defined(__ppc__)
/* @(#)w_scalb.c 5.1 93/09/24 */
/*
* ====================================================
return z;
#endif
}
-#endif /* !__ppc__ */