summaryrefslogtreecommitdiffstats
path: root/Makerules
diff options
context:
space:
mode:
author"Steven J. Hill" <sjhill@realitydiluted.com>2005-11-29 03:51:02 +0000
committer"Steven J. Hill" <sjhill@realitydiluted.com>2005-11-29 03:51:02 +0000
commit2d9da2f6be3e662889ef0e72759fe0f1a1495812 (patch)
tree8305337a5a2dee0085b57e970426f15c8d96dac5 /Makerules
parent52d5212ff513bcc37a2c146ac99a76fd93189372 (diff)
downloaduClibc-alpine-2d9da2f6be3e662889ef0e72759fe0f1a1495812.tar.bz2
uClibc-alpine-2d9da2f6be3e662889ef0e72759fe0f1a1495812.tar.xz
Merge from trunk that gives us a valid NPTL dynamic loader and the start of the new build system. I have probably another 300 and some files to go *sigh*.
Diffstat (limited to 'Makerules')
-rw-r--r--Makerules90
1 files changed, 57 insertions, 33 deletions
diff --git a/Makerules b/Makerules
index 281afe7a3..91cae1ea6 100644
--- a/Makerules
+++ b/Makerules
@@ -2,42 +2,34 @@
# Licensed under LGPL v2.1, see the file COPYING.LIB in this tarball for details.
#
-.SUFFIXES: .c .S .o .os .oS .so .a .s .i
+.SUFFIXES: .c .S .o .os .oS .so .a .s .i .E
# order is important, the stripping uses STRIP_FLAGS for lib-so, but not for lib-a
ifeq ($(HAVE_SHARED),y)
.LIBPATTERNS: "lib%.so"
-libs: lib-so-y lib-a-y
-objs: shared_objs ar_objs
+libs: $(lib-so-y) $(lib-a-y)
else
.LIBPATTERNS: "lib%.a"
-libs: lib-a-y
-objs: ar_objs
+libs: $(lib-a-y)
endif
+objs: all_objs
-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)
+shared_objs = $(ld-uClibc-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 += $(libthread_db-so-y) $(libresolv-so-y) $(librt-so-y) $(libutil-so-y)
+ar_objs = $(libc-a-y) $(libdl-a-y) $(libcrypt-a-y) $(libintl-a-y) $(libm-a-y) $(libnsl-a-y)
+ar_objs += $(libpthread-a-y) $(libthread_db-a-y) $(libresolv-a-y) $(librt-a-y) $(libutil-a-y)
ifeq ($(DOPIC),y)
-ar_objs: $(ar_objs-y:.o=.os)
+ar_objs := $(ar_objs:.o=.os)
+endif
+
+ifeq ($(HAVE_SHARED),y)
+all_objs: $(sort $(shared_objs) $(ar_objs))
else
-ar_objs: $(ar_objs-y)
+all_objs: $(ar_objs)
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 $(top_builddir)lib/$(NONSHARED_LIBNAME)
-lib-so-y: libc-y $(lib-so-y)
-lib-a-y: $(top_builddir)include/headers_done crt-y $(lib-a-y)
-
-$(top_builddir)include/headers_done:
- @cd $(top_builddir); $(MAKE) headers
ifneq ($(findstring s,$(MAKEFLAGS)),)
DISP := sil
@@ -58,7 +50,7 @@ pur_disp_compile.c = echo " "CC $(show_objs)
pur_disp_compile.S = echo " "AS $(show_objs)
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_strip = echo " "STRIP $(STRIP_FLAGS) $@
pur_disp_ar = echo " "AR $(ARFLAGS) $@
pur_disp_ld = echo " "LD $(1)
@@ -93,6 +85,13 @@ cmd_compile-m = $(CC) $^ -c -o $@ $(CFLAGS) $(ARCH_CFLAGS) $(CFLAGS-$(suffix $@)
cmd_strip = $(STRIPTOOL) $(STRIP_FLAGS) $^
cmd_ar = $(AR) $(ARFLAGS) $@ $^
+define compile.u
+ $(CC) $^ $(DEPS-$(notdir $@)) -o $@ $(CFLAGS) $(CFLAGS-$(notdir $(^D))) $(CFLAGS-$(notdir $@))
+ $(STRIPTOOL) $(STRIP_FLAGS) $@
+endef
+hcompile.u = $(HOSTCC) $^ $(DEPS-$(notdir $@)) -o $@ $(BUILD_LDFLAGS) $(BUILD_LDFLAGS-$(notdir $(^D))) $(BUILD_LDFLAGS-$(notdir $@)) $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
+hcompile.o = $(HOSTCC) $^ $(DEPS-$(notdir $@)) -c -o $@ $(BUILD_CFLAGS) $(BUILD_CFLAGS-$(notdir $(^D))) $(BUILD_CFLAGS-$(notdir $@))
+
compile.c = @$(disp_compile.c) ; $(cmd_compile.c)
compile.E = $(cmd_compile.c:-c=-E)
compile.S = @$(disp_compile.S) ; $(cmd_compile.S)
@@ -121,11 +120,36 @@ CFLAGS-.oS+=$(PICFLAG) -DSHARED
%.oS: %.c ; $(compile.c)
%.o: %.S ; $(compile.S)
%.os: %.S ; $(compile.S)
+%.oS: %.S ; $(compile.S)
%.o: %.s ; $(compile.S)
%.os: %.s ; $(compile.S)
+%.oS: %.s ; $(compile.S)
%.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) lib/$(patsubst %.$(MAJOR_VERSION),%,$(notdir $@))
+
+$(libc):
+ cd $(top_builddir); $(MAKE) lib/$(patsubst %.$(MAJOR_VERSION),%,$(notdir $@))
+
+$(headers_dep):
+ cd $(top_builddir); $(MAKE) headers
+
#ifeq ($(HAVE_ELF),y)
CRT=crt1
#else
@@ -141,32 +165,27 @@ endif
$(top_builddir)lib/$(CRT).o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(CRT).S
$(Q)$(INSTALL) -d $(dir $@)
$(compile.S) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
- @$(disp_strip) $(show_objs)
+ @$(disp_strip)
$(Q)$(STRIPTOOL) -x -R .note -R .comment $@
$(top_builddir)lib/S$(CRT).o: $(top_srcdir)libc/sysdeps/linux/$(TARGET_ARCH)/$(CRT).S
$(Q)$(INSTALL) -d $(dir $@)
$(compile.S) $(PIEFLAG) -DL_$(patsubst %$(suffix $(notdir $@)),%,$(notdir $@))
- @$(disp_strip) $(show_objs)
+ @$(disp_strip)
$(Q)$(STRIPTOOL) -x -R .note -R .comment $@
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
-crt-y: $(crt-y)
$(crt-y): $(CRTS) $(CTOR_TARGETS)
$(top_builddir)lib/$(NONSHARED_LIBNAME): $(libc-nonshared-y)
@@ -178,3 +197,8 @@ clean: objclean-y headers_clean-y
objclean-y: $(objclean-y)
headers_clean-y: $(headers_clean-y)
+
+.PHONY: \
+ all check clean distclean test \
+ config dist menuconfig oldconfig release \
+ subdirs utils