Rebecca Cran 728ff1da33 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>
2023-04-05 15:44:48 +00:00

36 lines
809 B
Makefile

## @file
# GNU/Linux makefile for 'DevicePath' module build.
#
# Copyright (c) 2017, Intel Corporation. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
#
ARCH ?= IA32
MAKEROOT ?= ..
APPNAME = DevicePath
OBJECTS = DevicePath.o UefiDevicePathLib.o DevicePathFromText.o DevicePathUtilities.o
include $(MAKEROOT)/Makefiles/app.makefile
GCCVERSION = $(shell $(CC) -dumpversion | awk -F'.' '{print $$1}')
CLANG := $(shell $(CC) --version | grep clang)
ifneq ("$(GCCVERSION)", "5")
ifeq ($(CLANG),)
ifneq ($(DARWIN),Darwin)
# gcc 12 trips over device path handling
CFLAGS += -Wno-error=stringop-overflow
endif
endif
endif
LIBS = -lCommon
ifeq ($(CYGWIN), CYGWIN)
LIBS += -L/lib/e2fsprogs -luuid
endif
ifeq ($(LINUX), Linux)
LIBS += -luuid
endif