From 58f430c1e0255c0b28aed1e9bf3d892c18c06631 Mon Sep 17 00:00:00 2001 From: Rich Felker Date: Sun, 22 Apr 2012 14:32:49 -0400 Subject: 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. --- Makefile | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'Makefile') 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/% -- cgit v1.2.1