2024-11-03 10:46:25 +01:00
|
|
|
OSX_MIN_VERSION=11.0
|
2024-11-16 03:01:48 +01:00
|
|
|
OSX_SDK_VERSION=14.0
|
|
|
|
XCODE_VERSION=15.0
|
|
|
|
XCODE_BUILD_ID=15A240d
|
2024-11-04 15:19:19 +01:00
|
|
|
LD64_VERSION=711
|
2021-08-26 09:46:53 +02:00
|
|
|
|
|
|
|
OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
|
2021-07-15 18:44:55 +02:00
|
|
|
|
2020-08-20 23:30:30 +02:00
|
|
|
darwin_native_binutils=native_cctools
|
|
|
|
|
|
|
|
ifeq ($(strip $(FORCE_USE_SYSTEM_CLANG)),)
|
|
|
|
# FORCE_USE_SYSTEM_CLANG is empty, so we use our depends-managed, pinned clang
|
|
|
|
# from llvm.org
|
|
|
|
|
2021-03-17 05:06:29 +01:00
|
|
|
# Clang is a dependency of native_cctools when FORCE_USE_SYSTEM_CLANG is empty
|
2020-08-20 23:30:30 +02:00
|
|
|
darwin_native_toolchain=native_cctools
|
|
|
|
|
|
|
|
clang_prog=$(build_prefix)/bin/clang
|
|
|
|
clangxx_prog=$(clang_prog)++
|
2022-07-28 15:24:30 +02:00
|
|
|
llvm_config_prog=$(build_prefix)/bin/llvm-config
|
2020-08-20 23:30:30 +02:00
|
|
|
|
2024-11-04 15:49:59 +01:00
|
|
|
darwin_OBJDUMP=$(build_prefix)/bin/$(host)-objdump
|
|
|
|
|
2020-08-20 23:30:30 +02:00
|
|
|
else
|
|
|
|
# FORCE_USE_SYSTEM_CLANG is non-empty, so we use the clang from the user's
|
|
|
|
# system
|
|
|
|
|
|
|
|
darwin_native_toolchain=
|
|
|
|
|
|
|
|
# We can't just use $(shell command -v clang) because GNU Make handles builtins
|
|
|
|
# in a special way and doesn't know that `command` is a POSIX-standard builtin
|
|
|
|
# prior to 1af314465e5dfe3e8baa839a32a72e83c04f26ef, first released in v4.2.90.
|
|
|
|
# At the time of writing, GNU Make v4.2.1 is still being used in supported
|
|
|
|
# distro releases.
|
|
|
|
#
|
|
|
|
# Source: https://lists.gnu.org/archive/html/bug-make/2017-11/msg00017.html
|
|
|
|
clang_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang")
|
|
|
|
clangxx_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v clang++")
|
2022-07-28 15:24:30 +02:00
|
|
|
llvm_config_prog=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-config")
|
2020-08-20 23:30:30 +02:00
|
|
|
|
2022-07-28 15:24:30 +02:00
|
|
|
llvm_lib_dir=$(shell $(llvm_config_prog) --libdir)
|
2024-11-04 15:49:59 +01:00
|
|
|
|
|
|
|
darwin_OBJDUMP=$(shell $(SHELL) $(.SHELLFLAGS) "command -v llvm-objdump")
|
2020-08-20 23:30:30 +02:00
|
|
|
endif
|
|
|
|
|
2024-11-04 15:49:59 +01:00
|
|
|
cctools_TOOLS=AR RANLIB STRIP NM
|
2020-08-20 23:30:30 +02:00
|
|
|
|
|
|
|
# Make-only lowercase function
|
|
|
|
lc = $(subst A,a,$(subst B,b,$(subst C,c,$(subst D,d,$(subst E,e,$(subst F,f,$(subst G,g,$(subst H,h,$(subst I,i,$(subst J,j,$(subst K,k,$(subst L,l,$(subst M,m,$(subst N,n,$(subst O,o,$(subst P,p,$(subst Q,q,$(subst R,r,$(subst S,s,$(subst T,t,$(subst U,u,$(subst V,v,$(subst W,w,$(subst X,x,$(subst Y,y,$(subst Z,z,$1))))))))))))))))))))))))))
|
|
|
|
|
|
|
|
# For well-known tools provided by cctools, make sure that their well-known
|
|
|
|
# variable is set to the full path of the tool, just like how AC_PATH_{TOO,PROG}
|
|
|
|
# would.
|
|
|
|
$(foreach TOOL,$(cctools_TOOLS),$(eval darwin_$(TOOL) = $$(build_prefix)/bin/$$(host)-$(call lc,$(TOOL))))
|
|
|
|
|
2021-08-26 11:34:32 +02:00
|
|
|
# Flag explanations:
|
|
|
|
#
|
|
|
|
# -mlinker-version
|
|
|
|
#
|
|
|
|
# Ensures that modern linker features are enabled. See here for more
|
|
|
|
# details: https://github.com/bitcoin/bitcoin/pull/19407.
|
|
|
|
#
|
|
|
|
# -B$(build_prefix)/bin
|
|
|
|
#
|
|
|
|
# Explicitly point to our binaries (e.g. cctools) so that they are
|
|
|
|
# ensured to be found and preferred over other possibilities.
|
|
|
|
#
|
2024-11-04 10:29:55 +01:00
|
|
|
# -isysroot$(OSX_SDK) -nostdlibinc
|
2021-08-26 11:34:32 +02:00
|
|
|
#
|
2024-11-04 10:29:55 +01:00
|
|
|
# Disable default include paths built into the compiler as well as
|
|
|
|
# those normally included for libc and libc++. The only path that
|
|
|
|
# remains implicitly is the clang resource dir.
|
2021-08-26 11:34:32 +02:00
|
|
|
#
|
2024-11-04 10:29:55 +01:00
|
|
|
# -iwithsysroot / -iframeworkwithsysroot
|
2020-08-20 23:30:30 +02:00
|
|
|
#
|
2024-11-04 10:29:55 +01:00
|
|
|
# Adds the desired paths from the SDK
|
2020-08-20 23:30:30 +02:00
|
|
|
#
|
2024-11-16 03:01:48 +01:00
|
|
|
# -platform_version
|
|
|
|
#
|
|
|
|
# Indicate to the linker the platform, the oldest supported version,
|
|
|
|
# and the SDK used.
|
2024-11-04 10:29:55 +01:00
|
|
|
|
2020-08-20 23:30:30 +02:00
|
|
|
darwin_CC=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
|
|
|
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
|
|
|
-u LIBRARY_PATH \
|
2024-11-07 07:00:25 +01:00
|
|
|
$(clang_prog) --target=$(host) \
|
|
|
|
-B$(build_prefix)/bin \
|
2024-11-04 10:29:55 +01:00
|
|
|
-isysroot$(OSX_SDK) -nostdlibinc \
|
|
|
|
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
|
|
|
|
|
2020-08-20 23:30:30 +02:00
|
|
|
darwin_CXX=env -u C_INCLUDE_PATH -u CPLUS_INCLUDE_PATH \
|
|
|
|
-u OBJC_INCLUDE_PATH -u OBJCPLUS_INCLUDE_PATH -u CPATH \
|
|
|
|
-u LIBRARY_PATH \
|
2024-11-07 07:00:25 +01:00
|
|
|
$(clangxx_prog) --target=$(host) \
|
|
|
|
-B$(build_prefix)/bin \
|
2024-11-04 10:29:55 +01:00
|
|
|
-isysroot$(OSX_SDK) -nostdlibinc \
|
|
|
|
-iwithsysroot/usr/include/c++/v1 \
|
|
|
|
-iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
|
2014-09-23 23:00:31 +02:00
|
|
|
|
2024-11-07 07:00:25 +01:00
|
|
|
darwin_CFLAGS=-pipe -std=$(C_STANDARD) -mmacosx-version-min=$(OSX_MIN_VERSION)
|
|
|
|
darwin_CXXFLAGS=-pipe -std=$(CXX_STANDARD) -mmacosx-version-min=$(OSX_MIN_VERSION)
|
2024-11-16 03:01:48 +01:00
|
|
|
darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION)
|
2022-06-14 20:06:03 +02:00
|
|
|
|
2024-11-07 07:00:25 +01:00
|
|
|
ifneq ($(build_os),darwin)
|
|
|
|
darwin_CFLAGS += -mlinker-version=$(LD64_VERSION)
|
|
|
|
darwin_CXXFLAGS += -mlinker-version=$(LD64_VERSION)
|
|
|
|
endif
|
|
|
|
|
2014-09-23 23:00:31 +02:00
|
|
|
darwin_release_CFLAGS=-O2
|
|
|
|
darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
|
|
|
|
|
2024-04-03 11:43:14 +02:00
|
|
|
darwin_debug_CFLAGS=-O1 -g
|
2014-09-23 23:00:31 +02:00
|
|
|
darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
|
2020-05-21 09:10:52 +02:00
|
|
|
|
|
|
|
darwin_cmake_system=Darwin
|