remove soname from libc.so/ld-musl
[musl] / Makefile
index 0c13417..997c5bb 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -16,13 +16,14 @@ includedir = $(prefix)/include
 libdir = $(prefix)/lib
 syslibdir = /lib
 
-SRCS = $(sort $(wildcard src/*/*.c))
+SRCS = $(sort $(wildcard src/*/*.c arch/$(ARCH)/src/*.c))
 OBJS = $(SRCS:.c=.o)
 LOBJS = $(OBJS:.o=.lo)
 GENH = include/bits/alltypes.h
 IMPH = src/internal/stdio_impl.h src/internal/pthread_impl.h src/internal/libc.h
 
 LDFLAGS = 
+LIBCC = -lgcc
 CPPFLAGS =
 CFLAGS = -Os -pipe
 CFLAGS_C99FSE = -std=c99 -ffreestanding -nostdinc 
@@ -31,7 +32,7 @@ CFLAGS_ALL = $(CFLAGS_C99FSE)
 CFLAGS_ALL += -D_XOPEN_SOURCE=700 -I./arch/$(ARCH) -I./src/internal -I./include
 CFLAGS_ALL += $(CPPFLAGS) $(CFLAGS)
 CFLAGS_ALL_STATIC = $(CFLAGS_ALL)
-CFLAGS_ALL_SHARED = $(CFLAGS_ALL) -fPIC -DSHARED -O3
+CFLAGS_ALL_SHARED = $(CFLAGS_ALL) -fPIC -DSHARED
 
 AR      = $(CROSS_COMPILE)ar
 RANLIB  = $(CROSS_COMPILE)ranlib
@@ -53,7 +54,7 @@ LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH).so.1
 
 all: $(ALL_LIBS) $(ALL_TOOLS)
 
-install: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%) $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+install: install-libs install-headers install-tools
 
 clean:
        rm -f crt/*.o
@@ -76,6 +77,8 @@ include/bits/alltypes.h.sh: include/bits
 include/bits/alltypes.h: include/bits/alltypes.h.sh
        sh $< > $@
 
+src/ldso/dynlink.lo: arch/$(ARCH)/reloc.h
+
 %.o: $(ARCH)/%.s
        $(CC) $(CFLAGS_ALL_STATIC) -c -o $@ $<
 
@@ -91,7 +94,7 @@ include/bits/alltypes.h: include/bits/alltypes.h.sh
 lib/libc.so: $(LOBJS)
        $(CC) $(CFLAGS_ALL_SHARED) $(LDFLAGS) -nostdlib -shared \
        -Wl,-e,_start -Wl,-Bsymbolic-functions \
-       -Wl,-soname=libc.so -o $@ $(LOBJS) -lgcc
+       -o $@ $(LOBJS) $(LIBCC)
 
 lib/libc.a: $(OBJS)
        rm -f $@
@@ -109,7 +112,7 @@ lib/musl-gcc.specs: tools/musl-gcc.specs.sh config.mak
        sh $< "$(includedir)" "$(libdir)" "$(LDSO_PATHNAME)" > $@
 
 tools/musl-gcc: config.mak
-       printf '#!/bin/sh\nexec gcc "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
+       printf '#!/bin/sh\nexec "$${REALGCC:-gcc}" "$$@" -specs "%s/musl-gcc.specs"\n' "$(libdir)" > $@
        chmod +x $@
 
 $(DESTDIR)$(bindir)/%: tools/%
@@ -130,6 +133,14 @@ $(DESTDIR)$(LDSO_PATHNAME): $(DESTDIR)$(syslibdir)
 $(DESTDIR)$(syslibdir):
        install -d -m 755 $(DESTDIR)$(syslibdir)
 
+install-libs: $(ALL_LIBS:lib/%=$(DESTDIR)$(libdir)/%) $(if $(SHARED_LIBS),$(DESTDIR)$(LDSO_PATHNAME),)
+
+install-headers: $(ALL_INCLUDES:include/%=$(DESTDIR)$(includedir)/%)
+
+install-tools: $(ALL_TOOLS:tools/%=$(DESTDIR)$(bindir)/%)
+
+
+
 .PRECIOUS: $(CRT_LIBS:lib/%=crt/%)
 
-.PHONY: all clean install
+.PHONY: all clean install install-libs install-headers install-tools