From a5e1d4f3f8781c91d9fdfe198f27290b544c1808 Mon Sep 17 00:00:00 2001 From: Prakash Rudraraju <1471544+prakashrj@users.noreply.github.com> Date: Sun, 30 Aug 2026 11:14:15 -0700 Subject: [PATCH] build: let the environment override MACOS_TARGET MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `MACOS_TARGET := 15.0` is a simply-expanded assignment, so an environment variable does not override it. `MACOS_TARGET=14.0 make c-archive` builds 15.0 and reports success — you set the floor, make agrees, and you get the old one. Only `make MACOS_TARGET=14.0 c-archive` works. Measured with `make -n` against this Makefile, GOOS=darwin: before after env override 15.0 14.0 command-line 14.0 14.0 default 15.0 15.0 `?=` fixes the environment case and changes nothing else: a command-line override still wins, and the default is untouched for anyone not setting it. Found while lowering the macOS floor of a TailscaleKit.xcframework built from this repo. The failure is quiet in a way that matters here — nothing warns, the build succeeds, and the resulting binary is stamped with a floor its Go objects do not actually support. On macOS the only signal is an `ld: warning: object file ... was built for newer 'macOS' version`, which is easy to lose in build output. This is the same knob #60's "Aside" points at: if the project lowers its own deployment targets, whoever does it is likely to reach for the environment variable first. Not touched here: the comment above the line still says the wrapper requires macOS 15.0 features. That is a separate question and depends on #60, which measures macOS 14.0 as buildable once the listener API is gated. --- Makefile | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index cbbb224..2dcd938 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,13 @@ export CGO_ENABLED=1 # This should match the minimum target in the xCode project # The wrapper lib currently requires features available in # MacOS 15.0 (Sequoia) -MACOS_TARGET := 15.0 +# +# `?=` rather than `:=` so the environment can override it. With `:=`, +# `MACOS_TARGET=14.0 make c-archive` is silently ignored — make reports success +# and builds 15.0 anyway, because an environment variable does not override a +# makefile assignment. Only `make MACOS_TARGET=14.0 c-archive` worked, which is +# easy to get wrong and gives no signal when you do. +MACOS_TARGET ?= 15.0 # Set macOS-specific flags for darwin builds ifeq ($(GOOS),darwin)