From 1a26524d016c4184a46c118b965889312c1f93c5 Mon Sep 17 00:00:00 2001 From: Dominik Riebeling Date: Thu, 5 Jan 2012 21:23:35 +0000 Subject: Fix building mkamsboot on OS X. mkamsboot requires libucl to be linked. Since the introduction of libtools.make the OS X specific universal library isn't triggered anymore so the libucl built uses the wrong architecture. Rockbox Utility builds libucl by itself and still triggers the universal library rule. Since ar can create fat archives but not operate on them adjust the ar call to not try to update the archive -- the archive is created anyway, so asking for an update is not really necessary. Remove any old archive first to make sure we're not trying to update one, since that would now fail. As a result the OS X specific hackery to build both ppc and i386 in a single call isn't necessary anymore. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31585 a1c6a512-1295-4272-9138-f99709370657 --- tools/ucl/src/Makefile | 31 ++++++++++++++++--------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/tools/ucl/src/Makefile b/tools/ucl/src/Makefile index c010cdf23c..8875522388 100644 --- a/tools/ucl/src/Makefile +++ b/tools/ucl/src/Makefile @@ -16,6 +16,20 @@ ifdef RBARCH CFLAGS += -arch $(RBARCH) endif +# OS X specifics. Needs to consider cross compiling for Windows. +ifeq ($(findstring Darwin,$(shell uname)),Darwin) +ifneq ($(findstring mingw,$(CROSS)$(CC)),mingw) +# when building libs for OS X build for both i386 and ppc at the same time. +# This creates fat objects, and ar can only create the archive but not operate +# on it. As a result the ar call must NOT use the u (update) flag. +CFLAGS += -arch ppc -arch i386 +# building against SDK 10.4 is not compatible with gcc-4.2 (default on newer Xcode) +# might need adjustment for older Xcode. +CC ?= gcc-4.0 +CFLAGS += -isysroot /Developer/SDKs/MacOSX10.4u.sdk -mmacosx-version-min=10.4 +NATIVECC ?= gcc-4.0 +endif +endif TARGET_DIR ?= $(shell pwd) OBJDIR = $(TARGET_DIR)build$(RBARCH) @@ -40,27 +54,14 @@ $(TARGET_DIR)ucl.dll: $(OBJS) $(TARGET_DIR)libucl$(RBARCH).a: $(OBJS) @echo AR $(notdir $@) - $(SILENT)$(CROSS)$(AR) rucs $@ $(OBJS) >/dev/null 2>&1 + $(SILENT)rm -f $@ + $(SILENT)$(CROSS)$(AR) rcs $@ $(OBJS) >/dev/null 2>&1 $(OBJDIR)/%.o: %.c @echo CC $< $(SILENT)mkdir -p $(dir $@) $(SILENT)$(CROSS)$(CC) $(CFLAGS) -c $< -o $@ -# some trickery to build ppc and i386 from a single call -ifeq ($(RBARCH),) -$(TARGET_DIR)libucli386.a: - make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libucli386.a - -$(TARGET_DIR)libuclppc.a: - make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libuclppc.a -endif - -libucl-universal: $(TARGET_DIR)libucli386.a $(TARGET_DIR)libuclppc.a - @echo lipo $(TARGET_DIR)libucl.a - $(SILENT) rm -f $(TARGET_DIR)libucl.a - $(SILENT)lipo -create $(TARGET_DIR)libuclppc.a $(TARGET_DIR)libucli386.a -output $(TARGET_DIR)libucl.a - clean: rm -f $(TARGET_DIR)libucl*.a rm -rf build* -- cgit v1.2.3