From 36a17536ca739cea2c773a478b7bc0688cd59434 Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Tue, 3 Apr 2018 15:09:25 -0700 Subject: [PATCH 1/2] Compile with cc rather than gcc whenever possible --- Makefile.system | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Makefile.system b/Makefile.system index d504a11119..769628e982 100644 --- a/Makefile.system +++ b/Makefile.system @@ -17,16 +17,20 @@ NETLIB_LAPACK_DIR = $(TOPDIR)/lapack-netlib # http://stackoverflow.com/questions/4029274/mingw-and-make-variables # - Default value is 'cc' which is not always a valid command (e.g. MinGW). ifeq ($(origin CC),default) + +# Check if $(CC) refers to a valid command and set the value to gcc if not +ifneq ($(findstring cmd.exe,$(SHELL)),) +ifeq ($(shell where $(CC) 2>NUL),) +CC = gcc +endif +else # POSIX +ifeq ($(shell command -v $(CC) 2>/dev/null),) CC = gcc -# Change the default compile to clang on Mac OSX. -# http://stackoverflow.com/questions/714100/os-detecting-makefile -UNAME_S := $(shell uname -s) -ifeq ($(UNAME_S),Darwin) - CC = clang -# EXTRALIB += -Wl,-no_compact_unwind endif endif +endif # CC is set to default + # Default Fortran compiler (FC) is selected by f_check. ifndef MAKEFILE_RULE From 8f811a9312f6692c084c25fa78c45827accb7103 Mon Sep 17 00:00:00 2001 From: Alex Arslan Date: Wed, 4 Apr 2018 11:41:45 -0700 Subject: [PATCH 2/2] Reinstate macOS logic --- Makefile.system | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Makefile.system b/Makefile.system index 769628e982..142cb420f8 100644 --- a/Makefile.system +++ b/Makefile.system @@ -23,11 +23,16 @@ ifneq ($(findstring cmd.exe,$(SHELL)),) ifeq ($(shell where $(CC) 2>NUL),) CC = gcc endif -else # POSIX +else # POSIX-ish ifeq ($(shell command -v $(CC) 2>/dev/null),) +ifeq ($(shell uname -s),Darwin) +CC = clang +# EXTRALIB += -Wl,-no_compact_unwind +else CC = gcc -endif -endif +endif # Darwin +endif # CC exists +endif # Shell is sane endif # CC is set to default