summaryrefslogtreecommitdiff
path: root/os/macosx
diff options
context:
space:
mode:
Diffstat (limited to 'os/macosx')
-rw-r--r--os/macosx/Makefile30
-rw-r--r--os/macosx/Makefile.setup102
2 files changed, 108 insertions, 24 deletions
diff --git a/os/macosx/Makefile b/os/macosx/Makefile
index 07f8722db..54e55db44 100644
--- a/os/macosx/Makefile
+++ b/os/macosx/Makefile
@@ -7,26 +7,8 @@ BUILD_UNIVERSAL_BINARY:=build_universal_binary
COPY_x86_SDL_LIB:=$(Q)cp $(x86_SDL_LIB) $(OSXAPP)/Contents/lib/libSDL-x86.dylib
endif
-# setting the default vars for making universal binaries
-# this can be overwritten in Makefile.config
-# default values are for PPC host and commends are for x86 hosts (so you know what to put in)
-# the absolute path is the one Apple uses in Xcode 2.1
-ifndef CC_UNI
- # powerpc-apple-darwin8-gcc-4.0.0
- CC_UNI:=i686-apple-darwin8-gcc-4.0.0
-endif
-
-ifndef CFLAGS_UNI
- # -arch ppc
- CFLAGS_UNI:= -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386
-endif
-
-ifndef LDFLAGS_UNI
- LDFLAGS_UNI:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
-endif
-
-ifdef UNIVERSAL_OTHER_HALF
-# if UNIVERSAL_OTHER_HALF is defined, we know that the original makefile call will build the bundle
+ifdef UNIVERSAL_x86_PART
+# the bundle is build by the PPC compile when making universal binaries
BUILD_OSX_BUNDLE:=
else
BUILD_OSX_BUNDLE:=build_OSX_bundle
@@ -40,12 +22,11 @@ endif
$(BUILD_UNIVERSAL_BINARY): $(TTD)
$(Q)mkdir -p temp_binary_dir
$(Q)cp $(TTD) temp_binary_dir/$(TTD)_a
- @echo '===> Cleaning up to build for the other architecture'
- $(Q)make clean
- $(Q)make UNIVERSAL_OTHER_HALF:=1
+ $(Q)rm -rf $(TTD) $(OBJS) # delete all .o files so we can compile for a new endian
+ $(Q)make UNIVERSAL_x86_PART:=1
$(Q)install_name_tool -change $(x86_SDL_LIB) @executable_path/../lib/libSDL-x86.dylib $(TTD)
$(Q)cp $(TTD) temp_binary_dir/$(TTD)_b
- @echo '===> Joining 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)rm -rf temp_binary_dir
@@ -53,6 +34,7 @@ $(BUILD_UNIVERSAL_BINARY): $(TTD)
# 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) $(BUILD_UNIVERSAL_BINARY)
+ @echo '===> Building application bundle'
$(Q)rm -fr "$(OSXAPP)"
$(Q)mkdir -p "$(OSXAPP)"/Contents/MacOS
$(Q)mkdir -p "$(OSXAPP)"/Contents/Resources
diff --git a/os/macosx/Makefile.setup b/os/macosx/Makefile.setup
new file mode 100644
index 000000000..f41e63307
--- /dev/null
+++ b/os/macosx/Makefile.setup
@@ -0,0 +1,102 @@
+# $Id: Makefile 3214 2005-11-17 19:43:37Z bjarni $
+# This makefile is not a standalone makefile, but is called from the general one
+# it contains code specific to MacOS X
+
+ifdef RELEASE
+ifndef STATIC
+# all OSX releases needs to be static
+# end users don't tend to have the dynamic libs installed
+$(warning Compiling a dynamic release. It should be static unless you really know what you are doing!!!)
+endif
+endif
+
+ifdef RELEASE
+ifndef BUILD_UNIVERSAL_BINARY
+$(warning Compiling a release build, that is not a universal binary)
+endif
+endif
+
+ifdef RELEASE
+ifdef DEBUG
+$(warning Compiling a release build, that is a debug build)
+endif
+endif
+
+# setup flags if none are defined
+ifndef UNIVERSAL_CFLAGS
+ UNIVERSAL_CFLAGS:= -isysroot /Developer/SDKs/MacOSX10.4u.sdk
+endif
+ifndef UNIVERSAL_LDFLAGS
+ UNIVERSAL_LDFLAGS:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk
+endif
+ifndef PPC_CC
+ PPC_CC:=powerpc-apple-darwin8-gcc-4.0.0
+endif
+ifndef x86_CC
+ x86_CC:=i686-apple-darwin8-gcc-4.0.0
+endif
+ifdef WITH_PNG
+ ifndef LIBPNG_PPC_CONFIG
+ LIBPNG_PPC_CONFIG:=$(LIBPNG-CONFIG)
+ endif
+ ifndef LIBPNG_x86_CONFIG
+ LIBPNG_x86_CONFIG:=$(LIBPNG-CONFIG)
+ endif
+endif
+ifdef WITH_SDL
+ ifndef SDL_PPC_CONFIG
+ SDL_PPC_CONFIG:=$(SDL-CONFIG)
+ endif
+ ifndef SDL_x86_CONFIG
+ SDL_x86_CONFIG:=$(SDL-CONFIG)
+ endif
+endif
+
+ifdef BUILD_UNIVERSAL_BINARY
+ CFLAGS:= $(UNIVERSAL_CFLAGS)
+ LDFLAGS:= $(UNIVERSAL_LDFLAGS)
+
+ # set up config files
+ ifndef SKIP_LIB_TEST
+ ifdef WITH_PNG
+ TEST:=$(shell lipo -info `$(LIBPNG_PPC_CONFIG) --prefix`/lib/libpng.a | xargs -n 1 | grep "ppc"))
+ ifndef TEST
+$(error no PPC libpng found)
+ endif
+ TEST:=$(shell lipo -info `$(LIBPNG_x86_CONFIG) --prefix`/lib/libpng.a | xargs -n 1 | grep "i386"))
+ ifndef TEST
+$(error no x86 libpng found)
+ endif
+ endif
+
+ ifdef WITH_SDL
+ ifdef STATIC
+ ifndef x86_SDL_LIB
+$(error static universal build without a defined x86 SDL lib)
+ endif
+ endif
+ TEST:=$(shell lipo -info `$(SDL_PPC_CONFIG) --prefix`/lib/libSDL.a | xargs -n 1 | grep "ppc"))
+ ifndef TEST
+$(error no PPC SDL lib found)
+ endif
+ TEST:=$(shell lipo -info `$(SDL_x86_CONFIG) --prefix`/lib/libSDL.a | xargs -n 1 | grep "i386"))
+ ifndef TEST
+$(error no x86 SDL lib found)
+ endif
+ endif
+ endif
+
+ ifdef UNIVERSAL_x86_PART
+ CFLAGS += -arch i386
+ LIBPNG-CONFIG:=$(LIBPNG_x86_CONFIG)
+ SDL-CONFIG:=$(SDL_x86_CONFIG)
+ CC_TARGET:=$(x86_CC)
+ # clear the cached list of PPC libs
+ LIBS:=
+ else
+ CFLAGS += -arch ppc
+ LIBPNG-CONFIG:=$(LIBPNG_PPC_CONFIG)
+ SDL-CONFIG:=$(SDL_PPC_CONFIG)
+ CC_TARGET:=$(PPC_CC)
+ endif
+endif