summaryrefslogtreecommitdiff
path: root/libm
diff options
context:
space:
mode:
Diffstat (limited to 'libm')
-rw-r--r--libm/Makefile46
-rw-r--r--libm/powerpc/Makefile31
2 files changed, 36 insertions, 41 deletions
diff --git a/libm/Makefile b/libm/Makefile
index d8927a89a..00d29d589 100644
--- a/libm/Makefile
+++ b/libm/Makefile
@@ -36,19 +36,22 @@ include $(TOPDIR)Rules.mak
CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
+
+ALL_SUBDIRS = powerpc
+
DIRS =
ifeq ($(strip $(HAS_FPU)),y)
ifeq ($(TARGET_ARCH),$(wildcard $(TARGET_ARCH)))
DIRS = $(TARGET_ARCH)
endif
endif
-ALL_SUBDIRS = powerpc
+LIB_NAME=libm
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
+SO_FULL_NAME=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-LIBM=libm.a
-LIBM_SHARED=libm.so
-LIBM_SHARED_FULLNAME=libm-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
FL_MSRC = float_wrappers.c
ifeq ($(strip $(DO_C99_MATH)),y)
@@ -92,26 +95,25 @@ endif
COBJS=$(patsubst %.c,%.o, $(CSRC))
OBJS=$(COBJS) $(FL_MOBJ)
+ifeq ($(strip $(HAVE_SHARED)),y)
+all: $(SO_LIB_NAME)
+else
+all: subdirs
+endif
-all: $(LIBM) subdirs
-
-ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBM) $(OBJS)
-$(LIBM): ar-target
+$(AR_LIB_NAME): $(OBJS)
$(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBM)
- $(INSTALL) -m 644 $(LIBM) $(TOPDIR)lib
+ $(RM) $(AR_LIB_NAME)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
-shared: all
- $(LD) $(LDFLAGS) -soname=$(LIBM_SHARED).$(MAJOR_VERSION) \
- -o $(LIBM_SHARED_FULLNAME) --whole-archive $(LIBM) \
+$(SO_LIB_NAME): subdirs
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION) $(SO_LIB_NAME)
+ $(LD) $(LDFLAGS) -soname=$(LIB_NAME).so.$(MAJOR_VERSION) \
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive $(AR_LIB_NAME) \
--no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
-L$(TOPDIR)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
- $(INSTALL) -d $(TOPDIR)lib
- $(RM) $(TOPDIR)lib/$(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION)
- $(INSTALL) -m 644 $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib
- $(LN) -sf $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED)
- $(LN) -sf $(LIBM_SHARED_FULLNAME) $(TOPDIR)lib/$(LIBM_SHARED).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME).$(MAJOR_VERSION)
+ $(LN) -sf $(SO_FULL_NAME) $(SO_LIB_NAME)
$(COBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
@@ -125,12 +127,12 @@ tags:
ctags -R
clean: subdirs_clean
- $(RM) *.[oa] *~ core $(LIBM) $(LIBM_SHARED_FULLNAME)
+ $(RM) *.o *~ core
subdirs: $(patsubst %, _dir_%, $(DIRS))
subdirs_clean: $(patsubst %, _dirclean_%, $(ALL_SUBDIRS))
-$(patsubst %, _dir_%, $(DIRS)): ar-target
+$(patsubst %, _dir_%, $(DIRS)): $(AR_LIB_NAME)
$(MAKE) -C $(patsubst _dir_%, %, $@)
$(patsubst %, _dirclean_%, $(ALL_SUBDIRS)): dummy
diff --git a/libm/powerpc/Makefile b/libm/powerpc/Makefile
index 342c182ba..a81edeb9a 100644
--- a/libm/powerpc/Makefile
+++ b/libm/powerpc/Makefile
@@ -34,39 +34,32 @@
TOPDIR=../../
include $(TOPDIR)Rules.mak
-LIBM=../libm.a
+CFLAGS+=$(SSP_ALL_CFLAGS)
+
CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
+LIB_NAME=libm
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
+
ifeq ($(strip $(DO_C99_MATH)),y)
-CSRC = s_ceil.c s_copysign.c s_floor.c s_frexp.c s_ldexp.c s_logb.c s_modf.c \
- s_nearbyint.c s_rint.c s_round.c s_trunc.c w_scalb.c
+CSRC = $(wildcard *.c)
else
CSRC =
endif
-COBJS=$(patsubst %.c,%.o, $(CSRC))
-OBJS=$(COBJS)
+OBJS=$(patsubst %.c,%.o, $(CSRC))
-ifneq ($(strip $(UCLIBC_HAS_FLOATS)),y)
-all: clean
-else
-all: $(OBJS) $(LIBM)
-endif
+all: add_to_archive
-$(LIBM): ar-target
+add_to_archive: $(OBJS)
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) $(OBJS)
-ar-target: $(OBJS)
- $(AR) $(ARFLAGS) $(LIBM) $(OBJS)
-
-$(COBJS): %.o : %.c
+$(OBJS): %.o : %.c
$(CC) $(CFLAGS) -c $< -o $@
$(STRIPTOOL) -x -R .note -R .comment $*.o
-$(OBJ): Makefile
-
tags:
ctags -R
clean:
- $(RM) *.[oa] *~ core
-
+ $(RM) *.o *~ core