1
0
Fork 0

(svn r3674) -Feature: [OSX] Added support for tripple binaries (binaries optimised for G3, G5 and i686)

G4 have no problems using G3 code while G5 can, but really benefit from getting their own optimised code (Apple: G5 is not just a fast G4)
	Also changed FAT_BINARY to UNIVERSAL_BINARY since Apple removed most (all?) references to fat binaries on their homepage two days after I added FAT_BINARY
release/0.5
bjarni 2006-02-25 21:25:23 +00:00
parent 4ff6b2a514
commit d09e66eef6
3 changed files with 45 additions and 25 deletions

View File

@ -106,7 +106,8 @@
# #
# Special for crosscompiling there are some commands available: # Special for crosscompiling there are some commands available:
# #
# FAT_BINARY: builds a universal binary for OSX. Make sure you got both PPC and x86 libs. Only works with GCC 4 or newer # UNIVERSAL_BINARY: builds a universal binary for OSX. Make sure you got both PPC and x86 libs. Only works with GCC 4 or newer
# TRIPPLE_BINARY: builds a universal binary with the addition of code optimised for G5 (which means a total of 3 binaries in one file)
# #
# JAGUAR: Crosscompiling for OSX 1.2.8 (codenamed Jaguar). Only works if OSX is defined too. Only works with GCC 4 or newer # JAGUAR: Crosscompiling for OSX 1.2.8 (codenamed Jaguar). Only works if OSX is defined too. Only works with GCC 4 or newer
# This can be changed to any PPC version of OSX by changing the ppc flags in Makefile.config # This can be changed to any PPC version of OSX by changing the ppc flags in Makefile.config

View File

@ -2,11 +2,14 @@
# This makefile is not a standalone makefile, but is called from the general one # This makefile is not a standalone makefile, but is called from the general one
# it contains targets specific to MacOS X # it contains targets specific to MacOS X
ifdef FAT_BINARY ifdef UNIVERSAL_BINARY
FAT_BINARY:=build_universal_binary ifdef TRIPPLE_BINARY
TRIPPLE_BINARY:=tripple_binary
endif
UNIVERSAL_BINARY:=build_universal_binary
endif endif
ifdef UNIVERSAL_x86_PART ifdef UNIVERSAL_PPC_PART
# the bundle is build by the PPC compile when making universal binaries # the bundle is build by the PPC compile when making universal binaries
BUILD_OSX_BUNDLE:= BUILD_OSX_BUNDLE:=
else else
@ -18,20 +21,30 @@ endif
# we make clean and compile the other one. In the end we use lipo to join them together # we make clean and compile the other one. In the end we use lipo to join them together
# when this is done, we can continue with the targets from the first run, which is build_OSX_bundle # when this is done, we can continue with the targets from the first run, which is build_OSX_bundle
$(FAT_BINARY): $(TTD) $(UNIVERSAL_BINARY): $(TTD)
$(Q)mkdir -p temp_binary_dir $(Q)mkdir -p temp_binary_dir
$(Q)cp $(TTD) temp_binary_dir/$(TTD)_a $(Q)cp $(TTD) temp_binary_dir/$(TTD)_a
$(Q)rm -rf $(TTD) $(OBJS) # delete all .o files so we can compile for a new endian $(Q)rm -rf $(TTD) $(OBJS) # delete all .o files so we can compile for a new CPU
$(Q)make UNIVERSAL_x86_PART:=1 $(Q)make UNIVERSAL_PPC_PART:=1
$(Q)cp $(TTD) temp_binary_dir/$(TTD)_b $(Q)cp $(TTD) temp_binary_dir/$(TTD)_b
@echo '===> Joining the PPC and x86 binaries into one universal one' @echo '===> Joining the PPC and x86 binaries into one universal one'
$(Q)lipo temp_binary_dir/$(TTD)_a temp_binary_dir/$(TTD)_b -create -output $(TTD) $(Q)lipo temp_binary_dir/$(TTD)_a temp_binary_dir/$(TTD)_b -create -output $(TTD)
$(Q)rm -rf temp_binary_dir $(Q)rm -rf temp_binary_dir
$(TRIPPLE_BINARY): $(UNIVERSAL_BINARY)
$(Q)mkdir -p temp_binary_dir
$(Q)cp $(TTD) temp_binary_dir/$(TTD)_a
$(Q)rm -rf $(TTD) $(OBJS) # delete all .o files so we can compile for a new CPU
$(Q)make UNIVERSAL_PPC_PART:=1 IS_G5:=1
$(Q)cp $(TTD) temp_binary_dir/$(TTD)_b
@echo '===> Joining the Universal and G5 binaries into a tripple binary'
$(Q)lipo temp_binary_dir/$(TTD)_a temp_binary_dir/$(TTD)_b -create -output $(TTD)
$(Q)rm -rf temp_binary_dir
# build the bundle. OSX wants to keep apps in bundles, so we will give it one # build the bundle. OSX wants to keep apps in bundles, so we will give it one
# the good thing about bundles is that you can keep extra files in them, so we keep lng files and a data dir in it # the good thing about bundles is that you can keep extra files in them, so we keep lng files and a data dir in it
$(BUILD_OSX_BUNDLE): $(TTD) $(FAT_BINARY) $(BUILD_OSX_BUNDLE): $(TTD) $(UNIVERSAL_BINARY) $(TRIPPLE_BINARY)
@echo '===> Building application bundle' @echo '===> Building application bundle'
$(Q)rm -fr "$(OSXAPP)" $(Q)rm -fr "$(OSXAPP)"
$(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS $(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS
@ -67,4 +80,4 @@ release: all
$(OSX): $(TTD) $(BUILD_OSX_BUNDLE) $(OSX): $(TTD) $(BUILD_OSX_BUNDLE)
.PHONY: release $(BUILD_OSX_BUNDLE) $(FAT_BINARY) .PHONY: release $(BUILD_OSX_BUNDLE) $(UNIVERSAL_BINARY)

View File

@ -11,22 +11,29 @@ endif
endif endif
ifdef RELEASE ifdef RELEASE
ifndef FAT_BINARY ifndef UNIVERSAL_BINARY
$(warning Compiling a release build, that is not a universal binary) $(warning Compiling a release build, that is not a universal binary)
endif endif
endif endif
ifndef FAT_BINARY ifdef TRIPPLE_BINARY
ifdef DEBUG
$(error no G5 optimisation is made in debug builds, so tripple binaries aren't possible. Use UNIVERSAL_BINARY instead if you really want a universal debug build)
endif
UNIVERSAL_BINARY:=1
endif
ifndef UNIVERSAL_BINARY
ifndef JAGUAR ifndef JAGUAR
ifeq ($(shell uname), Darwin) ifeq ($(shell uname), Darwin)
# it's a hardware mac, not crosscompiling # it's a hardware mac, not crosscompiling
$(Q)$(CC_HOST) os/macosx/G5_detector.c -o os/macosx/G5_detector $(shell $(CC_HOST) os/macosx/G5_detector.c -o os/macosx/G5_detector)
IS_G5:=$(shell os/macosx/G5_detector) IS_G5:=$(shell os/macosx/G5_detector)
endif endif
endif endif
endif endif
ifdef FAT_BINARY ifdef UNIVERSAL_BINARY
ifndef STATIC ifndef STATIC
$(warning Compiling a universal binary, that is not static. Adding static flag) $(warning Compiling a universal binary, that is not static. Adding static flag)
STATIC:=1 STATIC:=1
@ -86,7 +93,7 @@ ifdef JAGUAR
LDFLAGS:= $(LDFLAGS_PPC) LDFLAGS:= $(LDFLAGS_PPC)
endif endif
ifdef FAT_BINARY ifdef UNIVERSAL_BINARY
# set up config files # set up config files
ifndef SKIP_LIB_TEST ifndef SKIP_LIB_TEST
ifdef WITH_PNG ifdef WITH_PNG
@ -100,21 +107,20 @@ $(error no x86 libpng found)
endif endif
endif endif
endif endif
LIBS:=
ifdef UNIVERSAL_x86_PART OBJS:=
LIBPNG-CONFIG:=$(LIBPNG_x86_CONFIG) ifdef UNIVERSAL_PPC_PART
SDL-CONFIG:=$(SDL_x86_CONFIG)
CC_TARGET:=$(x86_CC)
# clear the cached list of PPC libs
LIBS:=
OBJS:=
CFLAGS:= $(CFLAGS_x86) -arch i386
LDFLAGS:= $(LDFLAGS_x86)
else
LIBPNG-CONFIG:=$(LIBPNG_PPC_CONFIG) LIBPNG-CONFIG:=$(LIBPNG_PPC_CONFIG)
SDL-CONFIG:=$(SDL_PPC_CONFIG) SDL-CONFIG:=$(SDL_PPC_CONFIG)
CC_TARGET:=$(PPC_CC) CC_TARGET:=$(PPC_CC)
CFLAGS:= $(CFLAGS_PPC) -arch ppc CFLAGS:= $(CFLAGS_PPC) -arch ppc
LDFLAGS:= $(LDFLAGS_PPC) LDFLAGS:= $(LDFLAGS_PPC)
else
LIBPNG-CONFIG:=$(LIBPNG_x86_CONFIG)
SDL-CONFIG:=$(SDL_x86_CONFIG)
CC_TARGET:=$(x86_CC)
# clear the cached list of PPC libs
CFLAGS:= $(CFLAGS_x86) -arch i386
LDFLAGS:= $(LDFLAGS_x86)
endif endif
endif endif