| 1 | SHELL := /bin/sh |
| 2 | |
| 3 | SWIFT_REPO := $(CURDIR) |
| 4 | LOCAL_DIR := $(SWIFT_REPO)/.local |
| 5 | |
| 6 | .PHONY: help verify verify-example verify-linux verify-apple-destinations verify-apple-destination clean |
| 7 | |
| 8 | help: |
| 9 | @printf '%s\n' \ |
| 10 | 'SmbCloudAuth Swift — pure-Swift SDK' \ |
| 11 | '' \ |
| 12 | 'Usage:' \ |
| 13 | ' make verify Build + test the package and build the example app' \ |
| 14 | ' make verify-example Build the packaged macOS example app' \ |
| 15 | ' make verify-linux Build + test AuthCore on a non-Apple toolchain' \ |
| 16 | ' make verify-apple-destinations Build the package for iOS, tvOS, and visionOS' \ |
| 17 | ' make clean Remove local build artifacts' \ |
| 18 | '' \ |
| 19 | 'Layering:' \ |
| 20 | ' AuthCore cross-platform (Apple/Linux/Windows/Android) headless core,' \ |
| 21 | ' a native Swift port of smbcloud-cli/crates/smbcloud-auth-sdk.' \ |
| 22 | ' SmbCloudAuth Apple UI layer (hosted login + Keychain) on top of AuthCore.' \ |
| 23 | ' Both are pure Swift — no Rust/UniFFI artifacts required.' |
| 24 | |
| 25 | verify: |
| 26 | swift build |
| 27 | swift test |
| 28 | $(MAKE) verify-example |
| 29 | |
| 30 | verify-example: |
| 31 | swift build --package-path Examples/HostedLoginExample |
| 32 | |
| 33 | # Cross-platform check: AuthCore (and the rest of the package) must build and |
| 34 | # test on non-Apple toolchains such as Linux, Windows, and Android. |
| 35 | verify-linux: |
| 36 | swift build |
| 37 | swift build --target AuthCore |
| 38 | swift test |
| 39 | |
| 40 | verify-apple-destinations: |
| 41 | $(MAKE) verify-apple-destination PLATFORM=ios |
| 42 | $(MAKE) verify-apple-destination PLATFORM=tvos |
| 43 | $(MAKE) verify-apple-destination PLATFORM=visionos |
| 44 | |
| 45 | verify-apple-destination: |
| 46 | @test -n "$(PLATFORM)" || { echo "Set PLATFORM=ios|tvos|visionos"; exit 1; } |
| 47 | @case "$(PLATFORM)" in \ |
| 48 | ios) destination="generic/platform=iOS"; derived_data="$(LOCAL_DIR)/verify-ios" ;; \ |
| 49 | tvos) destination="generic/platform=tvOS"; derived_data="$(LOCAL_DIR)/verify-tvos" ;; \ |
| 50 | visionos) destination="generic/platform=visionOS"; derived_data="$(LOCAL_DIR)/verify-visionos" ;; \ |
| 51 | *) echo "Unsupported PLATFORM='$(PLATFORM)'. Expected one of: ios tvos visionos"; exit 1 ;; \ |
| 52 | esac; \ |
| 53 | xcodebuild -quiet -scheme SmbCloudAuth -destination "$${destination}" -derivedDataPath "$${derived_data}" build |
| 54 | |
| 55 | clean: |
| 56 | rm -rf "$(LOCAL_DIR)" |
| 57 | @echo "Removed local SmbCloudAuth Swift build artifacts" |