summaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2012-04-22 14:32:49 -0400
committerRich Felker <dalias@aerifal.cx>2012-04-22 14:32:49 -0400
commit58f430c1e0255c0b28aed1e9bf3d892c18c06631 (patch)
treee36e0e24a68603c42903e142260b37765491bf76 /Makefile
parent02eb568dedadb3d66c2751aba6bea559370ff32c (diff)
downloadmusl-58f430c1e0255c0b28aed1e9bf3d892c18c06631.tar.gz
new gcc wrapper, entirely specfile based
the _concept_ of this wrapper has been tested extensively, but the integration with the build/install system, and using a persistent specfile rather than one generated at build-time, have not been heavily tested and may need minor tweaks. this approach should be a lot more robust (and easier to improve) than writing a shell script that's responsible for trying to mimic gcc's logic about whether it's compiling or linking, building shared libs or executable files, etc. it's also lighter weight and should result in mildly faster builds when using the wrapper.
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile10
1 files changed, 7 insertions, 3 deletions
diff --git a/Makefile b/Makefile
index 7906c52f..72b640a4 100644
--- a/Makefile
+++ b/Makefile
@@ -36,7 +36,8 @@ EMPTY_LIBS = $(EMPTY_LIB_NAMES:%=lib/lib%.a)
CRT_LIBS = lib/crt1.o lib/crti.o lib/crtn.o
STATIC_LIBS = lib/libc.a $(EMPTY_LIBS)
SHARED_LIBS = lib/libc.so
-ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS)
+TOOL_LIBS = lib/musl-gcc.specs
+ALL_LIBS = $(CRT_LIBS) $(STATIC_LIBS) $(SHARED_LIBS) $(TOOL_LIBS)
ALL_TOOLS = tools/musl-gcc
LDSO_PATHNAME = $(syslibdir)/ld-musl-$(ARCH).so.1
@@ -93,8 +94,11 @@ $(EMPTY_LIBS):
lib/%.o: crt/%.o
cp $< $@
-tools/musl-gcc: tools/gen-musl-gcc.sh config.mak
- sh $< "$(prefix)" "$(LDSO_PATHNAME)" > $@ || { rm -f $@ ; exit 1 ; }
+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)" > $@
chmod +x $@
$(DESTDIR)$(bindir)/%: tools/%