clang detection in unix hints
Closes #1500 but it does apply the pull request. Hopefully, this makes things a little clearer.
This commit is contained in:
@@ -14,7 +14,7 @@ CCFLAGS = -g
|
|||||||
|
|
||||||
#If you want to force use of one particular set of compilers, do it
|
#If you want to force use of one particular set of compilers, do it
|
||||||
#here, ahead of the detection, so that the detection will match your
|
#here, ahead of the detection, so that the detection will match your
|
||||||
#choice and set variables CCISCLANG, GCCGTEQ, CLANGPPGTEQ9 etc.
|
#choice and set variables CCISCLANG, CCISGCC, GCCGTEQ, CLANGPPGTEQ9 etc.
|
||||||
#accordingly.
|
#accordingly.
|
||||||
#
|
#
|
||||||
#CC= gcc
|
#CC= gcc
|
||||||
@@ -41,7 +41,7 @@ endif
|
|||||||
# If you want to override the compiler detection just carried out
|
# If you want to override the compiler detection just carried out
|
||||||
# uncomment one of the following pairs. Note, however, that
|
# uncomment one of the following pairs. Note, however, that
|
||||||
# doing this after the detection above will likely result in
|
# doing this after the detection above will likely result in
|
||||||
# mismatched variable values for CCISCLANG, GCCGTEQ, CLANGPPGTEQ9 etc.
|
# mismatched variable values for CCISCLANG, CCISGCC, GCCGTEQ, CLANGPPGTEQ9 etc.
|
||||||
#
|
#
|
||||||
#CC= gcc
|
#CC= gcc
|
||||||
#CXX= g++ -std-gnu++11
|
#CXX= g++ -std-gnu++11
|
||||||
@@ -72,8 +72,17 @@ CFLAGS+=-Wstrict-prototypes
|
|||||||
CFLAGS+=-Wnonnull
|
CFLAGS+=-Wnonnull
|
||||||
|
|
||||||
#detection of clang vs gcc
|
#detection of clang vs gcc
|
||||||
CCISCLANG := $(shell echo `$(CC) --version` | grep clang)
|
CCTEST := $(shell echo `$(CC) --version` | grep clang)
|
||||||
ifeq "$(CCISCLANG)" ""
|
ifneq "$(CCTEST)" ""
|
||||||
|
CCISCLANG=1
|
||||||
|
CCISGCC=
|
||||||
|
else
|
||||||
|
CCISCLANG=
|
||||||
|
CCISGCC=1
|
||||||
|
endif
|
||||||
|
#$(info CCISCLANG=$(CCISCLANG), CCISGCC=$(CCISGCC))
|
||||||
|
|
||||||
|
ifeq "$(CCISGCC)" "1"
|
||||||
# gcc-specific follows
|
# gcc-specific follows
|
||||||
CXX=g++ -std=gnu++11
|
CXX=g++ -std=gnu++11
|
||||||
# get the version of gcc
|
# get the version of gcc
|
||||||
@@ -95,8 +104,8 @@ CFLAGS+=-Wimplicit-fallthrough
|
|||||||
#endif
|
#endif
|
||||||
# end of gcc-specific
|
# end of gcc-specific
|
||||||
else # gcc or clang?
|
else # gcc or clang?
|
||||||
CXX=clang++ -std=gnu++11
|
|
||||||
# clang-specific follows
|
# clang-specific follows
|
||||||
|
CXX=clang++ -std=gnu++11
|
||||||
CLANGGTEQ12 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 12)
|
CLANGGTEQ12 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 12)
|
||||||
CLANGGTEQ14 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 14)
|
CLANGGTEQ14 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 14)
|
||||||
CLANGGTEQ21 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 21)
|
CLANGGTEQ21 := $(shell expr `$(CC) -dumpversion | cut -f1 -d.` \>= 21)
|
||||||
|
|||||||
@@ -415,7 +415,7 @@ endif
|
|||||||
SYSCFLAGS=-DLUA_USE_LINUX
|
SYSCFLAGS=-DLUA_USE_LINUX
|
||||||
ifdef GITSUBMODULES
|
ifdef GITSUBMODULES
|
||||||
LUAFLAGS=CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
LUAFLAGS=CC='$(CC)' SYSCFLAGS='$(SYSCFLAGS)'
|
||||||
ifneq "$(CCISCLANG)" ""
|
ifeq "$(CCISCLANG)" "1"
|
||||||
# clang
|
# clang
|
||||||
LUAFLAGS +=CWARNGCC=''
|
LUAFLAGS +=CWARNGCC=''
|
||||||
endif # clang
|
endif # clang
|
||||||
|
|||||||
@@ -338,7 +338,7 @@ endif # WANT_LIBNH
|
|||||||
# this needs to be passed via make rather than defined in unixconf.h
|
# this needs to be passed via make rather than defined in unixconf.h
|
||||||
ifdef GITSUBMODULES
|
ifdef GITSUBMODULES
|
||||||
LUAFLAGS=CC='$(CC)' MYCFLAGS=' -DLUA_USE_MACOSX'
|
LUAFLAGS=CC='$(CC)' MYCFLAGS=' -DLUA_USE_MACOSX'
|
||||||
ifneq "$(CCISCLANG)" ""
|
ifeq "$(CCISCLANG)" "1"
|
||||||
# clang
|
# clang
|
||||||
LUAFLAGS +=CWARNGCC=''
|
LUAFLAGS +=CWARNGCC=''
|
||||||
endif # clang
|
endif # clang
|
||||||
|
|||||||
Reference in New Issue
Block a user