[make] Add a COMPILER_TYPE variable

This can be used to change compiler flags for GCC vs Clang.
This commit is contained in:
Alex Richardson
2023-03-10 03:55:58 -08:00
parent 135479c70e
commit 69111c40f5

View File

@@ -200,6 +200,9 @@ STRIP ?= $(TOOLCHAIN_PREFIX)strip
# more cases (e.g. ld.gold).
LINKER_TYPE := $(shell $(LD) -v 2>&1 | grep -q "LLD" && echo lld || echo bfd)
$(info LINKER_TYPE=$(LINKER_TYPE))
# Detect whether we are compiling with GCC or Clang
COMPILER_TYPE := $(shell $(CC) -v 2>&1 | grep -q "clang version" && echo clang || echo gcc)
$(info COMPILER_TYPE=$(COMPILER_TYPE))
# Now that CC is defined we can check if warning flags are supported and add
# them to GLOBAL_COMPILEFLAGS if they are.