diff options
author | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-01-05 22:26:08 +0000 |
---|---|---|
committer | Dominik Riebeling <Dominik.Riebeling@gmail.com> | 2012-01-05 22:26:08 +0000 |
commit | c6dcec4e0d9af18a3e45d557e9e072c5640d85cd (patch) | |
tree | 651b46161f449d647df3033620dd6f48f41e5662 /rbutil/libtools.make | |
parent | 1ef25cd7e0ca653f87b3d9143248c0246a01271f (diff) | |
download | rockbox-c6dcec4e0d9af18a3e45d557e9e072c5640d85cd.tar.gz rockbox-c6dcec4e0d9af18a3e45d557e9e072c5640d85cd.zip |
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://svn.rockbox.org/rockbox/trunk@31588 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'rbutil/libtools.make')
-rw-r--r-- | rbutil/libtools.make | 27 |
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 endif endif -NATIVECC = gcc +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 $@ $^ \ -Wl,--output-def,$(TARGET_DIR)$(OUTPUT).def +# create lib file from objects $(TARGET_DIR)lib$(OUTPUT)$(RBARCH).a: $(LIBOBJS) $(addprefix $(OBJDIR),$(EXTRALIBOBJS)) @echo AR $(notdir $@) $(SILENT)mkdir -p $(dir $@) - $(SILENT)$(AR) rucs $@ $^ - -# some trickery to build ppc and i386 from a single call -ifeq ($(RBARCH),) -$(TARGET_DIR)lib$(OUTPUT)i386.a: - make RBARCH=i386 TARGET_DIR=$(TARGET_DIR) lib$(OUTPUT)i386.a - -$(TARGET_DIR)lib$(OUTPUT)ppc.a: - make RBARCH=ppc TARGET_DIR=$(TARGET_DIR) lib$(OUTPUT)ppc.a -endif - -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 $@ $^ clean: rm -f $(OBJS) $(OUTPUT) $(TARGET_DIR)lib$(OUTPUT)*.a $(OUTPUT).dmg |