summaryrefslogtreecommitdiff
path: root/Makerules
diff options
context:
space:
mode:
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules53
1 files changed, 26 insertions, 27 deletions
diff --git a/Makerules b/Makerules
index 45a79e60c..48831b937 100644
--- a/Makerules
+++ b/Makerules
@@ -8,34 +8,20 @@
ifeq ($(HAVE_SHARED),y)
.LIBPATTERNS: "lib%.so"
libs: $(lib-so-y) $(lib-a-y)
-objs: shared_objs ar_objs
+objs: $(sort $(shared_objs) $(ar_objs))
else
.LIBPATTERNS: "lib%.a"
libs: $(lib-a-y)
-objs: ar_objs
+objs: $(ar_objs)
endif
-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
+shared_objs = $(lduClibc-so-y) $(libc-so-y) $(libc-nonshared-y) $(libdl-so-y)
+shared_objs += $(libcrypt-so-y) $(libintl-so-y) $(libm-so-y) $(libnsl-so-y) $(libpthread-so-y)
+shared_objs += $(libresolv-so-y) $(librt-so-y) $(libutil-so-y)
+ar_objs = $(libc-a-y) $(libcrypt-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y)
+ar_objs += $(libpthread-a-y) $(libresolv-a-y) $(librt-a-y) $(libutil-a-y)
headers-y: $(headers-y)
-interp-y: $(interp)
-pre-y: $(interp) $(ld-uClibc-y)
-libc-y: pre-y $(libc) $(crt-y) $(top_builddir)lib/$(NONSHARED_LIBNAME)
-ldso-dep =
-libc-so-dep = $(top_builddir)lib/libc.so $(interp)
-lib-so-y = $(libc-so-dep) $(lib-so-y)
-lib-a-y = $(crt-y) $(lib-a-y)
ifneq ($(findstring s,$(MAKEFLAGS)),)
DISP := sil
@@ -124,6 +110,23 @@ CFLAGS-.oS+=$(PICFLAG) -DSHARED
%.E: %.c ; $(compile.E)
%.E: %.S ; $(compile.E)
+$(top_builddir)lib/interp.c:
+ $(Q)$(INSTALL) -d $(dir $@)
+ $(Q)echo "/* Force shared libraries to know about the correct library loader */" > $@
+ $(Q)echo "#include <features.h>" >> $@
+ $(Q)echo "#ifdef __HAVE_ELF__" >> $@
+ $(Q)echo "const char __dl_ldso__[] __attribute__ ((section " \
+ "(\".interp\"))) =\""$(SHARED_LIB_LOADER_PREFIX)/$(UCLIBC_LDSO)"\";" >> $@
+ $(Q)echo "#endif" >> $@
+
+$(interp): $(top_builddir)lib/interp.c
+ $(compile.c)
+ @$(disp_strip)
+ $(Q)$(STRIPTOOL) -x -R .note -R .comment $@
+
+$(ldso):
+ cd $(top_builddir); $(MAKE) $(ldso:.$(MAJOR_VERSION)=)
+
#ifeq ($(HAVE_ELF),y)
CRT=crt1
#else
@@ -151,16 +154,12 @@ $(top_builddir)lib/S$(CRT).o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(C
CTOR_TARGETS=$(top_builddir)lib/crti.o $(top_builddir)lib/crtn.o
ifeq ($(UCLIBC_CTOR_DTOR),y)
-$(top_builddir)lib/crti.o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/crti.S
- $(Q)$(INSTALL) -d $(dir $@)
- $(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
-
-$(top_builddir)lib/crtn.o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/crtn.S
+$(CTOR_TARGETS): $(top_builddir)lib/%.o : $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/%.S
$(Q)$(INSTALL) -d $(dir $@)
$(compile.S) $(PICFLAG) $(SSP_DISABLE_FLAGS)
else
$(CTOR_TARGETS):
- $(Q)$(INSTALL) -d $(top_builddir)lib
+ $(Q)$(INSTALL) -d $(dir $@)
$(do_ar)
endif