From 198991f717cee155b477ae3660495a58a6de30ce Mon Sep 17 00:00:00 2001 From: Mario Apra Date: Fri, 9 Aug 2024 17:33:52 +0100 Subject: [PATCH] Set macOS deployment target in Makefile (#2042) The idea is to avoid warnings like: ``` ld: warning: object file XX was built for newer macOS version (14.4) than being linked (14.0) ``` --- Makefile | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Makefile b/Makefile index c5a4db751b..d058116721 100644 --- a/Makefile +++ b/Makefile @@ -12,6 +12,11 @@ endif ifeq ($(shell uname -s),Darwin) export CGO_LDFLAGS=-framework Foundation -framework SystemConfiguration + + # Set macOS deployment target in order to avoid linker warnings linke + # "ld: warning: object file XX was built for newer macOS version (14.4) than being linked (14.0)" + export MACOSX_DEPLOYMENT_TARGET=$(shell sw_vers --productVersion) + # for test-race we need to pass -ldflags to fix linker warnings on macOS # see https://github.com/golang/go/issues/61229#issuecomment-1988965927 TEST_RACE_LDFLAGS=-ldflags=-extldflags=-Wl,-ld_classic