Skip to content

Commit 84923de

Browse files
authored
Merge pull request #1505 from ararslan/aa/compiler
Compile with cc rather than gcc whenever possible
2 parents d636b41 + 8f811a9 commit 84923de

File tree

1 file changed

+16
-7
lines changed

1 file changed

+16
-7
lines changed

Makefile.system

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,24 @@ NETLIB_LAPACK_DIR = $(TOPDIR)/lapack-netlib
1717
# http://stackoverflow.com/questions/4029274/mingw-and-make-variables
1818
# - Default value is 'cc' which is not always a valid command (e.g. MinGW).
1919
ifeq ($(origin CC),default)
20+
21+
# Check if $(CC) refers to a valid command and set the value to gcc if not
22+
ifneq ($(findstring cmd.exe,$(SHELL)),)
23+
ifeq ($(shell where $(CC) 2>NUL),)
2024
CC = gcc
21-
# Change the default compile to clang on Mac OSX.
22-
# http://stackoverflow.com/questions/714100/os-detecting-makefile
23-
UNAME_S := $(shell uname -s)
24-
ifeq ($(UNAME_S),Darwin)
25-
CC = clang
26-
# EXTRALIB += -Wl,-no_compact_unwind
27-
endif
2825
endif
26+
else # POSIX-ish
27+
ifeq ($(shell command -v $(CC) 2>/dev/null),)
28+
ifeq ($(shell uname -s),Darwin)
29+
CC = clang
30+
# EXTRALIB += -Wl,-no_compact_unwind
31+
else
32+
CC = gcc
33+
endif # Darwin
34+
endif # CC exists
35+
endif # Shell is sane
36+
37+
endif # CC is set to default
2938

3039
# Default Fortran compiler (FC) is selected by f_check.
3140

0 commit comments

Comments
 (0)