diff options
author | Rebecca Cran <rebecca@quicinc.com> | 2023-02-16 09:34:32 -0700 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2023-04-05 15:44:48 +0000 |
commit | 728ff1da339695ac73e7731d1b5f1d912ab01142 (patch) | |
tree | a80ed4b473a44f4dc3d07737f3ecbb09036835e1 /BaseTools/Source/C/VfrCompile/Pccts | |
parent | 206168e83f0901cbc1815ef5df4ac6598ad9721b (diff) | |
download | edk2-728ff1da339695ac73e7731d1b5f1d912ab01142.zip edk2-728ff1da339695ac73e7731d1b5f1d912ab01142.tar.gz edk2-728ff1da339695ac73e7731d1b5f1d912ab01142.tar.bz2 |
BaseTools: Allow users to build with clang using CC=clang CXX=clang++
In https://bugzilla.tianocore.org/show_bug.cgi?id=2842 clang support was
added by having users specify "make CXX=llvm" when building BaseTools.
The Makefile then sees that and sets CC=$(CLANG_BIN)clang and
CXX=$(CLANG_BIN)clang++. That requires that the executables 'clang' and
'clang++' exist and for example aren't named 'clang-17' and
'clang++-17'. Also, it's an unusual way of specifying the compiler,
since many users will expect to be able to override CC and CXX on the
make command line.
Rework the BaseTools Makefiles removing the 'BUILD_' prefix (BUILD_CC
and BUILD_CXX) and using the standard name 'LDFLAGS' instead of
'LFLAGS'. This allows clang to be used by running
'make -C BaseTools CC=clang CXX=clang++'.
Signed-off-by: Rebecca Cran <rebecca@quicinc.com>
Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
Diffstat (limited to 'BaseTools/Source/C/VfrCompile/Pccts')
-rw-r--r-- | BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile | 6 | ||||
-rw-r--r-- | BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile | 9 |
2 files changed, 8 insertions, 7 deletions
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile index 3bd9b6b..42b6035 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile +++ b/BaseTools/Source/C/VfrCompile/Pccts/antlr/makefile @@ -164,10 +164,10 @@ PCCTS_H=../h #
# UNIX (default)
#
-ifeq ($(CXX), llvm)
+ifneq ($(CLANG),)
CC?=$(CLANG_BIN)clang
-else
-CC?=gcc
+else ifeq ($(origin CC),default)
+CC=gcc
endif
COPT=-O
ANTLR=${BIN_DIR}/antlr
diff --git a/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile b/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile index 6136618..e45ac98 100644 --- a/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile +++ b/BaseTools/Source/C/VfrCompile/Pccts/dlg/makefile @@ -114,10 +114,11 @@ PCCTS_H=../h #
# UNIX
#
-ifeq ($(CXX), llvm)
-BUILD_CC?=$(CLANG_BIN)clang
-else
-BUILD_CC?=cc
+CLANG:=$(shell $(CC) --version | grep clang)
+ifneq ($(CLANG),)
+CC?=$(CLANG_BIN)clang
+else ifeq ($(origin CC),default)
+CC=gcc
endif
COPT=-O
ANTLR=${BIN_DIR}/antlr
|