--- a/Makefile Tue Dec 06 17:12:19 2005 +0000
+++ b/Makefile Tue Dec 06 22:09:28 2005 +0000
@@ -170,19 +170,6 @@
CONFIG_INCLUDED:=
endif
-ifdef UNIVERSAL_OTHER_HALF
- ifndef CC_HOST
- # we are crosscompiling, so we should remember what compiler we should use for strgen
- CC_HOST = $(CC)
- endif
- CC_TARGET = $(CC_UNI)
- CFLAGS = $(CFLAGS_UNI)
- LDFLAGS = $(LDFLAGS_UNI)
- SDL-CONFIG = $(SDL-CONFIG_UNI)
- LIBPNG-CONFIG = $(LIBPNG-CONFIG_UNI)
- LIBS:=
-endif
-
# this is used if there aren't any Makefile.config
ifndef CONFIG_INCLUDED
# sets network on by default if there aren't any config file
@@ -203,6 +190,10 @@
LANG_ERRORS = >/dev/null 2>&1
endif
+ifdef OSX
+-include os/MacOSX/Makefile.setup
+endif
+
ifdef STATIC
ifndef WIN32
ifndef OSX
@@ -215,14 +206,6 @@
endif
endif
-ifdef OSX
-ifdef RELEASE
-# 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
-
# Force SDL on UNIX platforms
ifndef WITH_SDL
ifdef UNIX
--- a/makefiledir/Makefile.config_writer Tue Dec 06 17:12:19 2005 +0000
+++ b/makefiledir/Makefile.config_writer Tue Dec 06 22:09:28 2005 +0000
@@ -94,12 +94,18 @@
$(call CONFIG_LINE,)
$(call CONFIG_LINE,\# Universal binary setup)
- $(call CONFIG_LINE,\# use these settings for the CPU type, that is not covered by the other settings)
- $(call CONFIG_LINE,CC_UNI:=$(CC_UNI))
- $(call CONFIG_LINE,CFLAGS_UNI:=$(CFLAGS_UNI))
- $(call CONFIG_LINE,LDFLAGS_UNI:=$(LDFLAGS_UNI))
- $(call CONFIG_LINE,SDL-CONFIG_UNI:=$(SDL-CONFIG_UNI))
- $(call CONFIG_LINE,LIBPNG-CONFIG_UNI:=$(LIBPNG-CONFIG_UNI))
+ $(call CONFIG_LINE,\# use these settings for building universal binaries. Most settings should work with the default settings)
+ $(call CONFIG_LINE,UNIVERSAL_CFLAGS:=$(UNIVERSAL_CFLAGS))
+ $(call CONFIG_LINE,UNIVERSAL_LDFLAGS:=$(UNIVERSAL_LDFLAGS))
+ $(call CONFIG_LINE,SKIP_LIB_TEST:=$(SKIP_LIB_TEST))
+ $(call CONFIG_LINE,PPC_CC:=$(PPC_CC))
+ $(call CONFIG_LINE,SDL_PPC_CONFIG:=$(SDL_PPC_CONFIG))
+ $(call CONFIG_LINE,LIBPNG_PPC_CONFIG:=$(LIBPNG_PPC_CONFIG))
+ $(call CONFIG_LINE,x86_CC:=$(x86_CC))
+ $(call CONFIG_LINE,SDL_x86_CONFIG:=$(SDL_x86_CONFIG))
+ $(call CONFIG_LINE,LIBPNG_x86_CONFIG:=$(LIBPNG_x86_CONFIG))
+ $(call CONFIG_LINE,x86_SDL_LIB:=$(x86_SDL_LIB))
+ $(call CONFIG_LINE,)
$(call CONFIG_LINE,\# For cross-compiling)
$(call CONFIG_LINE,CC_TARGET:=$(CC_TARGET))
--- a/os/macosx/Makefile Tue Dec 06 17:12:19 2005 +0000
+++ b/os/macosx/Makefile Tue Dec 06 22:09:28 2005 +0000
@@ -7,26 +7,8 @@
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 @@
$(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 @@
# 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
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/os/macosx/Makefile.setup Tue Dec 06 22:09:28 2005 +0000
@@ -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