diff options
Diffstat (limited to 'os/macosx/Makefile.setup')
-rw-r--r-- | os/macosx/Makefile.setup | 86 |
1 files changed, 61 insertions, 25 deletions
diff --git a/os/macosx/Makefile.setup b/os/macosx/Makefile.setup index 159bf0aa5..252eb8b60 100644 --- a/os/macosx/Makefile.setup +++ b/os/macosx/Makefile.setup @@ -18,7 +18,7 @@ endif ifdef TRIPLE_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) +$(error no G5 optimisation is made in debug builds, so triple binaries aren't possible. Use UNIVERSAL_BINARY instead if you really want a universal debug build) endif UNIVERSAL_BINARY:=1 endif @@ -36,24 +36,16 @@ $(warning Compiling a release build, that is a debug build) endif endif -# setup flags if none are defined -ifndef CFLAGS_JAGUAR - CFLAGS_JAGUAR:= -isysroot /Developer/SDKs/MacOSX10.2.8.sdk -endif -ifndef LDFLAGS_JAGUAR - LDFLAGS_JAGUAR:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk +ifeq ($(shell uname), Darwin) + # it's a hardware mac, not crosscompiling + NATIVE_OSX:=1 endif -ifndef CFLAGS_UNIVERSAL - CFLAGS_UNIVERSAL:= -isysroot /Developer/SDKs/MacOSX10.4u.sdk +ifndef PPC_OSX_TARGET +PPC_OSX_TARGET:=10.3.9 endif -ifndef LDFLAGS_UNIVERSAL - LDFLAGS_UNIVERSAL:= -Wl,-syslibroot,/Developer/SDKs/MacOSX10.4u.sdk -endif - -ifdef JAGUAR - CFLAGS:= $(CFLAGS_JAGUAR) -arch ppc - LDFLAGS:= $(LDFLAGS_JAGUAR) +ifndef i386_OSX_TARGET +i386_OSX_TARGET:=10.4u endif ifndef G5_FLAGS @@ -61,26 +53,70 @@ G5_FLAGS := -mtune=970 -mcpu=970 -mpowerpc-gpopt endif ifdef UNIVERSAL_BINARY -TARGET_CPU_FLAGS:= -arch ppc -arch i386 -LDFLAGS := $(LDFLAGS_UNIVERSAL) -arch ppc -arch i386 -CFLAGS += $(CFLAGS_UNIVERSAL) -ifdef TRIPLE_BINARY -LDFLAGS += -arch ppc970 + OTTD_PPC:=1 + OTTD_i386:=1 + ifdef TRIPLE_BINARY + OTTD_PPC970:=1 + endif +endif + +# if any targets have been defined by now, we are crosscompiling and we will set up paths accordingly +ifdef OTTD_PPC + CFLAGS_PPC += -isysroot /Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk + LDFLAGS_PPC += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk +endif + +ifdef OTTD_i386 + CFLAGS_i386 += -isysroot /Developer/SDKs/MacOSX$(i386_OSX_TARGET).sdk + LDFLAGS_i386 += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(i386_OSX_TARGET).sdk endif + +ifdef OTTD_PPC970 + ifndef OTTD_PPC + CFLAGS_PPC += -isysroot /Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk + LDFLAGS_PPC += -Wl,-syslibroot,/Developer/SDKs/MacOSX$(PPC_OSX_TARGET).sdk + endif +endif + +ifdef JAGUAR + CFLAGS += -isysroot /Developer/SDKs/MacOSX10.2.8.sdk + LDFLAGS += -Wl,-syslibroot,/Developer/SDKs/MacOSX10.2.8.sdk + OTTD_PPC:=1 endif # setting up flags to make a binary, that fits the system it builds on -ifndef UNIVERSAL_BINARY - ifndef JAGUAR - ifeq ($(shell uname), Darwin) - # it's a hardware mac, not crosscompiling +ifdef NATIVE_OSX + ifndef UNIVERSAL_BINARY + # we are not crosscompiling for other macs + ifndef JAGUAR # the next line fails if it got whitespace in front of it $(shell $(CC) os/macosx/G5_detector.c -o os/macosx/G5_detector) IS_G5:=$(shell os/macosx/G5_detector) ifeq ($(shell uname -r), 6.8) # OSX 10.2.8 uses Darwin 6.8, so we better set JAGUAR so we avoid the stuff that was added in 10.3 or later JAGUAR:=1 + OTTD_PPC:=1 endif endif endif endif + +ifdef NATIVE_OSX + ifndef OTTD_PPC + ifndef OTTD_i386 + ifndef OTTD_PPC970 + # no flags have been set for target versions of OSX, so we will set it to compile for the current host + ifeq ($(shell uname -p), powerpc) + ifdef IS_G5 + OTTD_PPC970:=1 + else + OTTD_PPC:=1 + endif + else + # we are not using a PowerPC CPU, so we assume that it's an Intel mac + OTTD_i386:=1 + endif + endif + endif + endif +endif
\ No newline at end of file |