summaryrefslogtreecommitdiffstats
path: root/mkspecs
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-01-16 14:26:02 +0100
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2019-01-29 11:08:31 +0000
commit5d181961ea28da07128384aa5144c67d07f87a3e (patch)
treea18f178f7efa00fa0d858345eff6e3d2ddcbdaf4 /mkspecs
parent775b5e26315f96b29840198a089f82edea52e1a1 (diff)
macOS: Don't check for stale SDK unless target needs to be remade
Also catches some more variants of SDK mismatch, such as Xcode not being installed at all, or the SDK missing. Change-Id: I184aaa571ef0ea722ca64c54f665462dabc17533 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Simon Hausmann <simon.hausmann@qt.io>
Diffstat (limited to 'mkspecs')
-rw-r--r--mkspecs/features/mac/sdk.mk33
1 files changed, 23 insertions, 10 deletions
diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
index c0266f2139..c40f58c987 100644
--- a/mkspecs/features/mac/sdk.mk
+++ b/mkspecs/features/mac/sdk.mk
@@ -1,12 +1,25 @@
-CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version)
-ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
- $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
- $(info This requires a fresh build. Please wipe the build directory completely,)
- $(info including any .qmake.stash and .qmake.cache files generated by qmake.)
- # FIXME: Ideally this should be advertised as just running make distclean, or we
- # should even do it automatically by having proper makefile dependencies between
- # .qmake.stash and the SDK version, but as qmake doesn't seem to be consistent in
- # how it deals with .qmake.stash as a dependency we need to defer that until later.
- $(error ^)
+ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)
+ CHECK_SDK_COMMAND = /usr/bin/xcrun --sdk $(EXPORT_QMAKE_MAC_SDK) -show-sdk-version 2>&1
+ CURRENT_MAC_SDK_VERSION := $(shell DEVELOPER_DIR=$(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) $(CHECK_SDK_COMMAND))
+ ifneq ($(CURRENT_MAC_SDK_VERSION),$(EXPORT_QMAKE_MAC_SDK_VERSION))
+ # We don't want to complain about out of date SDK unless the target needs to be remade.
+ # This covers use-cases such as running 'make check' after moving the build to a
+ # computer without Xcode or with a different Xcode version.
+ TARGET_UP_TO_DATE := $(shell QT_MAC_SDK_NO_VERSION_CHECK=1 $(MAKE) --question $(QMAKE_TARGET) && echo 1 || echo 0)
+ ifeq ($(TARGET_UP_TO_DATE),0)
+ ifneq ($(findstring missing DEVELOPER_DIR path,$(CURRENT_MAC_SDK_VERSION)),)
+ $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) is no longer valid.)
+ else ifneq ($(findstring SDK "$(EXPORT_QMAKE_MAC_SDK)" cannot be located,$(CURRENT_MAC_SDK_VERSION)),)
+ $(info The developer dir $(EXPORT_QMAKE_XCODE_DEVELOPER_PATH) no longer contains the $(EXPORT_QMAKE_MAC_SDK_VERSION) platform SDK.)
+ else ifneq ($(CURRENT_MAC_SDK_VERSION),)
+ $(info The platform SDK has been changed from version $(EXPORT_QMAKE_MAC_SDK_VERSION) to version $(CURRENT_MAC_SDK_VERSION).)
+ else
+ $(info Unknown error resolving current platform SDK version.)
+ endif
+ $(info This requires a fresh build. Please wipe the build directory completely,)
+ $(info including any .qmake.stash and .qmake.cache files generated by qmake.)
+ $(error ^)
+ endif
+ endif
endif