path: root/rbutil/libtools.make
diff options
authorDominik Riebeling <>2012-01-05 22:26:08 +0000
committerDominik Riebeling <>2012-01-05 22:26:08 +0000
commitc6dcec4e0d9af18a3e45d557e9e072c5640d85cd (patch)
tree651b46161f449d647df3033620dd6f48f41e5662 /rbutil/libtools.make
parent1ef25cd7e0ca653f87b3d9143248c0246a01271f (diff)
Update OS X library building.
- As done with libucl and librbspeex, create universal libraries using ar instead of building twice and using lipo. This notably simplifies things. - Allow overwriting the compiler via command line. This is required for building on OS X. - Update Rockbox Utility to the changed library rules. Fixes building which was broken by the previous Makefile changes. git-svn-id: svn:// a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/libtools.make')
1 files changed, 8 insertions, 19 deletions
diff --git a/rbutil/libtools.make b/rbutil/libtools.make
index 4e66161011..0d028e09be 100644
--- a/rbutil/libtools.make
+++ b/rbutil/libtools.make
@@ -42,10 +42,15 @@ endif
+NATIVECC ?= gcc
CC ?= gcc
+# 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
@@ -105,27 +110,11 @@ $(TARGET_DIR)$(OUTPUT).dll: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS))
$(SILENT)$(CROSS)$(CC) $(CFLAGS) -shared -o $@ $^ \
+# create lib file from objects
@echo AR $(notdir $@)
$(SILENT)mkdir -p $(dir $@)
- $(SILENT)$(AR) rucs $@ $^
-# some trickery to build ppc and i386 from a single call
-ifeq ($(RBARCH),)
- make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) lib$(OUTPUT)i386.a
- make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) lib$(OUTPUT)ppc.a
-lib$(OUTPUT)-universal: $(TARGET_DIR)lib$(OUTPUT)i386.a \
- $(TARGET_DIR)lib$(OUTPUT)ppc.a
- @echo LIPO $(notdir $(TARGET_DIR)lib$(OUTPUT).a)
- $(SILENT) rm -f $(TARGET_DIR)lib$(OUTPUT).a
- $(SILENT)lipo -create $(TARGET_DIR)lib$(OUTPUT)i386.a \
- $(TARGET_DIR)lib$(OUTPUT)ppc.a \
- -output $(TARGET_DIR)lib$(OUTPUT).a
+ $(SILENT)$(AR) rcs $@ $^
rm -f $(OBJS) $(OUTPUT) $(TARGET_DIR)lib$(OUTPUT)*.a $(OUTPUT).dmg