A more accurate GCC compiler detection

Instead of relying on the executable name, it is better to "parse" the version information of the compiler.
This commit is contained in:
Anderson Torres 2021-10-06 19:03:58 -03:00 committed by GitHub
parent e23dab20da
commit bbf8fea738
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,10 @@ single-c:
# compiler setup
CC = clang
ifneq ($(findstring gcc, $(CC)),)
# Detects if we are running GCC instead of Clang
CC_IS_GCC = $(shell $(CC) --version | head -n1 | grep -m 1 -c "gcc")
ifeq (${CC_IS_GCC}, 1)
CCFLAGS = -Wno-parentheses
else
CCFLAGS = -Wno-microsoft-anon-tag
@ -121,4 +124,4 @@ ${bd}/load.o: src/gen/customRuntime
clean:
rm -f ${bd}/*.o
rm -f ${bd}/*.d
rm -f ${bd}/*.d