From: Doug Coleman Date: Fri, 25 Aug 2023 02:37:21 +0000 (-0500) Subject: GNUmakefile: prefer clang if it exists X-Git-Url: https://gitweb.factorcode.org/gitweb.cgi?p=factor.git;a=commitdiff_plain;h=2a3b96ff21b8c3871543c317746f0f4b79e95243 GNUmakefile: prefer clang if it exists --- diff --git a/GNUmakefile b/GNUmakefile index b641b440f4..e86294c7c2 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -5,12 +5,19 @@ ifdef CONFIG DEBUG ?= 0 REPRODUCIBLE ?= 0 + SHELL_CC = $(shell printenv CC) + ifeq ($(SHELL_CC),) + CC := $(shell which clang cc 2>/dev/null | head -n 1) + else + CC = $(SHELL_CC) + endif + # gmake's default CXX is g++, we prefer c++ SHELL_CXX = $(shell printenv CXX) ifeq ($(SHELL_CXX),) - CXX=c++ + CXX := $(shell which clang++ c++ 2>/dev/null | head -n 1) else - CXX=$(SHELL_CXX) + CXX = $(SHELL_CXX) endif XCODE_PATH ?= /Applications/Xcode.app