From 166180f682a910daa2fe7205ae620f5f936bdff1 Mon Sep 17 00:00:00 2001 From: thatcomputerguy0101 Date: Sun, 15 Oct 2023 16:59:29 -0400 Subject: [PATCH] build: Edit clang condition to utilize cpp version instead of OS version Rather than detecting if the host is using Darwin, the cpp version script now checks if it's version report includes clang, at which point it will replace cpp with clang (in preprocessor mode). This is slightly less intrusive then the previous iteration as the regular flow of the script is maintained for most operating systems and `CPP` is only changed when needed. Signed-off-by: Alan Everett --- Makefile | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 975275eb9c82..700c200914df 100644 --- a/Makefile +++ b/Makefile @@ -18,14 +18,13 @@ LD=$(CROSS_PREFIX)ld OBJCOPY=$(CROSS_PREFIX)objcopy OBJDUMP=$(CROSS_PREFIX)objdump STRIP=$(CROSS_PREFIX)strip +CPP=cpp PYTHON=python3 -UNAME_S := $(shell uname -s) -ifeq ($(UNAME_S),Darwin) -# cpp on MacOS forces a specific input directory, so directly use clang instead +CPP_VERSION := $(shell $(CPP) --version) +ifeq ($(findstring clang,$(CPP_VERSION)),clang) +# The clang version of cpp forces a specific input directory, so directly use clang instead CPP=clang -E -else -CPP=cpp endif # Source files