Unverified Commit 557ca05d authored by Rafi Einstein's avatar Rafi Einstein Committed by GitHub
Browse files

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.
parent aa2403ca
...@@ -15,9 +15,14 @@ ...@@ -15,9 +15,14 @@
release_hdr := $(shell sh -c './mkreleasehdr.sh') release_hdr := $(shell sh -c './mkreleasehdr.sh')
uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not') uname_S := $(shell sh -c 'uname -s 2>/dev/null || echo not')
uname_M := $(shell sh -c 'uname -m 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 OPTIMIZATION?=-O3
ifeq ($(OPTIMIZATION),-O3) ifeq ($(OPTIMIZATION),-O3)
ifeq (clang,$(CLANG))
REDIS_CFLAGS+=-flto
else
REDIS_CFLAGS+=-flto=auto REDIS_CFLAGS+=-flto=auto
endif
REDIS_LDFLAGS+=-flto REDIS_LDFLAGS+=-flto
endif endif
DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv DEPENDENCY_TARGETS=hiredis linenoise lua hdr_histogram fpconv
...@@ -28,7 +33,7 @@ STD=-pedantic -DREDIS_STATIC='' ...@@ -28,7 +33,7 @@ STD=-pedantic -DREDIS_STATIC=''
# Use -Wno-c11-extensions on clang, either where explicitly used or on # Use -Wno-c11-extensions on clang, either where explicitly used or on
# platforms we can assume it's being used. # platforms we can assume it's being used.
ifneq (,$(findstring clang,$(CC))) ifeq (clang,$(CLANG))
STD+=-Wno-c11-extensions STD+=-Wno-c11-extensions
else else
ifneq (,$(findstring FreeBSD,$(uname_S))) ifneq (,$(findstring FreeBSD,$(uname_S)))
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment