Created
January 20, 2013 20:30
-
-
Save npepinpe/4581490 to your computer and use it in GitHub Desktop.
Fixes compilation under OSX for all core UNIX Projects Makefiles for mupen64plus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/source/mupen64plus-audio-sdl/projects/unix/Makefile b/source/mupen64plus-audio-sdl/projects/unix/Makefile | |
index 45db3d1..133ee44 100644 | |
--- a/source/mupen64plus-audio-sdl/projects/unix/Makefile | |
+++ b/source/mupen64plus-audio-sdl/projects/unix/Makefile | |
@@ -134,19 +134,32 @@ ifeq ($(OS), LINUX) | |
LDLIBS += -ldl | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
LDLIBS += -ldl | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
- LDLIBS += -ldl | |
+ LDLIBS += -ldl -read_only_relocs suppress | |
endif | |
endif | |
endif | |
+ | |
# test for presence of SDL | |
ifeq ($(shell which sdl-config 2>/dev/null),) | |
$(error No SDL development libraries found!) | |
diff --git a/source/mupen64plus-core/projects/unix/Makefile b/source/mupen64plus-core/projects/unix/Makefile | |
index e2df2c6..d57d8a8 100644 | |
--- a/source/mupen64plus-core/projects/unix/Makefile | |
+++ b/source/mupen64plus-core/projects/unix/Makefile | |
@@ -138,12 +138,24 @@ ifeq ($(OS), OSX) | |
TARGET = libmupen64plus.dylib | |
LDFLAGS += -bundle -read_only_relocs suppress | |
LDLIBS += -ldl -framework OpenGL | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
else | |
- CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
ifneq ($(PROFILE), 1) | |
CFLAGS += -fomit-frame-pointer | |
@@ -171,8 +183,14 @@ endif | |
ifeq ($(shell pkg-config --modversion libpng 2>/dev/null),) | |
$(error No libpng development libraries found!) | |
endif | |
-ifeq ($(shell pkg-config --modversion zlib 2>/dev/null),) | |
- $(error No zlib development libraries found!) | |
+ifeq ($(OS), OSX) # use system zlib on OSX | |
+ LDLIBS += -lz | |
+else | |
+ ifeq ($(shell pkg-config --modversion zlib 2>/dev/null),) | |
+ $(error No zlib development libraries found!) | |
+ endif | |
+ CFLAGS += $(shell pkg-config --cflags zlib) | |
+ LDLIBS += $(shell pkg-config --libs zlib) | |
endif | |
ifeq ($(shell pkg-config --modversion freetype2 2>/dev/null),) | |
$(error No FreeType 2 development libraries found!) | |
@@ -183,8 +201,8 @@ endif | |
ifeq ($(shell pkg-config --modversion glu 2>/dev/null),) | |
$(error No OpenGL utility development libraries found!) | |
endif | |
-CFLAGS += $(shell pkg-config --cflags libpng zlib freetype2 gl glu) | |
-LDLIBS += $(shell pkg-config --libs libpng zlib freetype2 gl glu) | |
+CFLAGS += $(shell pkg-config --cflags libpng freetype2 gl glu) | |
+LDLIBS += $(shell pkg-config --libs libpng freetype2 gl glu) | |
# test for presence of SDL | |
ifeq ($(shell which sdl-config 2>/dev/null),) | |
diff --git a/source/mupen64plus-input-sdl/projects/unix/Makefile b/source/mupen64plus-input-sdl/projects/unix/Makefile | |
index 590d186..ab91a4c 100644 | |
--- a/source/mupen64plus-input-sdl/projects/unix/Makefile | |
+++ b/source/mupen64plus-input-sdl/projects/unix/Makefile | |
@@ -135,14 +135,26 @@ ifeq ($(OS), LINUX) | |
LDLIBS += -ldl | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDLIBS += -ldl | |
else | |
- CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
- LDLIBS += -ldl | |
+ LDLIBS += -ldl -read_only_relocs suppress | |
endif | |
endif | |
endif | |
diff --git a/source/mupen64plus-rsp-hle/projects/unix/Makefile b/source/mupen64plus-rsp-hle/projects/unix/Makefile | |
index b50545b..cd5400c 100644 | |
--- a/source/mupen64plus-rsp-hle/projects/unix/Makefile | |
+++ b/source/mupen64plus-rsp-hle/projects/unix/Makefile | |
@@ -136,13 +136,25 @@ ifeq ($(OS), LINUX) | |
LDFLAGS += -Wl,-version-script,$(SRCDIR)/rsp_api_export.ver | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
- LDFLAGS += -arch i686 | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
+ LDFLAGS += -arch i686 -read_only_relocs suppress | |
endif | |
endif | |
endif | |
diff --git a/source/mupen64plus-ui-console/projects/unix/Makefile b/source/mupen64plus-ui-console/projects/unix/Makefile | |
index c747910..1a824d4 100644 | |
--- a/source/mupen64plus-ui-console/projects/unix/Makefile | |
+++ b/source/mupen64plus-ui-console/projects/unix/Makefile | |
@@ -101,12 +101,26 @@ endif | |
ifeq ($(OS), OSX) | |
# The mac version of SDL requires inclusion of SDL_main in the executable | |
LDLIBS += -ldl $(shell sdl-config --libs) | |
+ CFLAGS += $(shell sdl-config --cflags) | |
+ | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch x86_64 | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -arch i686 | |
endif | |
endif | |
diff --git a/source/mupen64plus-video-rice/projects/unix/Makefile b/source/mupen64plus-video-rice/projects/unix/Makefile | |
index 1d3ee89..56eaafd 100644 | |
--- a/source/mupen64plus-video-rice/projects/unix/Makefile | |
+++ b/source/mupen64plus-video-rice/projects/unix/Makefile | |
@@ -138,13 +138,25 @@ ifeq ($(OS), LINUX) | |
LDFLAGS += -Wl,-version-script,$(SRCDIR)/video_api_export.ver | |
endif | |
ifeq ($(OS), OSX) | |
+ # Select the proper SDK | |
+ # Also, SDKs are stored in a different location since XCode 4.3 | |
+ OSX_SDK ?= $(shell sw_vers -productVersion | cut -f1 -f2 -d .) | |
+ OSX_XCODEMAJ = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f1 -d .) | |
+ OSX_XCODEMIN = $(shell xcodebuild -version | grep '[0-9]*\.[0-9]*' | cut -f2 -d ' ' | cut -f2 -d .) | |
+ OSX_XCODEGE43 = $(shell echo "`expr $(OSX_XCODEMAJ) \>= 4``expr $(OSX_XCODEMIN) \>= 3`") | |
+ ifeq ($(OSX_XCODEGE43), 11) | |
+ OSX_SYSROOT := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs | |
+ else | |
+ OSX_SYSROOT := /Developer/SDKs | |
+ endif | |
+ | |
ifeq ($(CPU), X86) | |
ifeq ($(ARCH_DETECTED), 64BITS) | |
- CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -arch x86_64 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -bundle -framework OpenGL -arch x86_64 | |
LDLIBS += -ldl | |
else | |
- CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=10.5 -isysroot /Developer/SDKs/MacOSX10.5.sdk | |
+ CFLAGS += -pipe -mmmx -msse -fomit-frame-pointer -arch i686 -mmacosx-version-min=$(OSX_SDK) -isysroot $(OSX_SYSROOT)/MacOSX$(OSX_SDK).sdk | |
LDFLAGS += -bundle -framework OpenGL -arch i686 | |
LDLIBS += -ldl | |
endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment