about summary refs log tree commit diff
path: root/Makefile
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2011-06-23 22:13:47 -0400
committerRich Felker <dalias@aerifal.cx>2011-06-23 22:13:47 -0400
commitec05a0b08f0d93341c149a6f3235e4ee5711b2f8 (patch)
treeefcab9f79ced717da74e9877caa421502351c0c9 /Makefile
parentb7f6e0c6f848b7a8c64b3f7b72014b48a9923729 (diff)
downloadmusl-ec05a0b08f0d93341c149a6f3235e4ee5711b2f8.tar.gz
musl-ec05a0b08f0d93341c149a6f3235e4ee5711b2f8.tar.xz
musl-ec05a0b08f0d93341c149a6f3235e4ee5711b2f8.zip
adapt build/install/gcc-wrapper systems for dynamic linking support
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile20
1 files changed, 15 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 5c176423..277aa00a 100644
--- a/Makefile
+++ b/Makefile
@@ -35,14 +35,15 @@ EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a)
 CRT_LIBS = lib/crt1.o lib/crti.o lib/crtn.o
 LIBC_LIBS = lib/libc.a
 ALL_LIBS = $(LIBC_LIBS) $(CRT_LIBS) $(EMPTY_LIBS)
+ALL_LDSO = lib/ld-musl-$(ARCH).so.1
 
 ALL_TOOLS = tools/musl-gcc
 
 -include config.mak
 
-all: $(ALL_LIBS) $(ALL_TOOLS)
+all: $(ALL_LIBS) $(ALL_TOOLS) $(ALL_LDSO)
 
-install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%)
+install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%) $(ALL_LDSO:%=$(DESTDIR)/%) $(ALL_LDSO:%/ld-musl-$(ARCH).so.1=$(DESTDIR)$(libdir)/libc.so)
 
 clean:
 	rm -f crt/*.o
@@ -74,7 +75,7 @@ include/bits/alltypes.h: include/bits/alltypes.h.sh
 %.lo: %.c $(GENH)
 	$(CC) $(CFLAGS) $(INC) $(PIC) -c -o $@ $<
 
-lib/libc.so: $(LOBJS)
+lib/ld-musl-$(ARCH).so.1: $(LOBJS)
 	$(CC) $(LDFLAGS) -o $@ $(LOBJS) -lgcc
 	$(OBJCOPY) --weaken $@
 
@@ -91,15 +92,24 @@ lib/%.o: crt/%.o
 	cp $< $@
 
 tools/musl-gcc: tools/gen-musl-gcc.sh config.mak
-	sh $< "$(prefix)" > $@ || { rm -f $@ ; exit 1 ; }
+	sh $< "$(prefix)" "$(ARCH)" > $@ || { rm -f $@ ; exit 1 ; }
 	chmod +x $@
 
 $(DESTDIR)$(bindir)/%: tools/%
 	install -D $< $@
 
-$(DESTDIR)$(prefix)/%: %
+$(DESTDIR)$(libdir)/%: lib/%
 	install -D -m 644 $< $@
 
+$(DESTDIR)$(includedir)/%: include/%
+	install -D -m 644 $< $@
+
+$(DESTDIR)/lib/ld-musl-$(ARCH).so.1: lib/ld-musl-$(ARCH).so.1
+	install -D -m 755 $< $@
+
+$(DESTDIR)$(libdir)/libc.so: $(DESTDIR)/lib/ld-musl-$(ARCH).so.1
+	echo 'GROUP ( /lib/ld-musl-$(ARCH).so.1 )' > $@
+
 .PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
 
 .PHONY: all clean install