summaryrefslogtreecommitdiff
path: root/libc
diff options
context:
space:
mode:
Diffstat (limited to 'libc')
-rw-r--r--libc/Makefile.in63
-rw-r--r--libc/misc/internals/Makefile.in9
2 files changed, 49 insertions, 23 deletions
diff --git a/libc/Makefile.in b/libc/Makefile.in
index 1e0b58437..50201d4fd 100644
--- a/libc/Makefile.in
+++ b/libc/Makefile.in
@@ -6,17 +6,22 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-DOMULTI=n
+# Check if the target architecture has a version script for
+# libc, and if so, include it when linking.
+VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map)
+ifneq ($(VERSION_SCRIPT),)
+VERSION_SCRIPT := --version-script $(VERSION_SCRIPT)
+endif
-# we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak
-LIB_NAME:=libc
+LDFLAGS-libc.so := $(LDFLAGS) $(VERSION_SCRIPT) -init __uClibc_init
-libc_DIR:=$(top_srcdir)libc
-libc_OUT:=$(top_builddir)libc
+LIBS-libc.so := $(interp) $(top_builddir)lib/$(UCLIBC_LDSO)
-libc_FULL_NAME:=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+# we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak
+libc_FULL_NAME := libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-#DIRS:=misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd
+libc_DIR := $(top_srcdir)libc
+libc_OUT := $(top_builddir)libc
# this comes first, so duplicate removal works correctly
include $(libc_DIR)/sysdeps/Makefile.in
@@ -31,17 +36,41 @@ include $(libc_DIR)/signal/Makefile.in
include $(libc_DIR)/stdlib/Makefile.in
include $(libc_DIR)/unistd/Makefile.in
-# Check if the target architecture has a version script for
-# libc, and if so, include it when linking.
-VERSION_SCRIPT := $(wildcard $(libc_DIR)/sysdeps/linux/$(TARGET_ARCH)/libc.map)
-ifneq ($(VERSION_SCRIPT),)
-VERSION_SCRIPT := --version-script $(VERSION_SCRIPT)
+libc-a-y += $(libc-static-y)
+libc-so-y += $(libc-shared-y)
+
+libc-nomulti-y += $(libc-shared-y)
+
+lib-a-y += $(top_builddir)lib/libc.a crt-y
+lib-so-y += libc-y $(top_builddir)lib/$(NONSHARED_LIBNAME) crt-y
+objclean-y += libc_clean
+
+$(top_builddir)lib/libc.so: $(libc_OUT)/libc_so.a pre-y
+ $(call link.so,$(libc_FULL_NAME),$(MAJOR_VERSION))
+ $(Q)$(RM) $@
+ $(Q)echo "/* GNU ld script" > $@
+ $(Q)echo " * Use the shared library, but some functions are only in" >> $@
+ $(Q)echo " * the static library, so try that secondarily. */" >> $@
+ifeq ($(COMPAT_ATEXIT),y)
+ $(Q)echo "GROUP ( $(NONSHARED_LIBNAME) $(SHARED_MAJORNAME) $(ASNEEDED) )" >> $@
+else
+ $(Q)echo "GROUP ( $(SHARED_MAJORNAME) $(NONSHARED_LIBNAME) $(ASNEEDED) )" >> $@
endif
-EXTRA_LINK_OPTS:=$(VERSION_SCRIPT) -init __uClibc_init
-EXTRA_LINK_LIBS:=$(libc_OUT)/misc/internals/interp.os $(top_builddir)lib/$(UCLIBC_LDSO) $(LIBGCC) # $(LDADD_LIBFLOAT)
+$(libc_OUT)/libc_so.a: $(libc-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-objclean-y+=libc_clean
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libc.a: $(libc-a-y:.o=.os)
+else
+$(top_builddir)lib/libc.a: $(libc-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-lib-a-y+=$(top_builddir)lib/libc.a crt-y
-lib-so-y+=$(top_builddir)lib/libc.so $(top_builddir)lib/$(NONSHARED_LIBNAME) crt-y other-y
+libc_clean:
+ $(RM) $(libc_OUT)/*.{o,os,a}
diff --git a/libc/misc/internals/Makefile.in b/libc/misc/internals/Makefile.in
index 2916475ec..bfae764e4 100644
--- a/libc/misc/internals/Makefile.in
+++ b/libc/misc/internals/Makefile.in
@@ -6,7 +6,7 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS-__uClibc_main.c=$(SSP_DISABLE_FLAGS)
+CFLAGS-__uClibc_main.c:=$(SSP_DISABLE_FLAGS)
CSRC:=tempname.c errno.c __errno_location.c __h_errno_location.c
@@ -16,9 +16,7 @@ MISC_INTERNALS_OUT:=$(top_builddir)libc/misc/internals
MISC_INTERNALS_SRC:=$(patsubst %.c,$(MISC_INTERNALS_DIR)/%.c,$(CSRC))
MISC_INTERNALS_OBJ:=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(CSRC))
-STATIC_SRC:=__uClibc_main.c
-
-$(MISC_INTERNALS_OUT)/interp.c: $(MISC_INTERNALS_DIR)/Makefile.in
+$(MISC_INTERNALS_OUT)/interp.c: headers_root
$(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@
$(Q)echo "#include <features.h>" >> $@
$(Q)echo "#ifdef __HAVE_ELF__" >> $@
@@ -29,8 +27,7 @@ $(MISC_INTERNALS_OUT)/interp.c: $(MISC_INTERNALS_DIR)/Makefile.in
libc-a-y+=$(MISC_INTERNALS_OBJ)
libc-so-y+=$(MISC_INTERNALS_OBJ:.o=.os)
libc-shared-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.oS
-libc-static-y+=$(patsubst %.c,$(MISC_INTERNALS_OUT)/%.o,$(STATIC_SRC))
-other-y+=$(MISC_INTERNALS_OUT)/interp.os
+libc-static-y+=$(MISC_INTERNALS_OUT)/__uClibc_main.o
libc-multi-y+=$(MISC_INTERNALS_SRC)