From 37af7dfa42be5cd954ca15732cfba64b1a125ab0 Mon Sep 17 00:00:00 2001 From: Bob Copeland Date: Thu, 17 Dec 2015 16:35:19 -0500 Subject: [PATCH] fix build on OSX when only CLT is installed Based on a patch by Wael M. Nasreddine. If Xcode is not installed but command line tools are, the build will still work. So detect when xcode -version fails, and if so just do the build like normal. Signed-off-by: Bob Copeland --- Makefile | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Makefile b/Makefile index 817755ae..7d44e69b 100644 --- a/Makefile +++ b/Makefile @@ -11,6 +11,10 @@ CFLAGS += -MMD UNAME_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') ifeq ($(UNAME_S),Darwin) +HAS_XCODE := $(shell sh -c 'xcodebuild -version 2>/dev/null && echo 1') +endif + +ifeq ($(HAS_XCODE),1) SDKROOT ?= $(shell xcodebuild -version -sdk macosx | sed -n 's/^Path: \(.*\)/\1/p') CFLAGS += -Wno-deprecated-declarations -isysroot $(SDKROOT) -I$(SDKROOT)/usr/include/libxml2 LDLIBS = -lcurl -lxml2 -lssl -lcrypto