Skip to content

Commit 6732b84

Browse files
committed
Only set CC if none is set (don't overwrite env CC)
Allow passing other CCs
1 parent 56dc827 commit 6732b84

1 file changed

Lines changed: 7 additions & 4 deletions

File tree

GNUmakefile

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,13 @@ MAKEFILE_DIR := $(dir $(MAKEFILE_PATH))
2525
BUILD_DIR := $(MAKEFILE_DIR)/dist
2626

2727
# ARGS
28-
# Set a compiler when running on Linux via `make CC=gcc` / `make CC=clang`
29-
CC = gcc
30-
ifneq ($(filter $(CC),gcc clang aarch64-linux-gnu-gcc arm-linux-gnueabihf-gcc musl-gcc),$(CC))
31-
$(error Invalid compiler specified: `$(CC)`)
28+
CC ?= gcc
29+
ifeq ($(CC), cc)
30+
ifeq ($(shell uname),Darwin)
31+
CC = clang
32+
else
33+
CC = gcc
34+
endif
3235
endif
3336

3437
# Allow to add arch-target for macOS CI cross compilation

0 commit comments

Comments
 (0)