From aa591a48015a0d8e057ada944031714c8d2e4799 Mon Sep 17 00:00:00 2001 From: Dmitry Kovba Date: Wed, 29 Oct 2025 15:38:49 -0700 Subject: [PATCH] Improvements to `Makefile` (#370) Improvement to `Makefile`. Also see https://github.com/apple/container/pull/822. --- Makefile | 3 +-- vminitd/Makefile | 16 ++++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 5d8d5869..3c2947ce 100644 --- a/Makefile +++ b/Makefile @@ -13,10 +13,9 @@ # limitations under the License. # Build configuration variables -# The default version ID 0.0.0 indicates a local development build or PRB BUILD_CONFIGURATION ?= debug WARNINGS_AS_ERRORS ?= true -SWIFT_CONFIGURATION = $(if $(filter-out false,$(WARNINGS_AS_ERRORS)),-Xswiftc -warnings-as-errors) +SWIFT_CONFIGURATION := $(if $(filter-out false,$(WARNINGS_AS_ERRORS)),-Xswiftc -warnings-as-errors) # Commonly used locations SWIFT := "/usr/bin/swift" diff --git a/vminitd/Makefile b/vminitd/Makefile index 5a3336e5..3891b3ff 100644 --- a/vminitd/Makefile +++ b/vminitd/Makefile @@ -14,17 +14,17 @@ BUILD_CONFIGURATION := debug WARNINGS_AS_ERRORS ?= true -SWIFT_WARNING_CONFIG = $(if $(filter-out false,$(WARNINGS_AS_ERRORS)),-Xswiftc -warnings-as-errors) +SWIFT_WARNING_CONFIG := $(if $(filter-out false,$(WARNINGS_AS_ERRORS)),-Xswiftc -warnings-as-errors) SWIFT_CONFIGURATION := --swift-sdk aarch64-swift-linux-musl $(SWIFT_WARNING_CONFIG) -SWIFT_VERSION = 6.2 -SWIFT_SDK_URL = https://download.swift.org/swift-6.2-release/static-sdk/swift-6.2-RELEASE/swift-6.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz -SWIFT_SDK_PATH = /tmp/$(notdir $(SWIFT_SDK_URL)) +SWIFT_VERSION := 6.2 +SWIFT_SDK_URL := https://download.swift.org/swift-6.2-release/static-sdk/swift-6.2-RELEASE/swift-6.2-RELEASE_static-linux-0.0.1.artifactbundle.tar.gz +SWIFT_SDK_PATH := /tmp/$(notdir $(SWIFT_SDK_URL)) SWIFTLY_URL := https://download.swift.org/swiftly/darwin/swiftly.pkg -SWIFTLY_FILENAME = $(notdir $(SWIFTLY_URL)) +SWIFTLY_FILENAME := $(notdir $(SWIFTLY_URL)) SWIFTLY_BIN_DIR ?= ~/.swiftly/bin -VMINITD_BIN_PATH := $(shell swift build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --show-bin-path) +BUILD_BIN_DIR := $(shell swift build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) --show-bin-path) MACOS_VERSION := $(shell sw_vers -productVersion) MACOS_MAJOR := $(shell echo $(MACOS_VERSION) | cut -d. -f1) @@ -40,8 +40,8 @@ all: @rm -f ./bin/vmexec @swift --version @swift build -c $(BUILD_CONFIGURATION) $(SWIFT_CONFIGURATION) - @install "$(VMINITD_BIN_PATH)/vminitd" ./bin/ - @install "$(VMINITD_BIN_PATH)/vmexec" ./bin/ + @install "$(BUILD_BIN_DIR)/vminitd" ./bin/ + @install "$(BUILD_BIN_DIR)/vmexec" ./bin/ .PHONY: cross-prep cross-prep: linux-sdk macos-sdk