path: root/tools/ucl/src
diff options
authorDominik Riebeling <>2012-01-05 21:23:35 +0000
committerDominik Riebeling <>2012-01-05 21:23:35 +0000
commit1a26524d016c4184a46c118b965889312c1f93c5 (patch)
tree9bd8d1fe95dcaeeb6e35f25f62bf53632f4c26ac /tools/ucl/src
parent139171046677818bf25c384726778f987ff91935 (diff)
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:// a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'tools/ucl/src')
1 files 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)
+# 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
TARGET_DIR ?= $(shell pwd)
@@ -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),)
- make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) libucli386.a
- make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) libuclppc.a
-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
rm -f $(TARGET_DIR)libucl*.a
rm -rf build*