Skip to content

Commit

Permalink
build: Edit clang condition to utilize cpp version instead of OS version
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
thatcomputerguy0101 committed Oct 15, 2023
1 parent 288560a commit 166180f
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 166180f

Please sign in to comment.