Skip to content

Commit cdcb263

Browse files
committed
Updated makefiles
no more hardcoded parameters
1 parent 5c697ce commit cdcb263

4 files changed

Lines changed: 15 additions & 11 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 := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
49-
OSXCFLAGS := -mmacosx-version-min=10.14 -arch x86_64
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.14 -arch x86_64 -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 := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
32-
CFLAGS += -mmacosx-version-min=10.14 -isysroot $(SDK) -Wl,-syslibroot,$(SDK) -arch x86_64
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: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,13 @@ ifneq (,$(findstring CYGWIN,$(UNAME)))
3333
endif
3434

3535
ifneq (,$(findstring Darwin,$(UNAME)))
36-
SDK := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
37-
OSXCFLAGS := -mmacosx-version-min=10.14 -arch x86_64
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
4041
CFLAGS += -I/usr/local/include -I/usr/local/opt/libelf/include/libelf -I/usr/local/opt/openssl/include
41-
LDFLAGS += -mmacosx-version-min=10.14 -arch x86_64 -Wl,-syslibroot,$(SDK) -L/opt/local/lib -L/usr/local/opt/openssl/lib -lgmp -lcrypto -lz
42+
LDFLAGS += -mmacosx-version-min=$(OSX_MIN) -Wl,-syslibroot,$(SDK) -L/opt/local/lib -L/usr/local/opt/openssl/lib -lgmp -lcrypto -lz
4243
endif
4344

4445
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 := /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk
42-
OSXCFLAGS := -mmacosx-version-min=10.14 -isysroot $(SDK) -arch x86_64
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.14 -arch x86_64 -Wl,-syslibroot,$(SDK)
46+
LDFLAGS += -mmacosx-version-min=$(OSX_MIN) -Wl,-syslibroot,$(SDK)
4647
endif
4748

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

0 commit comments

Comments
 (0)