Skip to content

Commit 01b3d4d

Browse files
authored
Merge pull request #72 from bucanero/macos-fix
Update makefiles for macOS
2 parents da1edf5 + cdcb263 commit 01b3d4d

5 files changed

Lines changed: 17 additions & 12 deletions

File tree

tools/cgcomp/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,11 +45,12 @@ ifneq (,$(findstring CYGWIN,$(UNAME)))
4545
endif
4646

4747
ifneq (,$(findstring Darwin,$(UNAME)))
48-
SDK := /Developer/SDKs/MacOSX10.4u.sdk
49-
OSXCFLAGS := -mmacosx-version-min=10.4 -arch i386
48+
SDK := $(shell xcrun --show-sdk-path)
49+
OSX_MIN := $(shell defaults read $(shell xcrun --show-sdk-platform-path)/Info MinimumSDKVersion 2> /dev/null || 10.4)
50+
OSXCFLAGS := -mmacosx-version-min=$(OSX_MIN)
5051
OSXCXXFLAGS := $(OSXCFLAGS)
5152
CXXFLAGS += -fvisibility=hidden
52-
LDFLAGS += -mmacosx-version-min=10.4 -arch i386 -Wl,-syslibroot,$(SDK)
53+
LDFLAGS += -mmacosx-version-min=$(OSX_MIN) -Wl,-syslibroot,$(SDK)
5354
endif
5455

5556
ifneq (,$(findstring Linux,$(UNAME)))

tools/generic/Makefile

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ ifneq (,$(findstring CYGWIN,$(UNAME)))
2828
endif
2929

3030
ifneq (,$(findstring Darwin,$(shell uname -s)))
31-
SDK := /Developer/SDKs/MacOSX10.4u.sdk
32-
CFLAGS += -mmacosx-version-min=10.4 -isysroot $(SDK) -Wl,-syslibroot,$(SDK) -arch i386 -arch ppc
31+
SDK := $(shell xcrun --show-sdk-path)
32+
OSX_MIN := $(shell defaults read $(shell xcrun --show-sdk-platform-path)/Info MinimumSDKVersion 2> /dev/null || 10.4)
33+
CFLAGS += -mmacosx-version-min=$(OSX_MIN) -isysroot $(SDK) -Wl,-syslibroot,$(SDK)
3334
endif
3435

3536
TARGETS := $(patsubst %.c,%$(exeext),$(wildcard *.c)) \

tools/geohot/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,13 @@ ifneq (,$(findstring CYGWIN,$(UNAME)))
3333
endif
3434

3535
ifneq (,$(findstring Darwin,$(UNAME)))
36-
SDK := /Developer/SDKs/MacOSX10.4u.sdk
37-
OSXCFLAGS := -mmacosx-version-min=10.4 -arch i386
36+
SDK := $(shell xcrun --show-sdk-path)
37+
OSX_MIN := $(shell defaults read $(shell xcrun --show-sdk-platform-path)/Info MinimumSDKVersion 2> /dev/null || 10.4)
38+
OSXCFLAGS := -mmacosx-version-min=$(OSX_MIN)
3839
OSXCXXFLAGS := $(OSXCFLAGS)
3940
CXXFLAGS += -fvisibility=hidden
40-
LDFLAGS += -mmacosx-version-min=10.4 -arch i386 -Wl,-syslibroot,$(SDK) -L/opt/local/lib -lgmp -lcrypto -lz
41+
CFLAGS += -I/usr/local/include -I/usr/local/opt/libelf/include/libelf -I/usr/local/opt/openssl/include
42+
LDFLAGS += -mmacosx-version-min=$(OSX_MIN) -Wl,-syslibroot,$(SDK) -L/opt/local/lib -L/usr/local/opt/openssl/lib -lgmp -lcrypto -lz
4143
endif
4244

4345
ifneq (,$(findstring BSD,$(UNAME)))

tools/ps3load/Makefile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,12 @@ ifneq (,$(findstring MINGW,$(UNAME)))
3838
endif
3939

4040
ifneq (,$(findstring Darwin,$(shell uname -s)))
41-
SDK := /Developer/SDKs/MacOSX10.4u.sdk
42-
OSXCFLAGS := -mmacosx-version-min=10.4 -isysroot $(SDK) -arch i386 -arch ppc
41+
SDK := $(shell xcrun --show-sdk-path)
42+
OSX_MIN := $(shell defaults read $(shell xcrun --show-sdk-platform-path)/Info MinimumSDKVersion 2> /dev/null || 10.4)
43+
OSXCFLAGS := -mmacosx-version-min=$(OSX_MIN) -isysroot $(SDK)
4344
OSXCXXFLAGS := $(OSXCFLAGS)
4445
CXXFLAGS += -fvisibility=hidden
45-
LDFLAGS += -mmacosx-version-min=10.4 -arch i386 -arch ppc -Wl,-syslibroot,$(SDK)
46+
LDFLAGS += -mmacosx-version-min=$(OSX_MIN) -Wl,-syslibroot,$(SDK)
4647
endif
4748

4849
ifneq (,$(findstring SunOS,$(UNAME)))

tools/sprxlinker/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ ifneq (,$(findstring CYGWIN,$(UNAME)))
3131
endif
3232

3333
ifneq (,$(findstring Darwin,$(UNAME)))
34-
CFLAGS += -I/opt/local/include
34+
CFLAGS += -I/opt/local/include -I/usr/local/opt/libelf/include/libelf
3535
LDFLAGS += -L/opt/local/lib -lelf
3636
OS := Mac
3737
endif

0 commit comments

Comments
 (0)