diff options
author | Rafi Einstein <rafi@redislabs.com> | 2023-03-27 12:55:18 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-03-27 12:55:18 +0300 |
commit | 557ca05d059951f618aab5fcba727fa19ecad729 (patch) | |
tree | 0efdd86e876cb2870ae2a82eadbb5c4e0e926713 /src/Makefile | |
parent | aa2403ca98f6a39b6acd8373f8de1a7ba75162d5 (diff) | |
download | redis-557ca05d059951f618aab5fcba727fa19ecad729.tar.gz |
Clang: fix for -flto argument (#11961)
Starting with the recent #11926 Makefile specifies `-flto=auto` which is unsupported on clang.
Additionally, detecting clang correctly requires actually running it, since on MacOS gcc can be an alias for clang.
Diffstat (limited to 'src/Makefile')
-rw-r--r-- | src/Makefile | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile index b0727db2c..ae7f3f80a 100644 --- a/src/Makefile +++ b/src/Makefile @@ -15,9 +15,14 @@ release_hdr := $(shell sh -c './mkreleasehdr.sh') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_M := $(shell sh -c 'uname -m 2>/dev/null || echo not') +CLANG := $(findstring clang,$(shell sh -c '$(CC) --version | head -1')) OPTIMIZATION?=-O3 ifeq ($(OPTIMIZATION),-O3) - REDIS_CFLAGS+=-flto=auto + ifeq (clang,$(CLANG)) + REDIS_CFLAGS+=-flto + else + REDIS_CFLAGS+=-flto=auto + endif REDIS_LDFLAGS+=-flto endif DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv @@ -28,7 +33,7 @@ STD=-pedantic -DREDIS_STATIC='' # Use -Wno-c11-extensions on clang, either where explicitly used or on # platforms we can assume it's being used. -ifneq (,$(findstring clang,$(CC))) +ifeq (clang,$(CLANG)) STD+=-Wno-c11-extensions else ifneq (,$(findstring FreeBSD,$(uname_S))) |