summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Makefile.in52
-rw-r--r--Makerules143
-rw-r--r--Rules.mak6
-rw-r--r--ldso/Makefile.in40
-rw-r--r--ldso/ldso/Makefile.in86
-rw-r--r--ldso/libdl/Makefile.in61
-rw-r--r--libc/Makefile.in63
-rw-r--r--libc/misc/internals/Makefile.in9
-rw-r--r--libcrypt/Makefile.in48
-rw-r--r--libintl/Makefile.in61
-rw-r--r--libm/Makefile.in93
-rw-r--r--libnsl/Makefile.in48
-rw-r--r--libpthread/Makefile.in54
-rw-r--r--libpthread/linuxthreads.old/Makefile.in95
-rw-r--r--libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch20
-rw-r--r--libpthread/linuxthreads.old_db/Makefile.in63
-rw-r--r--libresolv/Makefile.in48
-rw-r--r--librt/Makefile.in48
-rw-r--r--libutil/Makefile.in50
19 files changed, 593 insertions, 495 deletions
diff --git a/Makefile.in b/Makefile.in
index fd2284ce0..ef77f969d 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -14,24 +14,6 @@ noconfig_targets := menuconfig config oldconfig randconfig \
include $(top_builddir)Rules.mak
-# need to have libc.so built, before we can build the others
-ifeq ($(HAVE_SHARED),y)
-PRE_DIRS = ldso libc
-DIRS = ldso libcrypt libresolv libnsl libutil librt
-else
-PRE_DIRS = libc
-DIRS = libcrypt libresolv libnsl libutil librt
-endif
-ifeq ($(UCLIBC_HAS_FLOATS),y)
- DIRS += libm
-endif
-ifeq ($(UCLIBC_HAS_THREADS),y)
- DIRS += libpthread
-endif
-ifeq ($(UCLIBC_HAS_GETTEXT_AWARENESS),y)
- DIRS += libintl
-endif
-
ifeq ($(HAVE_DOT_CONFIG),y)
all: finished
@@ -39,7 +21,19 @@ all: finished
# In this section, we need .config
-include .config.cmd
-finished: subdirs
+include $(top_srcdir)ldso/ldso/Makefile.in
+include $(top_srcdir)libc/Makefile.in
+include $(top_srcdir)ldso/libdl/Makefile.in
+include $(top_srcdir)libcrypt/Makefile.in
+include $(top_srcdir)libintl/Makefile.in
+include $(top_srcdir)libm/Makefile.in
+include $(top_srcdir)libnsl/Makefile.in
+include $(top_srcdir)libresolv/Makefile.in
+include $(top_srcdir)librt/Makefile.in
+include $(top_srcdir)libutil/Makefile.in
+include $(top_srcdir)libpthread/Makefile.in
+
+finished: pregen libs
$(SECHO)
$(SECHO) Finally finished compiling ...
$(SECHO)
@@ -103,13 +97,7 @@ headers: include/bits/uClibc_config.h
$(RM) include/bits/sysnum.h; \
mv -f include/bits/sysnum.h.new include/bits/sysnum.h; \
fi
-ifeq ($(HAVE_SHARED),y)
- $(MAKE) -C ldso headers-y
-endif
-ifeq ($(UCLIBC_HAS_THREADS),y)
- $(MAKE) -C libpthread headers-y
-endif
- $(MAKE) -C libc/sysdeps/linux headers-y
+ $(MAKE) headers-y
# Command used to download source code
WGET:=wget --passive-ftp
@@ -128,14 +116,6 @@ ifeq ($(UCLIBC_PREGENERATED_LOCALE_DATA),y)
$(MAKE) -C $(top_srcdir)extra/locale pregen
endif
-pre_subdirs: $(patsubst %, _pre_dir_%, $(PRE_DIRS))
-$(patsubst %, _pre_dir_%, $(PRE_DIRS)): pregen
- @$(MAKE) -C $(patsubst _pre_dir_%, %, $@)
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-$(patsubst %, _dir_%, $(DIRS)): pre_subdirs
- @$(MAKE) -C $(patsubst _dir_%, %, $@)
-
install: install_runtime install_dev finished2
@@ -350,9 +330,7 @@ clean:
$(RM) libc/stdio/*64.c
$(RM) include/fpu_control.h include/dl-osinfo.h
$(MAKE) -C extra/locale clean
- $(MAKE) -C ldso headers_clean-y
- $(MAKE) -C libpthread headers_clean-y
- $(MAKE) -C libc/sysdeps/linux headers_clean-y
+ $(MAKE) headers_clean-y
$(MAKE) -C test clean
$(MAKE) -C utils clean
@set -e; \
diff --git a/Makerules b/Makerules
index 69e3d79d7..b5fc779da 100644
--- a/Makerules
+++ b/Makerules
@@ -8,13 +8,36 @@
ifeq ($(HAVE_SHARED),y)
.LIBPATTERNS: "lib%.so"
libs: lib-so-y lib-a-y
+objs: shared_objs ar_objs
else
.LIBPATTERNS: "lib%.a"
libs: lib-a-y
+objs: ar_objs
endif
-lib-a-y: $(lib-a-y)
-lib-so-y: $(lib-so-y)
+shared_objs-y = $(lduClibc-so-y) $(libc-so-y) $(libc-nonshared-y) $(libdl-so-y)
+shared_objs-y += $(libcrypt-so-y) $(libintl-so-y) $(libm-so-y) $(libnsl-so-y) $(libpthread-so-y)
+shared_objs-y += $(libresolv-so-y) $(librt-so-y) $(libutil-so-y)
+ar_objs-y = $(libc-a-y) $(libcrypt-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y)
+ar_objs-y += $(libpthread-a-y) $(libresolv-a-y) $(librt-a-y) $(libutil-a-y)
+
+shared_objs: $(shared_objs-y)
+ifeq ($(DOPIC),y)
+ar_objs: $(ar_objs-y:.o=.os)
+else
+ar_objs: $(ar_objs-y)
+endif
+
+headers-y: $(headers-y)
+ld-uClibc-y: $(ld-uClibc-y)
+interp-y: $(interp)
+pre-y: interp-y ld-uClibc-y
+libc-y: pre-y $(libc) crt-y
+lib-a-y: headers_root crt-y $(lib-a-y)
+lib-so-y: libc-y $(lib-so-y)
+
+headers_root:
+ @cd $(top_builddir); $(MAKE) headers
ifneq ($(findstring s,$(MAKEFLAGS)),)
DISP := sil
@@ -37,7 +60,7 @@ pur_disp_compile.m = $(pur_disp_compile.c)
pur_disp_compile-m = echo " "CC-m $(show_objs)
pur_disp_strip = echo " "STRIP $(STRIP_FLAGS) $@:*
pur_disp_ar = echo " "AR $(ARFLAGS) $@
-pur_disp_ld = echo " "LD $($(LIB_NAME)_FULL_NAME)
+pur_disp_ld = echo " "LD $(1)
sil_disp_compile.c = true
sil_disp_compile.S = true
@@ -146,12 +169,6 @@ endif
crt-y: $(crt-y)
$(crt-y): $(CRTS) $(CTOR_TARGETS)
-other-y: $(other-y)
-headers-y: $(headers-y)
-
-objclean-y: $(objclean-y)
-headers_clean-y: $(headers_clean-y)
-
$(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
$(Q)$(INSTALL) -d $(dir $@)
$(do_ar)
@@ -159,109 +176,5 @@ $(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
.PHONY: dummy create
clean: objclean-y headers_clean-y
-ifeq ($(strip $(LIB_NAME)),)
-LIB_NAME=libc
-endif
-
-ifeq ($(strip $($(LIB_NAME)_FULL_NAME)),)
-$(LIB_NAME)_FULL_NAME:=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-endif
-
-$(LIB_NAME)-SHARED_OBJS=$($(LIB_NAME)-so-y) $($(LIB_NAME)-shared-y)
-ifeq ($(HAVE_SHARED),y)
-shared: $($(LIB_NAME)-SHARED_OBJS)
-else
-shared:
-endif
-
-$(LIB_NAME)-ARCHIVE_OBJS=$($(LIB_NAME)-a-y) $($(LIB_NAME)-static-y)
-ifeq ($(DOPIC),y)
-objs: shared $($(LIB_NAME)-ARCHIVE_OBJS:.o=.os) $(crt-y) $(other-y)
-else
-objs: shared $($(LIB_NAME)-ARCHIVE_OBJS) $(crt-y) $(other-y)
-endif
-
-libc=$(top_builddir)lib/libc.so
-interp=$(top_builddir)libc/misc/internals/interp.os
-ifeq ($(strip $(EXTRA_LINK_LIBS)),)
-#EXTRA_LINK_LIBS:=$(interp) -L$(top_builddir)lib -lc $(LDADD_LIBFLOAT) $(LIBGCC)
-EXTRA_LINK_LIBS:=$(interp) -L$(top_builddir)lib $(libc) $(LDADD_LIBFLOAT) $(LIBGCC)
-endif
-
-ifneq ($(strip $(LIB_NAME)),libc)
-ifneq ($(strip $(LIB_NAME)),ld-uClibc)
-$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a $(interp) $(libc)
-else
-$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a
-endif
-else
-$(top_builddir)lib/$(LIB_NAME).so: $($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a $(interp)
-endif
- $(Q)$(INSTALL) -d $(dir $@)
- $(Q)$(RM) $@ $@.$(MAJOR_VERSION) $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME)
- @$(disp_ld)
- $(Q)$(LD) $(LDFLAGS) $(EXTRA_LINK_OPTS) -soname=$(notdir $@).$(MAJOR_VERSION) \
- -o $(top_builddir)lib/$($(LIB_NAME)_FULL_NAME) $(SHARED_START_FILES) \
- --whole-archive $(firstword $^) --no-whole-archive \
- $(EXTRA_LINK_LIBS) $(SHARED_END_FILES)
- $(Q)$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@.$(MAJOR_VERSION)
-ifneq ($(strip $(LIB_NAME)),libc)
-ifneq ($(strip $(LIB_NAME)),ld-uClibc)
- $(Q)$(LN) -sf $($(LIB_NAME)_FULL_NAME) $@
-endif
-else
- $(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
-endif
-
-$($(LIB_NAME)_OUT)/$(LIB_NAME)_m.o $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.os: $($(LIB_NAME)-multi-y)
- $(compile-m)
-
-# local testing only until libc is multi-capable
-libc_m.os: $(libc-multi-y)
- $(compile-m)
-
-ifneq ($(DOMULTI),n)
-
-$($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a: $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.os $($(LIB_NAME)-nomulti-y:.o=.os) $($(LIB_NAME)-shared-y)
- $(Q)$(RM) $@
- $(do_strip)
- $(do_ar)
-
-ifeq ($(DOPIC),y)
-$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.os $($(LIB_NAME)-nomulti-y:.o=.os) $($(LIB_NAME)-static-y:.o=.os)
-else
-$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)_OUT)/$(LIB_NAME)_m.o $($(LIB_NAME)-nomulti-y) $($(LIB_NAME)-static-y)
-endif
- $(Q)$(INSTALL) -d $(dir $@)
- $(Q)$(RM) $@
- $(do_strip)
- $(do_ar)
-
-else # DOMULTI
-
-$($(LIB_NAME)_OUT)/$(LIB_NAME)_so.a: $($(LIB_NAME)-SHARED_OBJS)
- $(Q)$(RM) $@
- $(do_strip)
- $(do_ar)
-
-ifeq ($(DOPIC),y)
-$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)-ARCHIVE_OBJS:.o=.os)
-else
-$(top_builddir)lib/$(LIB_NAME).a: $($(LIB_NAME)-ARCHIVE_OBJS)
-endif
- $(Q)$(INSTALL) -d $(dir $@)
- $(Q)$(RM) $@
- $(do_strip)
- $(do_ar)
-
-endif # DOMULTI
-
-$(LIB_NAME)_clean:
- $(RM) $($(LIB_NAME)_OUT)/*.{o,os,a}
+objclean-y: $(objclean-y)
+headers_clean-y: $(headers_clean-y)
diff --git a/Rules.mak b/Rules.mak
index 0577b8d19..a16392c85 100644
--- a/Rules.mak
+++ b/Rules.mak
@@ -407,6 +407,12 @@ LIBGCC_CFLAGS ?= $(CFLAGS) $(CPU_CFLAGS-y)
LIBGCC:=$(shell $(CC) $(LIBGCC_CFLAGS) -print-libgcc-file-name)
LIBGCC_DIR:=$(dir $(LIBGCC))
+# moved from libpthread/linuxthreads
+ifeq ($(UCLIBC_CTOR_DTOR),y)
+SHARED_START_FILES:=$(TOPDIR)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
+SHARED_END_FILES:=$(LIBGCC_DIR)crtendS.o $(TOPDIR)lib/crtn.o
+endif
+
########################################
#
# uClinux shared lib support
diff --git a/ldso/Makefile.in b/ldso/Makefile.in
index 8d3c5fcda..7bbef23a0 100644
--- a/ldso/Makefile.in
+++ b/ldso/Makefile.in
@@ -5,41 +5,5 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-DIRS=$(shell if test -f $(top_builddir)lib/libc.so ; then echo "ldso libdl" ; else echo "ldso" ; fi)
-
-libs: subdirs
-
-LN_HEADERS := $(patsubst %, include/%, elf.h)
-LN_ARCH_HEADERS := $(patsubst %, include/%, dl-startup.h dl-syscalls.h dl-sysdep.h dl-debug.h)
-HEADERS := $(LN_HEADERS) $(LN_ARCH_HEADERS) include/dl-progname.h
-
-headers-y+=ldso_headers
-
-ldso_headers: $(HEADERS)
-
-$(LN_HEADERS):
- $(LN) -sf $(top_builddir)../$@ $@
-
-$(LN_ARCH_HEADERS):
- $(LN) -sf ../ldso/$(TARGET_ARCH)/$(patsubst include/%,%,$@) $@
-
-include/dl-progname.h:
- echo '#include "$(TARGET_ARCH)/elfinterp.c"' > $@
-
-headers_clean-y+=ldso_headers_clean
-
-ldso_headers_clean:
- $(RM) $(HEADERS)
-
-clean: subdirs_clean ldso_headers_clean
-
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-subdirs_clean: $(patsubst %, _dirclean_%, $(DIRS))
-
-$(patsubst %, _dir_%, $(DIRS)): ldso_headers
- $(MAKE) -C $(patsubst _dir_%, %, $@)
-
-$(patsubst %, _dirclean_%, $(DIRS)): dummy
- $(MAKE) -C $(patsubst _dirclean_%, %, $@) clean
-
-.PHONY: dummy
+include $(top_srcdir)ldso/ldso/Makefile.in
+include $(top_srcdir)ldso/libdl/Makefile.in
diff --git a/ldso/ldso/Makefile.in b/ldso/ldso/Makefile.in
index 12853afc2..0bf5c02ed 100644
--- a/ldso/ldso/Makefile.in
+++ b/ldso/ldso/Makefile.in
@@ -5,61 +5,85 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# psm: I do not know if the order of includes is relevant
-# to be sure I have put them first
-CFLAGS:=-I$(top_builddir)ldso/include -I. $(CFLAGS) $(PICFLAG) $(SSP_DISABLE_FLAGS)
+CFLAGS-ldso := -DNOT_IN_libc #-DIS_IN_rtld
-CFLAGS+=-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\"
+# This stuff will not work with -fomit-frame-pointer
+CFLAGS-ldso += -fno-omit-frame-pointer
+
+CFLAGS-ldso += -I$(top_builddir)ldso/include -I$(top_builddir)ldso/ldso $(SSP_DISABLE_FLAGS)
+CFLAGS-ldso += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\" -DUCLIBC_LDSO=\"$(UCLIBC_LDSO)\"
ifeq ($(SUPPORT_LD_DEBUG),y)
-CFLAGS+=-D__SUPPORT_LD_DEBUG__
+CFLAGS-ldso += -D__SUPPORT_LD_DEBUG__
endif
ifeq ($(SUPPORT_LD_DEBUG_EARLY),y)
-CFLAGS+=-D__SUPPORT_LD_DEBUG_EARLY__
+CFLAGS-ldso += -D__SUPPORT_LD_DEBUG_EARLY__
endif
-CFLAGS+=-DNOT_IN_libc
-
ifeq ($(DODEBUG),y)
# Not really much point in including debugging info, since gdb
# can't really debug ldso, since gdb requires help from ldso to
# debug things....
-# psm: keep this in sync w/ Rules.mak
-CFLAGS:=$(CFLAGS:-O0 -g3=-Os -g)
+CFLAGS-ldso += -Os -g
endif
-# This stuff will not work with -fomit-frame-pointer
-CFLAGS:=$(CFLAGS:-fomit-frame-pointer=)
+CFLAGS-ldso/ldso/$(TARGET_ARCH)/ := $(CFLAGS-ldso)
-ifeq ($(SUPPORT_LD_DEBUG),y)
-LDFLAGS:=$(LDFLAGS_NOSTRIP)
+ifneq ($(SUPPORT_LD_DEBUG),y)
+LDFLAGS-ld-uClibc.so := $(LDFLAGS)
+else
+LDFLAGS-ld-uClibc.so := $(LDFLAGS_NOSTRIP) -z defs
endif
+LDFLAGS-ld-uClibc.so += -e _start -z now -Bsymbolic --export-dynamic --sort-common --discard-locals --discard-all --no-undefined
+
+ldso_FULL_NAME := ld-uClibc-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+ld-uClibc_DIR := $(top_srcdir)ldso/ldso
+ld-uClibc_OUT := $(top_builddir)ldso/ldso
+
+ld-uClibc_CSRC := $(ld-uClibc_DIR)/ldso.c
+ld-uClibc_COBJ := $(patsubst $(ld-uClibc_DIR)/%.c,$(ld-uClibc_OUT)/%.o,$(ld-uClibc_CSRC))
+
+ld-uClibc_SSRC := $(wildcard $(ld-uClibc_DIR)/$(TARGET_ARCH)/*.S)
+ld-uClibc_SOBJ := $(patsubst $(ld-uClibc_DIR)/$(TARGET_ARCH)/%.S,$(ld-uClibc_OUT)/$(TARGET_ARCH)/%.o,$(ld-uClibc_SSRC))
+
+ld-uClibc_OBJS := $(ld-uClibc_COBJ) $(ld-uClibc_SOBJ)
-# can't combine .c w/ .S
-DOMULTI=n
+ld-uClibc-so-y := $(ld-uClibc_OBJS:.o=.os)
-LIB_NAME:=ld-uClibc
+LN_HEADERS := $(patsubst %, $(top_builddir)ldso/include/%, elf.h)
+LN_ARCH_HEADERS := $(patsubst %, $(top_builddir)ldso/include/%, dl-startup.h dl-syscalls.h dl-sysdep.h dl-debug.h)
+HEADERS := $(LN_HEADERS) $(LN_ARCH_HEADERS) $(top_builddir)ldso/include/dl-progname.h
-ld-uClibc_DIR:=$(top_srcdir)ldso/ldso
-ld-uClibc_OUT:=$(top_builddir)ldso/ldso
+#lib-so-y := $(top_builddir)lib/$(patsubst %.$(MAJOR_VERSION),%,$(UCLIBC_LDSO))
+ld-uClibc-y := $(top_builddir)lib/$(patsubst %.$(MAJOR_VERSION),%,$(UCLIBC_LDSO))
+objclean-y += ld-uClibc_clean
+headers-$(HAVE_SHARED) += ldso_headers
+headers_clean-y += ldso_headers_clean
-ld-uClibc_SRC:=$(ld-uClibc_DIR)/ldso.c
-ld-uClibc_OBJ:=$(patsubst $(ld-uClibc_DIR)/%.c,$(ld-uClibc_OUT)/%.o,$(ld-uClibc_SRC))
+$(top_builddir)lib/$(patsubst %.$(MAJOR_VERSION),%,$(UCLIBC_LDSO)): $(ld-uClibc_OUT)/ld-uClibc_so.a headers_root
+ $(call link.so,$(ldso_FULL_NAME),$(MAJOR_VERSION))
+ #(RM) $@
-ld-uClibc_SSRC:=$(wildcard $(ld-uClibc_DIR)/$(TARGET_ARCH)/*.S)
-ld-uClibc_SOBJ:=$(patsubst $(ld-uClibc_DIR)/$(TARGET_ARCH)/%.S,$(ld-uClibc_OUT)/$(TARGET_ARCH)/%.o,$(ld-uClibc_SSRC))
+$(ld-uClibc_OUT)/ld-uClibc_so.a: $(ld-uClibc-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-ld-uClibc_OBJS:=$(ld-uClibc_OBJ) $(ld-uClibc_SOBJ)
+ldso_headers: $(HEADERS)
-EXTRA_LINK_OPTS:=-e _start -z now -Bsymbolic --export-dynamic --sort-common --discard-locals --discard-all --no-undefined
-EXTRA_LINK_LIBS:=$(LIBGCC) # $(LDADD_LIBFLOAT)
+$(LN_HEADERS):
+ $(LN) -sf ../../$(top_srcdir)include/$(notdir $@) $@
-ld-uClibc-so-$(HAVE_SHARED):=$(ld-uClibc_OBJS:.o=.os)
+$(LN_ARCH_HEADERS):
+ $(LN) -sf ../../$(top_srcdir)ldso/ldso/$(TARGET_ARCH)/$(notdir $@) $@
-objclean-y+=ld-uClibc_clean ld-uClibc_arch_clean
+$(top_builddir)ldso/include/dl-progname.h:
+ echo '#include "$(TARGET_ARCH)/elfinterp.c"' > $@
-ld-uClibc_arch_clean:
- $(RM) $(ld-uClibc_OUT)/*/*.{o,os}
+ldso_headers_clean:
+ $(RM) $(HEADERS)
-lib-so-$(HAVE_SHARED)+=$(top_builddir)lib/ld-uClibc.so
+ld-uClibc_clean:
+ $(RM) $(ld-uClibc_OUT)/*.{o,os,a} $(ld-uClibc_OUT)/*/*.{o,os}
diff --git a/ldso/libdl/Makefile.in b/ldso/libdl/Makefile.in
index e804b3458..6622226c5 100644
--- a/ldso/libdl/Makefile.in
+++ b/ldso/libdl/Makefile.in
@@ -6,41 +6,54 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# psm: I do not know if the order of includes is relevant
-# to be sure I added them first, Jocke please cleanup if needed
-CFLAGS:=-I$(top_builddir)ldso/include -I$(top_builddir)ldso/ldso $(CFLAGS) $(SSP_ALL_CFLAGS)
+CFLAGS-libdl := -DNOT_IN_libc
-CFLAGS+=-DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\"
+CFLAGS-libdl +=-I$(top_builddir)ldso/include -I$(top_builddir)ldso/ldso $(SSP_ALL_CFLAGS)
+
+CFLAGS-libdl += -DUCLIBC_RUNTIME_PREFIX=\"$(RUNTIME_PREFIX)\"
ifeq ($(SUPPORT_LD_DEBUG),y)
-CFLAGS+=-D__SUPPORT_LD_DEBUG__
+CFLAGS-libdl += -D__SUPPORT_LD_DEBUG__
endif
-# can't combine .c w/ .S
-DOMULTI=n
+LDFLAGS-libdl.so := $(LDFLAGS) -fini dl_cleanup
+
+LIBS-libdl.so := $(LIBS) $(top_builddir)lib/$(UCLIBC_LDSO)
-LIB_NAME:=libdl
+libdl_FULL_NAME := libdl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-EXTRA_LINK_OPTS:=-fini dl_cleanup
-# keep in sync w/ Makerules
-EXTRA_LINK_LIBS:=$(top_builddir)libc/misc/internals/interp.os -L$(top_builddir)lib $(top_builddir)lib/libc.so $(LIBGCC) $(top_builddir)lib/$(UCLIBC_LDSO)
+libdl_DIR := $(top_srcdir)ldso/libdl
+libdl_OUT := $(top_builddir)ldso/libdl
-libdl_DIR:=$(top_srcdir)ldso/libdl
-libdl_OUT:=$(top_builddir)ldso/libdl
+libdl_SRC := $(libdl_DIR)/libdl.c
+libdl_OBJ := $(patsubst $(libdl_DIR)/%.c,$(libdl_OUT)/%.o,$(libdl_SRC))
-libdl_SRC:=$(libdl_DIR)/libdl.c
-libdl_OBJ:=$(patsubst $(libdl_DIR)/%.c,$(libdl_OUT)/%.o,$(libdl_SRC))
+resolve := $(top_builddir)ldso/ldso/$(TARGET_ARCH)/resolve.o
-resolve:=$(top_builddir)ldso/ldso/$(TARGET_ARCH)/resolve.o
+libdl-a-y := $(libdl_OBJ) $(resolve)
+libdl-so-y := $(libdl_OUT)/libdl.oS
-libdl-a-$(HAVE_SHARED):=$(libdl_OBJ)
-libdl-static-$(HAVE_SHARED):=$(resolve)
-libdl-shared-$(HAVE_SHARED):=$(libdl_OUT)/libdl.oS
+lib-a-$(HAVE_SHARED) += $(top_builddir)lib/libdl.a
+lib-so-y += $(top_builddir)lib/libdl.so
+objclean-y += libdl_clean
-objclean-y+=libdl_clean libdl_extra_clean
+$(top_builddir)lib/libdl.so: $(libdl_OUT)/libdl_so.a ld-uClibc-y libc-y
+ $(call link.so,$(libdl_FULL_NAME),$(MAJOR_VERSION))
-libdl_extra_clean:
- $(RM) $(libdl_OUT)/*.oS
+$(libdl_OUT)/libdl_so.a: $(libdl-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libdl.a: $(libdl-a-y:.o=.os)
+else
+$(top_builddir)lib/libdl.a: $(libdl-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-lib-a-$(HAVE_SHARED)+=$(top_builddir)lib/libdl.a
-lib-so-$(HAVE_SHARED)+=$(top_builddir)lib/libdl.so
+libdl_clean:
+ $(RM) $(libdl_OUT)/*.{o,os,a,oS}
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)
diff --git a/libcrypt/Makefile.in b/libcrypt/Makefile.in
index 4e1466e72..6138ef51f 100644
--- a/libcrypt/Makefile.in
+++ b/libcrypt/Makefile.in
@@ -6,22 +6,46 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-libcrypt := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
-LIB_NAME:=libcrypt
+LDFLAGS-libcrypt.so := $(LDFLAGS)
-libcrypt_DIR:=$(top_srcdir)libcrypt
-libcrypt_OUT:=$(top_builddir)libcrypt
+LIBS-libcrypt.so := $(LIBS)
-libcrypt_SRC:=$(wildcard $(libcrypt_DIR)/*.c)
-libcrypt_OBJ:=$(patsubst $(libcrypt_DIR)/%.c,$(libcrypt_OUT)/%.o,$(libcrypt_SRC))
+libcrypt_FULL_NAME := libcrypt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-libcrypt-a-y:=$(libcrypt_OBJ)
-libcrypt-so-y:=$(libcrypt_OBJ:.o=.os)
+libcrypt_DIR := $(top_srcdir)libcrypt
+libcrypt_OUT := $(top_builddir)libcrypt
-libcrypt-multi-y:=$(libcrypt_SRC)
+libcrypt_SRC := $(wildcard $(libcrypt_DIR)/*.c)
+libcrypt_OBJ := $(patsubst $(libcrypt_DIR)/%.c,$(libcrypt_OUT)/%.o,$(libcrypt_SRC))
-objclean-y+=libcrypt_clean
+libcrypt-a-y := $(libcrypt_OBJ)
+libcrypt-so-y := $(libcrypt_OBJ:.o=.os)
-lib-a-y+=$(top_builddir)lib/libcrypt.a
-lib-so-y+=$(top_builddir)lib/libcrypt.so
+libcrypt-multi-y := $(libcrypt_SRC)
+
+lib-a-y += $(top_builddir)lib/libcrypt.a
+lib-so-y += $(top_builddir)lib/libcrypt.so
+objclean-y += libcrypt_clean
+
+$(top_builddir)lib/libcrypt.so: $(libcrypt_OUT)/libcrypt_so.a libc-y
+ $(call link.so,$(libcrypt_FULL_NAME),$(MAJOR_VERSION))
+
+$(libcrypt_OUT)/libcrypt_so.a: $(libcrypt-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libcrypt.a: $(libcrypt-a-y:.o=.os)
+else
+$(top_builddir)lib/libcrypt.a: $(libcrypt-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+libcrypt_clean:
+ $(RM) $(libcrypt_OUT)/*.{o,os,a}
diff --git a/libintl/Makefile.in b/libintl/Makefile.in
index 8c77262a0..78bcc8d0d 100644
--- a/libintl/Makefile.in
+++ b/libintl/Makefile.in
@@ -6,21 +6,54 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-libintl := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
-LIB_NAME:=libintl
+LDFLAGS-libintl.so := $(LDFLAGS)
-MOBJ:=gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \
+LIBS-libintl.so := $(LIBS)
+
+libintl_FULL_NAME := libintl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+MOBJ := \
+ gettext.o ngettext.o dgettext.o dcgettext.o dngettext.o dcngettext.o \
textdomain.o bindtextdomain.o bind_textdomain_codeset.o \
_nl_expand_alias.o _nl_msg_cat_cntr.o # glibc-isms
-libintl_DIR:=$(top_srcdir)libintl
-libintl_OUT:=$(top_builddir)libintl
+libintl_DIR := $(top_srcdir)libintl
+libintl_OUT := $(top_builddir)libintl
+
+libintl_MSRC := $(libintl_DIR)/intl.c
+libintl_MOBJ := $(patsubst %.o,$(libintl_OUT)/%.o,$(MOBJ))
+
+libintl_DEF := $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libintl_MOBJ))))
+
+libintl-a-y := $(libintl_MOBJ)
+libintl-so-y := $(libintl_MOBJ:.o=.os)
+
+CFLAGS-multi-y := $(libintl_DEF)
+libintl-multi-y := $(libintl_MSRC)
-libintl_MSRC:=$(libintl_DIR)/intl.c
-libintl_MOBJ:=$(patsubst %.o,$(libintl_OUT)/%.o,$(MOBJ))
+lib-a-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(top_builddir)lib/libintl.a
+lib-so-$(UCLIBC_HAS_GETTEXT_AWARENESS) += $(top_builddir)lib/libintl.so
+objclean-y += libintl_clean
-libintl_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(libintl_MOBJ))))
+$(top_builddir)lib/libintl.so: $(libintl_OUT)/libintl_so.a libc-y
+ $(call link.so,$(libintl_FULL_NAME),$(MAJOR_VERSION))
+
+$(libintl_OUT)/libintl_so.a: $(libintl-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libintl.a: $(libintl-a-y:.o=.os)
+else
+$(top_builddir)lib/libintl.a: $(libintl-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
$(libintl_MOBJ): $(libintl_MSRC)
$(compile.m)
@@ -28,13 +61,5 @@ $(libintl_MOBJ): $(libintl_MSRC)
$(libintl_MOBJ:.o=.os): $(libintl_MSRC)
$(compile.m)
-libintl-a-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_MOBJ)
-libintl-so-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_MOBJ:.o=.os)
-
-CFLAGS-multi-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_DEF)
-libintl-multi-$(UCLIBC_HAS_GETTEXT_AWARENESS):=$(libintl_MSRC)
-
-objclean-y+=libintl_clean
-
-lib-a-$(UCLIBC_HAS_GETTEXT_AWARENESS)+=$(top_builddir)lib/libintl.a
-lib-so-$(UCLIBC_HAS_GETTEXT_AWARENESS)+=$(top_builddir)lib/libintl.so
+libintl_clean:
+ $(RM) $(libintl_OUT)/*.{o,os,a}
diff --git a/libm/Makefile.in b/libm/Makefile.in
index 465a5db4e..4057203fa 100644
--- a/libm/Makefile.in
+++ b/libm/Makefile.in
@@ -20,22 +20,27 @@
# by Erik Andersen <andersen@codepoet.org>
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-libm := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
+CFLAGS-libm += -D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
-CFLAGS+=-D_IEEE_LIBM -D_ISOC99_SOURCE -D_SVID_SOURCE
+CFLAGS-libm/$(TARGET_ARCH)/ := $(CFLAGS-libm)
-CFLAGS-s_lib_version.c=-D_POSIX_MODE
+CFLAGS-s_lib_version.c := -D_POSIX_MODE
-LIB_NAME:=libm
+LDFLAGS-libm.so := $(LDFLAGS)
+
+LIBS-libm.so := $(LIBS)
+
+libm_FULL_NAME := libm-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
ifeq ($(HAS_FPU),y)
-include $(top_srcdir)libm/$(TARGET_ARCH)/Makefile.arch
endif
-FL_MSRC:=float_wrappers.c
+FL_MSRC := float_wrappers.c
ifeq ($(DO_C99_MATH),y)
-CSRC:= \
+CSRC := \
e_acos.c e_acosh.c e_asin.c e_atan2.c e_atanh.c e_cosh.c \
e_exp.c e_fmod.c e_gamma.c e_gamma_r.c e_hypot.c e_j0.c \
e_j1.c e_jn.c e_lgamma.c e_lgamma_r.c e_log.c e_log10.c \
@@ -51,7 +56,7 @@ CSRC:= \
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 fpmacros.c nan.c
-FL_MOBJ:= \
+FL_MOBJ := \
acosf.o acoshf.o asinf.o asinhf.o atan2f.o atanf.o atanhf.o cbrtf.o \
ceilf.o copysignf.o cosf.o coshf.o erfcf.o erff.o exp2f.o expf.o \
expm1f.o fabsf.o fdimf.o floorf.o fmaf.o fmaxf.o fminf.o fmodf.o \
@@ -62,7 +67,7 @@ FL_MOBJ:= \
tgammaf.o truncf.o
else
# This list of math functions was taken from POSIX/IEEE 1003.1b-1993
-CSRC:= \
+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_fabs.c s_floor.c w_fmod.c s_frexp.c \
s_ldexp.c w_log.c w_log10.c s_modf.c w_pow.c s_sin.c \
@@ -72,11 +77,11 @@ CSRC:= \
k_sin.c e_sinh.c e_sqrt.c k_tan.c e_rem_pio2.c k_rem_pio2.c \
s_finite.c
# We'll add sqrtf to avoid problems with libstdc++
-FL_MOBJ:=sqrtf.o
+FL_MOBJ := sqrtf.o
endif
-libm_DIR:=$(top_srcdir)libm
-libm_OUT:=$(top_builddir)libm
+libm_DIR := $(top_srcdir)libm
+libm_OUT := $(top_builddir)libm
# assume that arch specific versions are provided as single sources/objects
ifeq ($(HAS_FPU),y)
@@ -84,50 +89,68 @@ ifneq ($(strip $(libm_ARCH_OBJS)),)
# remove generic sources, if arch specific version is present
ifneq ($(strip $(libm_ARCH_SRC)),)
-CSRC:=$(filter-out $(notdir $(libm_ARCH_SRC)),$(CSRC))
+CSRC := $(filter-out $(notdir $(libm_ARCH_SRC)),$(CSRC))
endif
# remove generic objects built from multi-sources, if arch specific version is present
-FL_MOBJ:=$(filter-out $(notdir $(libm_ARCH_OBJS)),$(FL_MOBJ))
+FL_MOBJ := $(filter-out $(notdir $(libm_ARCH_OBJS)),$(FL_MOBJ))
# we also try to remove % if s_% is in arch specific subdir
-FL_MOBJ:=$(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOBJ))
+FL_MOBJ := $(filter-out $(patsubst s_%.o,%.o,$(notdir $(libm_ARCH_OBJS))),$(FL_MOBJ))
endif
endif
ifneq ($(DOMULTI),n)
ifeq ($(DO_C99_MATH),y)
-LIBM_NO_MULTI:=s_lib_version.c
-CSRC:=$(filter-out $(LIBM_NO_MULTI),$(CSRC))
+LIBM_NO_MULTI := s_lib_version.c
+CSRC := $(filter-out $(LIBM_NO_MULTI),$(CSRC))
endif
endif
-libm_SRC:=$(patsubst %.c,$(libm_DIR)/%.c,$(CSRC))
-libm_OBJ:=$(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC))
+libm_SRC := $(patsubst %.c,$(libm_DIR)/%.c,$(CSRC))
+libm_OBJ := $(patsubst $(libm_DIR)/%.c,$(libm_OUT)/%.o,$(libm_SRC))
-libm_MSRC:=$(libm_DIR)/$(FL_MSRC)
-libm_MOBJ:=$(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ))
+libm_MSRC := $(libm_DIR)/$(FL_MSRC)
+libm_MOBJ := $(patsubst %.o,$(libm_OUT)/%.o,$(FL_MOBJ))
-libm_DEF:=$(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ))))
+libm_DEF := $(patsubst %,-DL_%,$(subst .o,,$(notdir $(libm_MOBJ))))
-libm_OBJS:=$(libm_OBJ) $(libm_MOBJ)
+libm_OBJS := $(libm_OBJ) $(libm_MOBJ)
-$(libm_MOBJ): $(libm_MSRC)
- $(compile.m)
+libm-a-y += $(libm_OBJS)
+libm-so-y += $(libm_OBJS:.o=.os)
-$(libm_MOBJ:.o=.os): $(libm_MSRC)
- $(compile.m)
+CFLAGS-multi-y := $(libm_DEF)
+libm-multi-y += $(libm_SRC) $(libm_MSRC)
+libm-nomulti-$(DO_C99_MATH) += $(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI))
-libm-a-$(UCLIBC_HAS_FLOATS)+=$(libm_OBJS)
-libm-so-$(UCLIBC_HAS_FLOATS)+=$(libm_OBJS:.o=.os)
+lib-a-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.a
+lib-so-$(UCLIBC_HAS_FLOATS) += $(top_builddir)lib/libm.so
+objclean-y += libm_clean
-CFLAGS-multi-$(UCLIBC_HAS_FLOATS)+=$(libm_DEF)
-libm-multi-$(UCLIBC_HAS_FLOATS)+=$(libm_SRC) $(libm_MSRC)
-ifeq ($(DO_C99_MATH),y)
-libm-nomulti-$(UCLIBC_HAS_FLOATS)+=$(patsubst %.c,$(libm_OUT)/%.o,$(LIBM_NO_MULTI))
+$(top_builddir)lib/libm.so: $(libm_OUT)/libm_so.a libc-y
+ $(call link.so,$(libm_FULL_NAME),$(MAJOR_VERSION))
+
+$(libm_OUT)/libm_so.a: $(libm-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libm.a: $(libm-a-y:.o=.os)
+else
+$(top_builddir)lib/libm.a: $(libm-a-y)
endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-objclean-y+=libm_clean
+$(libm_MOBJ): $(libm_MSRC)
+ $(compile.m)
+
+$(libm_MOBJ:.o=.os): $(libm_MSRC)
+ $(compile.m)
-lib-a-$(UCLIBC_HAS_FLOATS)+=$(top_builddir)lib/libm.a
-lib-so-$(UCLIBC_HAS_FLOATS)+=$(top_builddir)lib/libm.so
+libm_clean:
+ $(RM) $(libm_OUT)/*.{o,os,a}
diff --git a/libnsl/Makefile.in b/libnsl/Makefile.in
index b4dcefae2..765868e54 100644
--- a/libnsl/Makefile.in
+++ b/libnsl/Makefile.in
@@ -5,22 +5,46 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-libnsl := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
-LIB_NAME:=libnsl
+LDFLAGS-libnsl.so := $(LDFLAGS)
-libnsl_DIR:=$(top_srcdir)libnsl
-libnsl_OUT:=$(top_builddir)libnsl
+LIBS-libnsl.so := $(LIBS)
-libnsl_SRC:=$(libnsl_DIR)/nsl.c
-libnsl_OBJ:=$(patsubst $(libnsl_DIR)/%.c,$(libnsl_OUT)/%.o,$(libnsl_SRC))
+libnsl_FULL_NAME := libnsl-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-libnsl-a-y:=$(libnsl_OBJ)
-libnsl-so-y:=$(libnsl_OBJ:.o=.os)
+libnsl_DIR := $(top_srcdir)libnsl
+libnsl_OUT := $(top_builddir)libnsl
-libnsl-multi-y:=$(libnsl_SRC)
+libnsl_SRC := $(libnsl_DIR)/nsl.c
+libnsl_OBJ := $(patsubst $(libnsl_DIR)/%.c,$(libnsl_OUT)/%.o,$(libnsl_SRC))
-objclean-y+=libnsl_clean
+libnsl-a-y := $(libnsl_OBJ)
+libnsl-so-y := $(libnsl_OBJ:.o=.os)
-lib-a-y+=$(top_builddir)lib/libnsl.a
-lib-so-y+=$(top_builddir)lib/libnsl.so
+libnsl-multi-y := $(libnsl_SRC)
+
+lib-a-y += $(top_builddir)lib/libnsl.a
+lib-so-y += $(top_builddir)lib/libnsl.so
+objclean-y += libnsl_clean
+
+$(top_builddir)lib/libnsl.so: $(libnsl_OUT)/libnsl_so.a libc-y
+ $(call link.so,$(libnsl_FULL_NAME),$(MAJOR_VERSION))
+
+$(libnsl_OUT)/libnsl_so.a: $(libnsl-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libnsl.a: $(libnsl-a-y:.o=.os)
+else
+$(top_builddir)lib/libnsl.a: $(libnsl-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+libnsl_clean:
+ $(RM) $(libnsl_OUT)/*.{o,os,a}
diff --git a/libpthread/Makefile.in b/libpthread/Makefile.in
index 1ce452c1b..4772cba32 100644
--- a/libpthread/Makefile.in
+++ b/libpthread/Makefile.in
@@ -5,57 +5,5 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-ifeq ($(UCLIBC_HAS_THREADS),y)
-ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-DIRS:= $(PTNAME) $(PTNAME)_db
-libs: subdirs
-else
-# both do not work at once
include $(PTDIR)/Makefile.in
-#include $(PTDIR)_db/Makefile.in
-endif
-
-headers-y+=threads_headers
-
-# NPTL does not have a generic pthreadtypes.h
-# and each arch has to have both semaphore.h/pthreadtypes.h ?
-threads_headers:
- $(LN) -sf $(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
- $(LN) -sf $(PTDIR)/semaphore.h $(top_builddir)include/
-ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
- $(LN) -sf $(PTDIR)_db/thread_db.h $(top_builddir)include/
-endif
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
- $(LN) -sf ../$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/semaphore.h $(top_builddir)include/bits/
- $(LN) -sf ../$(PTDIR)/sysdeps/unix/sysv/linux/$(TARGET_ARCH)/bits/pthreadtypes.h $(top_builddir)include/bits/
- $(LN) -sf ../$(PTDIR)/sysdeps/pthread/bits/libc-lock.h $(top_builddir)include/bits/
- $(LN) -sf ../$(PTDIR)/sysdeps/pthread/bits/stdio-lock.h $(top_builddir)include/bits/
-else
- $(LN) -sf ../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
-endif
-
-endif
-
-headers_clean-y+=threads_headers_clean
-
-threads_headers_clean:
- $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
- $(top_builddir)include/thread_db.h \
- $(top_builddir)include/bits/pthreadtypes.h $(top_builddir)include/bits/semaphore.h \
- $(top_builddir)include/bits/libc-lock.h $(top_builddir)include/bits/stdio-lock
-# note to sjhill: the clean target shouldn't depend on PTNAME/PTDIR
-ifeq ($(UCLIBC_HAS_THREADS_NATIVE),y)
- $(RM) $(PTNAME)/version.h $(PTDIR)/banner.h \
- $(PTDIR)/sysdeps/unix/sysv/linux/rtld-libc-lowlevellock.c
-endif
-
-objclean-y+=libpthread_gen_clean
-
-libpthread_gen_clean:
- $(RM) $(top_builddir)libpthread/*/*.{o,os,a}
-
-ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-subdirs: $(patsubst %, _dir_%, $(DIRS))
-$(patsubst %, _dir_%, $(DIRS)):
- $(MAKE) -C $(patsubst _dir_%, %, $@)
-endif
+include $(PTDIR)_db/Makefile.in
diff --git a/libpthread/linuxthreads.old/Makefile.in b/libpthread/linuxthreads.old/Makefile.in
index ca3ded8f6..98ef6307b 100644
--- a/libpthread/linuxthreads.old/Makefile.in
+++ b/libpthread/linuxthreads.old/Makefile.in
@@ -6,57 +6,94 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-linuxthreads.old := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
-# This stuff will not compile without at least -O1
-CFLAGS:=$(CFLAGS:-O0=-O1)
-
-LDFLAGS:=$(LDFLAGS_NOSTRIP) -z defs
+CFLAGS-libpthread/linuxthreads.old/sysdeps/$(TARGET_ARCH)/ := $(CFLAGS-linuxthreads.old)
-ifeq ($(UCLIBC_CTOR_DTOR),y)
-SHARED_START_FILES:=$(top_builddir)lib/crti.o $(LIBGCC_DIR)crtbeginS.o
-SHARED_END_FILES:=$(LIBGCC_DIR)crtendS.o $(top_builddir)lib/crtn.o
-endif
+# This stuff will not compile without at least -O1
+# psm: can't handle this here, could maybe search for -O0 in CFLAGS
+# and append -O1 if found
+#CFLAGS:=$(CFLAGS:-O0=-O1)
ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-STRIP_FLAGS:=-X --strip-debug -R .note -R .comment
+LDFLAGS-libpthread.so := $(LDFLAGS_NOSTRIP) -z defs
+else
+LDFLAGS-libpthread.so := $(LDFLAGS)
endif
-DOMULTI=n
+LIBS-libpthread.so := $(LIBS)
-LIB_NAME:=libpthread
+START_FILE-libpthread.so := $(SHARED_START_FILES)
+END_FILE-libpthread.so := $(SHARED_END_FILES)
-libpthread_DIR:=$(top_srcdir)libpthread/linuxthreads.old
-libpthread_OUT:=$(top_builddir)libpthread/linuxthreads.old
+libpthread_FULL_NAME := libpthread-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+libpthread_DIR := $(top_srcdir)libpthread/linuxthreads.old
+libpthread_OUT := $(top_builddir)libpthread/linuxthreads.old
-ARCH_CFLAGS:=$(CFLAGS)
-include $(libpthread_DIR)/sysdeps/$(TARGET_ARCH)/Makefile.arch
-CFLAGS:=$(ARCH_CFLAGS)
-libpthread_SRC:=$(wildcard $(libpthread_DIR)/*.c)
+libpthread_SRC := $(wildcard $(libpthread_DIR)/*.c)
ifneq ($(UCLIBC_HAS_XLOCALE),y)
-libpthread_SRC:=$(filter-out $(libpthread_DIR)/locale.c,$(libpthread_SRC))
+libpthread_SRC := $(filter-out $(libpthread_DIR)/locale.c,$(libpthread_SRC))
endif
ifneq ($(DOMULTI),n)
-libpthread_NO_MULTI:=manager.c pt-machine.c
-libpthread_SRC:=$(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(libpthread_NO_MULTI)),$(libpthread_SRC))
+libpthread_NO_MULTI := manager.c pt-machine.c
+libpthread_SRC := $(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(libpthread_NO_MULTI)),$(libpthread_SRC))
endif
# remove generic sources, if arch specific version is present
ifneq ($(strip $(libpthread_ARCH_SRC)),)
-libpthread_SRC:=$(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(notdir $(libpthread_ARCH_SRC))),$(libpthread_SRC))
+libpthread_SRC := $(filter-out $(patsubst %.c,$(libpthread_DIR)/%.c,$(notdir $(libpthread_ARCH_SRC))),$(libpthread_SRC))
+endif
+
+libpthread_OBJ := $(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
+
+libpthread-a-y += $(libpthread_OBJ)
+libpthread-so-y += $(libpthread_OBJ:.o=.os)
+
+libpthread-multi-y += $(libpthread_SRC)
+libpthread-nomulti-y += $(patsubst %.c,$(libpthread_OUT)/%.o,$(libpthread_NO_MULTI))
+
+lib-a-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.a
+lib-so-$(UCLIBC_HAS_THREADS) += $(top_builddir)lib/libpthread.so
+objclean-y += libpthread_clean
+headers-$(UCLIBC_HAS_THREADS) += linuxthreads_headers
+headers_clean-y += linuxthreads_headers_clean
+
+$(top_builddir)lib/libpthread.so: $(libpthread_OUT)/libpthread_so.a libc-y
+ $(call link.so,$(libpthread_FULL_NAME),$(MAJOR_VERSION))
+
+$(libpthread_OUT)/libpthread_so.a: $(libpthread-so-y)
+ $(Q)$(RM) $@
+ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
+ $(do_strip:-x=-X --strip-debug)
+else
+ $(do_strip)
endif
+ $(do_ar)
-libpthread_OBJ:=$(patsubst $(libpthread_DIR)/%.c,$(libpthread_OUT)/%.o,$(libpthread_SRC))
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libpthread.a: $(libpthread-a-y:.o=.os)
+else
+$(top_builddir)lib/libpthread.a: $(libpthread-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-libpthread-a-$(UCLIBC_HAS_THREADS)+=$(libpthread_OBJ)
-libpthread-so-$(UCLIBC_HAS_THREADS)+=$(libpthread_OBJ:.o=.os)
+linuxthreads_headers:
+ $(LN) -sf ../$(PTDIR)/sysdeps/pthread/pthread.h $(top_builddir)include/
+ $(LN) -sf ../$(PTDIR)/semaphore.h $(top_builddir)include/
+ $(INSTALL) -d $(top_builddir)include/bits
+ $(LN) -sf ../../$(PTDIR)/sysdeps/pthread/bits/pthreadtypes.h $(top_builddir)include/bits/
-libpthread-multi-$(UCLIBC_HAS_THREADS)+=$(libpthread_SRC)
-libpthread-nomulti-$(UCLIBC_HAS_THREADS)+=$(patsubst %.c,$(libpthread_OUT)/%.o,$(libpthread_NO_MULTI))
-objclean-y+=libpthread_clean
+linuxthreads_headers_clean:
+ $(RM) $(top_builddir)include/pthread.h $(top_builddir)include/semaphore.h \
+ $(top_builddir)include/bits/pthreadtypes.h
-lib-a-$(UCLIBC_HAS_THREADS)+=$(top_builddir)lib/libpthread.a
-lib-so-$(UCLIBC_HAS_THREADS)+=$(top_builddir)lib/libpthread.so
+libpthread_clean:
+ $(RM) $(libpthread_OUT)/*.{o,os,a}
diff --git a/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch b/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch
index 38cd12db6..e4cb95b76 100644
--- a/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch
+++ b/libpthread/linuxthreads.old/sysdeps/sh64/Makefile.arch
@@ -6,21 +6,25 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-# We need to build as SHcompact for tas..
-ARCH_CFLAGS:=$(subst 32media,compact,$(ARCH_CFLAGS))
-
-libpthread_ARCH_DIR:=$(top_srcdir)libpthread/linuxthreads/sysdeps/sh64
-libpthread_ARCH_OUT:=$(top_builddir)libpthread/linuxthreads/sysdeps/sh64
+libpthread_ARCH_DIR:=$(top_srcdir)libpthread/linuxthreads.old/sysdeps/sh64
+libpthread_ARCH_OUT:=$(top_builddir)libpthread/linuxthreads.old/sysdeps/sh64
libpthread_ARCH_SRC:=$(wildcard $(libpthread_ARCH_DIR)/*.c)
libpthread_ARCH_OBJ:=$(patsubst $(libpthread_ARCH_DIR)/%.c,$(libpthread_ARCH_OUT)/%.o,$(libpthread_ARCH_SRC))
-libpthread-a-$(UCLIBC_HAS_THREADS)+=$(libpthread_ARCH_OBJ)
-libpthread-so-$(UCLIBC_HAS_THREADS)+=$(libpthread_ARCH_OBJ:.o=.os)
+libpthread-a-y+=$(libpthread_ARCH_OBJ)
+libpthread-so-y+=$(libpthread_ARCH_OBJ:.o=.os)
-libpthread-multi-$(UCLIBC_HAS_THREADS)+=$(libpthread_ARCH_SRC)
+libpthread-multi-y+=$(libpthread_ARCH_SRC)
objclean-y+=libpthread_arch_objclean
+# We need to build as SHcompact for tas..
+$(libpthread_ARCH_OBJ): %.o : %.c
+ $(compile.c:32media=compact)
+
+$(libpthread_ARCH_OBJ:.o=.os): %.os : %.c
+ $(compile.c:32media=compact)
+
libpthread_arch_objclean:
$(RM) $(libpthread_ARCH_OUT)/*.{o,os}
diff --git a/libpthread/linuxthreads.old_db/Makefile.in b/libpthread/linuxthreads.old_db/Makefile.in
index ec007e90a..af42ed312 100644
--- a/libpthread/linuxthreads.old_db/Makefile.in
+++ b/libpthread/linuxthreads.old_db/Makefile.in
@@ -5,39 +5,56 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-#CFLAGS+=$(SSP_ALL_CFLAGS)
-
-PT_MAJOR_VERSION:=$(MAJOR_VERSION)
# Get the thread include dependencies and shared object name
-CFLAGS+=-DLIBPTHREAD_SO="\"libpthread.so.$(PT_MAJOR_VERSION)\""
+CFLAGS-linuxthreads_db.old := -DLIBPTHREAD_SO="\"libpthread.so.$(MAJOR_VERSION)\""
-# Remove any -z defs since this lib will have undefined symbols
-LDFLAGS:=$(LDFLAGS_NOSTRIP) -s --warn-unresolved-symbols
+LDFLAGS-libthread_db.so := $(LDFLAGS_NOSTRIP) -s --warn-unresolved-symbols
-ifeq ($(PTHREADS_DEBUG_SUPPORT),y)
-STRIP_FLAGS:=-X --strip-debug -R .note -R .comment
-endif
+LIBS-libthread_db.so := $(LIBS)
+
+libthread_db_FULL_NAME := libthread_db-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-DOMULTI=n
+libthread_db_DIR := $(top_srcdir)libpthread/linuxthreads_db.old
+libthread_db_OUT := $(top_builddir)libpthread/linuxthreads_db.old
-LIB_NAME:=libthread_db
-libthread_db_FULL_NAME:=$(LIB_NAME)-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+libthread_db_SRC := $(wildcard $(libthread_db_DIR)/*.c)
-MAJOR_VERSION:=1
+libthread_db_OBJ := $(patsubst $(libthread_db_DIR)/%.c,$(libthread_db_OUT)/%.o,$(libthread_db_SRC))
-libthread_db_DIR:=$(top_srcdir)libpthread/linuxthreads.old_db
-libthread_db_OUT:=$(top_builddir)libpthread/linuxthreads.old_db
+libthread_db-a-y := $(libthread_db_OBJ)
+libthread_db-so-y := $(libthread_db_OBJ:.o=.os)
-libthread_db_SRC:=$(wildcard $(libthread_db_DIR)/*.c)
+libthread_db-multi-y := $(libthread_db_SRC)
-libthread_db_OBJ:=$(patsubst $(libthread_db_DIR)/%.c,$(libthread_db_OUT)/%.o,$(libthread_db_SRC))
+lib-a-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.a
+lib-so-$(PTHREADS_DEBUG_SUPPORT) += $(top_builddir)lib/libthread_db.so
+objclean-y += libthread_db_clean
+headers-$(PTHREADS_DEBUG_SUPPORT) += linuxthreads_db_headers
+headers_clean-y += linuxthreads_db_headers_clean
-libthread_db-a-$(PTHREADS_DEBUG_SUPPORT)+=$(libthread_db_OBJ)
-libthread_db-so-$(PTHREADS_DEBUG_SUPPORT)+=$(libthread_db_OBJ:.o=.os)
+$(top_builddir)lib/libthread_db.so: $(libthread_db_OUT)/libthread_db_so.a libc-y
+ $(call link.so,$(libthread_db_FULL_NAME),1,,$(EXTRA_LINK_LIBS),,)
+
+$(libthread_db_OUT)/libthread_db_so.a: $(libthread_db-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libthread_db.a: $(libthread_db-a-y:.o=.os)
+else
+$(top_builddir)lib/libthread_db.a: $(libpthread_db-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-libthread_db-multi-$(PTHREADS_DEBUG_SUPPORT)+=$(libthread_db_SRC)
+linuxthreads_db_headers:
+ $(LN) -sf ../$(PTDIR)_db/thread_db.h $(top_builddir)include/
-objclean-y+=libthread_db_clean
+linuxthreads_db_headers_clean:
+ $(RM) $(top_builddir)include/thread_db.h
-lib-a-$(PTHREADS_DEBUG_SUPPORT)+=$(top_builddir)lib/libthread_db.a
-lib-so-$(PTHREADS_DEBUG_SUPPORT)+=$(top_builddir)lib/libthread_db.so
+libthread_db_clean:
+ $(RM) $(libthread_db_OUT)/*.{o,os,a}
diff --git a/libresolv/Makefile.in b/libresolv/Makefile.in
index 06938da9b..d94a076f8 100644
--- a/libresolv/Makefile.in
+++ b/libresolv/Makefile.in
@@ -5,22 +5,46 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-libresolv := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
-LIB_NAME:=libresolv
+LDFLAGS-libresolv.so := $(LDFLAGS)
-libresolv_DIR:=$(top_srcdir)libresolv
-libresolv_OUT:=$(top_builddir)libresolv
+LIBS-libresolv.so := $(LIBS)
-libresolv_SRC:=$(libresolv_DIR)/resolv.c
-libresolv_OBJ:=$(patsubst $(libresolv_DIR)/%.c,$(libresolv_OUT)/%.o,$(libresolv_SRC))
+libresolv_FULL_NAME := libresolv-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-libresolv-a-y:=$(libresolv_OBJ)
-libresolv-so-y:=$(libresolv_OBJ:.o=.os)
+libresolv_DIR := $(top_srcdir)libresolv
+libresolv_OUT := $(top_builddir)libresolv
-libresolv-multi-y:=$(libresolv_SRC)
+libresolv_SRC := $(libresolv_DIR)/resolv.c
+libresolv_OBJ := $(patsubst $(libresolv_DIR)/%.c,$(libresolv_OUT)/%.o,$(libresolv_SRC))
-objclean-y+=libresolv_clean
+libresolv-a-y := $(libresolv_OBJ)
+libresolv-so-y := $(libresolv_OBJ:.o=.os)
-lib-a-y+=$(top_builddir)lib/libresolv.a
-lib-so-y+=$(top_builddir)lib/libresolv.so
+libresolv-multi-y := $(libresolv_SRC)
+
+lib-a-y += $(top_builddir)lib/libresolv.a
+lib-so-y += $(top_builddir)lib/libresolv.so
+objclean-y += libresolv_clean
+
+$(top_builddir)lib/libresolv.so: $(libresolv_OUT)/libresolv_so.a libc-y
+ $(call link.so,$(libresolv_FULL_NAME),$(MAJOR_VERSION))
+
+$(libresolv_OUT)/libresolv_so.a: $(libresolv-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libresolv.a: $(libresolv-a-y:.o=.os)
+else
+$(top_builddir)lib/libresolv.a: $(libresolv-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+libresolv_clean:
+ $(RM) $(libresolv_OUT)/*.{o,os,a}
diff --git a/librt/Makefile.in b/librt/Makefile.in
index 0122f123a..7a2a44d03 100644
--- a/librt/Makefile.in
+++ b/librt/Makefile.in
@@ -5,22 +5,46 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-librt := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
-LIB_NAME:=librt
+LDFLAGS-librt.so := $(LDFLAGS)
-librt_DIR:=$(top_srcdir)librt
-librt_OUT:=$(top_builddir)librt
+LIBS-librt.so := $(LIBS)
-librt_SRC:=$(wildcard $(librt_DIR)/*.c)
-librt_OBJ:=$(patsubst $(librt_DIR)/%.c,$(librt_OUT)/%.o,$(librt_SRC))
+librt_FULL_NAME := librt-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
-librt-a-y:=$(librt_OBJ)
-librt-so-y:=$(librt_OBJ:.o=.os)
+librt_DIR := $(top_srcdir)librt
+librt_OUT := $(top_builddir)librt
-librt-multi-y+=$(librt_SRC)
+librt_SRC := $(wildcard $(librt_DIR)/*.c)
+librt_OBJ := $(patsubst $(librt_DIR)/%.c,$(librt_OUT)/%.o,$(librt_SRC))
-objclean-y+=librt_clean
+librt-a-y := $(librt_OBJ)
+librt-so-y := $(librt_OBJ:.o=.os)
-lib-a-y+=$(top_builddir)lib/librt.a
-lib-so-y+=$(top_builddir)lib/librt.so
+librt-multi-y += $(librt_SRC)
+
+lib-a-y += $(top_builddir)lib/librt.a
+lib-so-y += $(top_builddir)lib/librt.so
+objclean-y += librt_clean
+
+$(top_builddir)lib/librt.so: $(librt_OUT)/librt_so.a libc-y
+ $(call link.so,$(librt_FULL_NAME),$(MAJOR_VERSION))
+
+$(librt_OUT)/librt_so.a: $(librt-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/librt.a: $(librt-a-y:.o=.os)
+else
+$(top_builddir)lib/librt.a: $(librt-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+librt_clean:
+ $(RM) $(librt_OUT)/*.{o,os,a}
diff --git a/libutil/Makefile.in b/libutil/Makefile.in
index 6095bf405..79c329a33 100644
--- a/libutil/Makefile.in
+++ b/libutil/Makefile.in
@@ -5,25 +5,49 @@
# Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball.
#
-CFLAGS+=$(SSP_ALL_CFLAGS)
+CFLAGS-libutil := -DNOT_IN_libc $(SSP_ALL_CFLAGS)
-LIB_NAME:=libutil
+LDFLAGS-libutil.so := $(LDFLAGS)
-libutil_DIR:=$(top_srcdir)libutil
-libutil_OUT:=$(top_builddir)libutil
+LIBS-libutil.so := $(LIBS)
-libutil_SRC:=$(wildcard $(libutil_DIR)/*.c)
+libutil_FULL_NAME := libutil-$(MAJOR_VERSION).$(MINOR_VERSION).$(SUBLEVEL).so
+
+libutil_DIR := $(top_srcdir)libutil
+libutil_OUT := $(top_builddir)libutil
+
+libutil_SRC := $(wildcard $(libutil_DIR)/*.c)
ifneq ($(ARCH_HAS_MMU),y)
-libutil_SRC:=$(filter-out $(libutil_DIR)/forkpty.c,$(libutil_SRC))
+libutil_SRC := $(filter-out $(libutil_DIR)/forkpty.c,$(libutil_SRC))
endif
-libutil_OBJ:=$(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC))
+libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC))
+
+libutil-a-y := $(libutil_OBJ)
+libutil-so-y := $(libutil_OBJ:.o=.os)
-libutil-a-y:=$(libutil_OBJ)
-libutil-so-y:=$(libutil_OBJ:.o=.os)
+libutil-multi-y := $(libutil_SRC)
-libutil-multi-y:=$(libutil_SRC)
+lib-a-y += $(top_builddir)lib/libutil.a
+lib-so-y += $(top_builddir)lib/libutil.so
+objclean-y += libutil_clean
-objclean-y+=libutil_clean
+$(top_builddir)lib/libutil.so: $(libutil_OUT)/libutil_so.a libc-y
+ $(call link.so,$(libutil_FULL_NAME),$(MAJOR_VERSION))
+
+$(libutil_OUT)/libutil_so.a: $(libutil-so-y)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
+
+ifeq ($(DOPIC),y)
+$(top_builddir)lib/libutil.a: $(libutil-a-y:.o=.os)
+else
+$(top_builddir)lib/libutil.a: $(libutil-a-y)
+endif
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)$(RM) $@
+ $(do_strip)
+ $(do_ar)
-lib-a-y+=$(top_builddir)lib/libutil.a
-lib-so-y+=$(top_builddir)lib/libutil.so
+libutil_clean:
+ $(RM) $(libutil_OUT)/*.{o,os,a}