/ depends / hosts / darwin.mk
darwin.mk
 1  OSX_MIN_VERSION=14.0
 2  OSX_SDK_VERSION=14.0
 3  XCODE_VERSION=26.1.1
 4  XCODE_BUILD_ID=17B100
 5  LLD_VERSION=711
 6  
 7  OSX_SDK=$(SDK_PATH)/Xcode-$(XCODE_VERSION)-$(XCODE_BUILD_ID)-extracted-SDK-with-libcxx-headers
 8  
 9  clang_prog=$(shell command -v clang)
10  clangxx_prog=$(shell command -v clang++)
11  
12  darwin_AR=$(shell command -v llvm-ar)
13  darwin_NM=$(shell command -v llvm-nm)
14  darwin_OBJCOPY=$(shell command -v llvm-objcopy)
15  darwin_OBJDUMP=$(shell command -v llvm-objdump)
16  darwin_RANLIB=$(shell command -v llvm-ranlib)
17  darwin_STRIP=$(shell command -v llvm-strip)
18  
19  # Flag explanations:
20  #
21  #     -mlinker-version
22  #
23  #         Ensures that modern linker features are enabled. See here for more
24  #         details: https://github.com/bitcoin/bitcoin/pull/19407.
25  #
26  #     -isysroot$(OSX_SDK) -nostdlibinc
27  #
28  #         Disable default include paths built into the compiler as well as
29  #         those normally included for libc and libc++. The only path that
30  #         remains implicitly is the clang resource dir.
31  #
32  #     -iwithsysroot / -iframeworkwithsysroot
33  #
34  #         Adds the desired paths from the SDK
35  #
36  #     -platform_version
37  #
38  #         Indicate to the linker the platform, the oldest supported version,
39  #         and the SDK used.
40  #
41  #     -no_adhoc_codesign
42  #
43  #         Disable adhoc codesigning (for now) when using LLVM tooling, to avoid
44  #         non-determinism issues with the Identifier field.
45  #
46  #     -Xclang -fno-cxx-modules
47  #
48  #         Disable C++ modules. We don't use these, and modules cause definition issues
49  #         in the SDK, where __has_feature(modules) is used to define USE_CLANG_TYPES,
50  #         which is in turn used as an include guard.
51  
52  darwin_CC=$(clang_prog) --target=$(host) \
53                -isysroot$(OSX_SDK) -nostdlibinc \
54                -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
55  
56  darwin_CXX=$(clangxx_prog) --target=$(host) \
57                 -isysroot$(OSX_SDK) -nostdlibinc \
58                 -iwithsysroot/usr/include/c++/v1 \
59                 -iwithsysroot/usr/include -iframeworkwithsysroot/System/Library/Frameworks
60  
61  darwin_CFLAGS=-mmacos-version-min=$(OSX_MIN_VERSION)
62  darwin_CXXFLAGS=-mmacos-version-min=$(OSX_MIN_VERSION) -Xclang -fno-cxx-modules
63  darwin_LDFLAGS=-Wl,-platform_version,macos,$(OSX_MIN_VERSION),$(OSX_SDK_VERSION)
64  
65  ifneq ($(build_os),darwin)
66  darwin_CFLAGS += -mlinker-version=$(LLD_VERSION)
67  darwin_CXXFLAGS += -mlinker-version=$(LLD_VERSION)
68  darwin_LDFLAGS += -Wl,-no_adhoc_codesign -fuse-ld=lld
69  endif
70  
71  darwin_release_CFLAGS=-O2
72  darwin_release_CXXFLAGS=$(darwin_release_CFLAGS)
73  
74  darwin_debug_CFLAGS=-O1 -g
75  darwin_debug_CXXFLAGS=$(darwin_debug_CFLAGS)
76  
77  darwin_cmake_system_name=Darwin
78  # Darwin version, which corresponds to OSX_MIN_VERSION.
79  # See https://en.wikipedia.org/wiki/Darwin_(operating_system)
80  darwin_cmake_system_version=20.1