Swift macros with Embedded Swift and make as build system

Hi, how would I set up a makefile to use macros? I want an Embedded Swift module to provide some macros for more seamless interoperability with a different language. It doesn't seem too obvious, since I need to have an external dependency on SwiftSyntax

I'm getting a lot of errors like these when trying to use a Package.swift:

/Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.0.sdk/System/Library/Frameworks/Foundation.framework/Modules/Foundation.swiftmodule/arm64e-apple-macos.swiftinterface:17610:101: error: 'Failure' is only available in macOS 9999 or newer
17608 |   #if compiler(>=5.3) && $AssociatedTypeImplements
17609 |   @available(iOS 18.0, tvOS 18.0, watchOS 11.0, macOS 15.0, visionOS 2.0, *)
17610 |   @_implements(_Concurrency.AsyncSequence, Failure) public typealias __AsyncSequence_Failure = Base.Failure
      |                                                                                                     `- error: 'Failure' is only available in macOS 9999 or newer
17611 |   #else
17612 |   @available(iOS 18.0, tvOS 18.0, watchOS 11.0, macOS 15.0, visionOS 2.0, *)

There's also this:

/Package.swift:1:8: error: failed to build module 'Foundation'; this SDK is not supported by the compiler (the SDK is built with 'Apple Swift version 6.0 effective-5.10 (swiftlang- clang-1600.0.20.6)', while this compiler is 'Apple Swift version 6.0-dev effective-5.10 (LLVM 57177aa1b91540b, Swift 8be62863326595c)'). Please select a toolchain which matches the SDK.

Is this feature just unusable at the moment?

Though the more I try to get around this the more it seems like a general issue with Foundation for some reason, not actually specific to this use case. I also don't seem to be able to build projects like the Zed code editor because it happens to use some Swift code and it fails with similar Foundation related errors.

Are the macOS toolchains unusable in general? Why use the Xcode provided foundation if it's going to complain :eyes:

Where can I get a usable version of Foundation where every other declaration isn't annotated as unavailable?

On top of that if the library that declares the macros is using the BuiltinModule experimental feature macros do not work with this warning:

External macro implementation type 'MyMacros.EntryMacro' could not be found for macro 'entry()'; No such file or directory

And then still, the library can't be built because it can't import the macro implementation module in embedded mode. So I made that embedded, but now it doesn't compile because SwiftSyntax can't be imported from embedded mode...

If macros expand at compile time, why is there this odd dependency on macros being implemented in embedded mode too?