|
@@ -37,9 +37,17 @@ DIRS = misc pwd_grp stdio string termios inet signal stdlib sysdeps unistd
|
|
VERSION_SCRIPT:=${shell if [ -f sysdeps/linux/$(TARGET_ARCH)/libc.map ] ; then \
|
|
VERSION_SCRIPT:=${shell if [ -f sysdeps/linux/$(TARGET_ARCH)/libc.map ] ; then \
|
|
echo "--version-script sysdeps/linux/$(TARGET_ARCH)/libc.map"; fi}
|
|
echo "--version-script sysdeps/linux/$(TARGET_ARCH)/libc.map"; fi}
|
|
|
|
|
|
-LIBNAME_TARGET:=$(TOPDIR)lib/$(LIBNAME)
|
|
+# we have SHARED_MAJORNAME=libc.so.$(MAJOR_VERSION) defined in Rules.mak
|
|
-
|
|
+LIB_NAME=libc
|
|
-all: halfclean $(LIBNAME_TARGET)
|
|
+AR_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).a
|
|
|
|
+SO_LIB_NAME=$(TOPDIR)lib/$(LIB_NAME).so
|
|
|
|
+SO_FULL_NAME=libuClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
|
|
|
|
+
|
|
|
|
+ifeq ($(strip $(HAVE_SHARED)),y)
|
|
|
|
+all: $(SO_LIB_NAME)
|
|
|
|
+else
|
|
|
|
+all: $(AR_LIB_NAME)
|
|
|
|
+endif
|
|
|
|
|
|
# Some functions are duplicated across subdirs, and when you pass $(AR)
|
|
# Some functions are duplicated across subdirs, and when you pass $(AR)
|
|
# the same object file more than once, it'll add it to the archive multiple
|
|
# the same object file more than once, it'll add it to the archive multiple
|
|
@@ -52,62 +60,55 @@ all: halfclean $(LIBNAME_TARGET)
|
|
# the wildcard will be evaluated when `make` is run instead of when the make
|
|
# the wildcard will be evaluated when `make` is run instead of when the make
|
|
# target is evaluated. That means if you run `rm obj.* ; make`, the wildcard
|
|
# target is evaluated. That means if you run `rm obj.* ; make`, the wildcard
|
|
# will evaluate to no files :(.
|
|
# will evaluate to no files :(.
|
|
-$(LIBNAME) shared_$(LIBNAME) ar-target: subdirs
|
|
+shared_$(LIB_NAME).a: subdirs
|
|
- $(RM) $(LIBNAME) shared_$(LIBNAME)
|
|
+ $(RM) shared_$(LIB_NAME).a
|
|
objs=`cat obj.*` ; \
|
|
objs=`cat obj.*` ; \
|
|
- $(AR) $(ARFLAGS) $(LIBNAME) $$objs && \
|
|
+ $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $$objs && \
|
|
- $(AR) dN 2 $(LIBNAME) $$objs && \
|
|
+ $(AR) dN 2 shared_$(LIB_NAME).a $$objs && \
|
|
- $(AR) dN 2 $(LIBNAME) $$objs
|
|
+ $(AR) dN 2 shared_$(LIB_NAME).a $$objs
|
|
@for objfile in obj.signal \
|
|
@for objfile in obj.signal \
|
|
obj.string.generic obj.string.$(TARGET_ARCH) obj.string \
|
|
obj.string.generic obj.string.$(TARGET_ARCH) obj.string \
|
|
obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
|
|
obj.sysdeps.common obj.sysdeps.$(TARGET_ARCH) ; do \
|
|
if [ -e $$objfile ] ; then \
|
|
if [ -e $$objfile ] ; then \
|
|
if [ "$(MAKE_IS_SILENT)" = "n" ] ; then \
|
|
if [ "$(MAKE_IS_SILENT)" = "n" ] ; then \
|
|
- echo $(AR) $(ARFLAGS) $(LIBNAME) $$objfile ; \
|
|
+ echo $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $$objfile ; \
|
|
fi ; \
|
|
fi ; \
|
|
objs=`cat $$objfile` ; \
|
|
objs=`cat $$objfile` ; \
|
|
fi ; \
|
|
fi ; \
|
|
- $(AR) $(ARFLAGS) $(LIBNAME) $$objs || exit 1 ; \
|
|
+ $(AR) $(ARFLAGS) shared_$(LIB_NAME).a $$objs || exit 1 ; \
|
|
done
|
|
done
|
|
- cp $(LIBNAME) shared_$(LIBNAME)
|
|
|
|
- $(AR) $(ARFLAGS) $(LIBNAME) misc/internals/static.o `cat nonshared_obj.*`
|
|
|
|
- $(RANLIB) $(LIBNAME)
|
|
|
|
|
|
|
|
-$(LIBNAME_TARGET): $(LIBNAME)
|
|
+$(AR_LIB_NAME): shared_$(LIB_NAME).a
|
|
$(INSTALL) -d $(TOPDIR)lib
|
|
$(INSTALL) -d $(TOPDIR)lib
|
|
- $(RM) $(TOPDIR)lib/$(LIBNAME)
|
|
+ $(RM) $(AR_LIB_NAME)
|
|
- $(INSTALL) -m 644 $(LIBNAME) $(TOPDIR)lib
|
|
+ cp shared_$(LIB_NAME).a $(AR_LIB_NAME)
|
|
-
|
|
+ $(AR) $(ARFLAGS) $(AR_LIB_NAME) misc/internals/static.o `cat nonshared_obj.*`
|
|
-shared: shared_$(LIBNAME)
|
|
+
|
|
- $(LD) $(LDFLAGS) $(VERSION_SCRIPT) -soname=$(SHARED_MAJORNAME) -o $(SHARED_FULLNAME) \
|
|
+$(SO_LIB_NAME): shared_$(LIB_NAME).a
|
|
- --whole-archive shared_$(LIBNAME) \
|
|
+ $(RM) $(TOPDIR)lib/$(SO_FULL_NAME) $(TOPDIR)lib/$(SHARED_MAJORNAME) $(SO_LIB_NAME)
|
|
- $(TOPDIR)libc/misc/internals/interp.o --no-whole-archive \
|
|
+ $(LD) $(LDFLAGS) $(VERSION_SCRIPT) -soname=$(SHARED_MAJORNAME) \
|
|
- -init __uClibc_init $(TOPDIR)lib/$(UCLIBC_LDSO) $(LIBGCC) $(LDADD_LIBFLOAT)
|
|
+ -o $(TOPDIR)lib/$(SO_FULL_NAME) --whole-archive shared_$(LIB_NAME).a \
|
|
- $(INSTALL) -d $(TOPDIR)lib
|
|
+ --no-whole-archive $(TOPDIR)libc/misc/internals/interp.o \
|
|
- $(RM) $(TOPDIR)lib/$(SHARED_FULLNAME)
|
|
+ -init __uClibc_init $(TOPDIR)lib/$(UCLIBC_LDSO) $(LDADD_LIBFLOAT) $(LIBGCC)
|
|
- $(INSTALL) -m 644 $(SHARED_FULLNAME) $(TOPDIR)lib
|
|
+ $(LN) -sf $(SO_FULL_NAME) $(TOPDIR)lib/$(SHARED_MAJORNAME)
|
|
- $(LN) -sf $(SHARED_FULLNAME) $(TOPDIR)lib/$(SHARED_MAJORNAME)
|
|
+ $(RM) $(TOPDIR)lib/$(NONSHARED_LIBNAME)
|
|
$(AR) $(ARFLAGS) $(TOPDIR)lib/$(NONSHARED_LIBNAME) `cat nonshared_obj.*`
|
|
$(AR) $(ARFLAGS) $(TOPDIR)lib/$(NONSHARED_LIBNAME) `cat nonshared_obj.*`
|
|
- $(RANLIB) $(TOPDIR)lib/$(NONSHARED_LIBNAME)
|
|
+ echo "/* GNU ld script" > $(SO_LIB_NAME)
|
|
- echo "/* GNU ld script" > $(TOPDIR)lib/libc.so
|
|
+ echo " * Use the shared library, but some functions are only in" >> $(SO_LIB_NAME)
|
|
- echo " * Use the shared library, but some functions are only in" >> $(TOPDIR)lib/libc.so
|
|
+ echo " * the static library, so try that secondarily. */" >> $(SO_LIB_NAME)
|
|
- echo " * the static library, so try that secondarily. */" >> $(TOPDIR)lib/libc.so
|
|
|
|
#OUT_FORMAT:=$(shell $(LD) --verbose | grep OUTPUT_FORMAT | awk -F '"' '{print $2}')
|
|
#OUT_FORMAT:=$(shell $(LD) --verbose | grep OUTPUT_FORMAT | awk -F '"' '{print $2}')
|
|
- #echo "OUTPUT_FORMAT($(OUT_FORMAT))" >> $(TOPDIR)lib/libc.so
|
|
+ #echo "OUTPUT_FORMAT($(OUT_FORMAT))" >> $(SO_LIB_NAME)
|
|
ifeq ($(strip $(COMPAT_ATEXIT)),y)
|
|
ifeq ($(strip $(COMPAT_ATEXIT)),y)
|
|
- echo "GROUP ( $(TOPDIR)lib/$(NONSHARED_LIBNAME) $(TOPDIR)lib/$(SHARED_MAJORNAME) )" >> $(TOPDIR)lib/libc.so
|
|
+ echo "GROUP ( $(TOPDIR)lib/$(NONSHARED_LIBNAME) $(TOPDIR)lib/$(SHARED_MAJORNAME) )" >> $(SO_LIB_NAME)
|
|
else
|
|
else
|
|
- echo "GROUP ( $(TOPDIR)lib/$(SHARED_MAJORNAME) $(TOPDIR)lib/$(NONSHARED_LIBNAME) )" >> $(TOPDIR)lib/libc.so
|
|
+ echo "GROUP ( $(TOPDIR)lib/$(SHARED_MAJORNAME) $(TOPDIR)lib/$(NONSHARED_LIBNAME) )" >> $(SO_LIB_NAME)
|
|
endif
|
|
endif
|
|
|
|
|
|
-halfclean:
|
|
|
|
- $(RM) $(LIBNAME) shared_$(LIBNAME) $(SHARED_FULLNAME)
|
|
|
|
-
|
|
|
|
tags:
|
|
tags:
|
|
ctags -R
|
|
ctags -R
|
|
|
|
|
|
-clean: subdirs_clean halfclean
|
|
+clean: subdirs_clean
|
|
- $(RM) obj.* nonshared_obj.*
|
|
+ $(RM) *.a obj.* nonshared_obj.*
|
|
|
|
|
|
subdirs: $(patsubst %, _dir_%, $(DIRS))
|
|
subdirs: $(patsubst %, _dir_%, $(DIRS))
|
|
subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
|
|
subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
|