aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2003-04-11 23:34:00 +0000
committerRoland McGrath <roland@gnu.org>2003-04-11 23:34:00 +0000
commit4a2939f99712ba0990758f7ab3616fcdc89c756d (patch)
tree6febea0d5f0c4ad118644494b668f6d75c7c8e44
parent84a80719cc3f3308f90b0c6dbb9a05c76c576fd1 (diff)
downloadglibc-4a2939f99712ba0990758f7ab3616fcdc89c756d.tar
glibc-4a2939f99712ba0990758f7ab3616fcdc89c756d.tar.gz
glibc-4a2939f99712ba0990758f7ab3616fcdc89c756d.tar.bz2
glibc-4a2939f99712ba0990758f7ab3616fcdc89c756d.zip
2003-04-11 Roland McGrath <roland@redhat.com>
* Makefile (multidir): Don't set the variable here with $(shell ...). ($(objpfx)multidir.mk): New target, generated makefile; include that. (generated): Append it. 2003-04-10 Jakub Jelinek <jakub@redhat.com> * Makefile (multidir, crti-objs, crtn-objs): New variables. (generated-dirs): Add pathname component of multidir. (omit-deps, extra-objs): Include $(multidir)/crt? as well. ($(objpfx)libpthread.so): Depend on $(multidir)/crt?.o as well. ($(objpfx)$(multidir), $(objpfx)$(multidir)/crti.o, $(objpfx)$(multidir)/crtn.o): New. * sysdeps/unix/sysv/linux/sparc/Makefile: Removed. * sysdeps/unix/sysv/linux/x86_64/Makefile (LDFLAGS-pthread.so, before-compile, generated): Don't generate and use specs. ($(objpfx)specs): Remove.
-rw-r--r--linuxthreads/Makefile36
1 files changed, 32 insertions, 4 deletions
diff --git a/linuxthreads/Makefile b/linuxthreads/Makefile
index 7c4f5803c6..d832074432 100644
--- a/linuxthreads/Makefile
+++ b/linuxthreads/Makefile
@@ -79,7 +79,24 @@ $(objpfx)libpthread_nonshared.a: $(addprefix $(objpfx),$(addsuffix .os,$(libpthr
ifeq ($(build-shared),yes)
-extra-objs += crti.o crtn.o
+# Set the `multidir' variable by grabbing the variable from the compiler.
+# We do it once and save the result in a generated makefile.
+-include $(objpfx)multidir.mk
+$(objpfx)multidir.mk: $(common-objpfx)config.make
+ dir=`$(CC) $(CFLAGS) $(CPPFLAGS) -print-multi-directory`; \
+ echo "multidir := $$dir" > $@T
+ mv -f $@T $@
+generated += multidir.mk
+
+crti-objs := crti.o
+crtn-objs := crtn.o
+ifneq (,$(patsubst .,,$(multidir)))
+generated-dirs := $(firstword $(subst /, , $(multidir)))
+crti-objs += $(multidir)/crti.o
+crtn-objs += $(multidir)/crtn.o
+omit-deps += $(multidir)/crti $(multidir)/crtn
+endif
+extra-objs += $(crti-objs) $(crtn-objs)
omit-deps += crti crtn
CFLAGS-pt-initfini.s = -g0 -fPIC -fno-inline-functions
@@ -132,9 +149,9 @@ $(inst_libdir)/libpthread_nonshared.a: $(objpfx)libpthread_nonshared.a
extra-B-pthread.so = -B$(common-objpfx)linuxthreads/
-$(objpfx)libpthread.so: $(objpfx)crti.o $(objpfx)crtn.o
-$(objpfx)libpthread.so: +preinit += $(objpfx)crti.o
-$(objpfx)libpthread.so: +postinit += $(objpfx)crtn.o
+$(objpfx)libpthread.so: $(addprefix $(objpfx),$(crti-objs) $(crtn-objs))
+$(objpfx)libpthread.so: +preinit += $(addprefix $(objpfx),$(crti-objs))
+$(objpfx)libpthread.so: +postinit += $(addprefix $(objpfx),$(crtn-objs))
znodelete-yes = -DHAVE_Z_NODELETE
CFLAGS-mutex.c += -D__NO_WEAK_PTHREAD_ALIASES
@@ -249,6 +266,17 @@ $(objpfx)crti.o: $(objpfx)crti.S $(objpfx)defs.h
$(objpfx)crtn.o: $(objpfx)crtn.S $(objpfx)defs.h
$(compile.S) -g0 $(ASFLAGS-.os) -o $@
+ifneq ($(multidir),.)
+$(objpfx)$(multidir):
+ @mkdir -p $(objpfx)$(multidir)
+
+$(objpfx)$(multidir)/crti.o: $(objpfx)crti.o $(objpfx)$(multidir)
+ ln -f $< $@
+
+$(objpfx)$(multidir)/crtn.o: $(objpfx)crtn.o $(objpfx)$(multidir)
+ ln -f $< $@
+endif
+
generated += crti.S crtn.S defs.h pt-initfini.s
endif