[edk2-devel] [PATCH edk2-basetools v2 1/1] Change BUILD_CFLAGS to CFLAGS to match edk2 BaseTools change

Rebecca Cran rebecca at bsdio.com
Fri Mar 31 13:48:45 UTC 2023


In order to support building BaseTools using non-default compilers, a
change is being made in the edk2 BaseTools directory to remove the
'BUILD_' prefix to CC, CXX, CFLAGS etc. so developers can for example
run 'make CC=clang CXX=clang++' to build using clang.

Update DscBuildData.py to generate Makefiles with both BUILD_CFLAGS and
CFLAGS for compatibility until everyone is using a version of
edk2 that expects CFLAGS.

Signed-off-by: Rebecca Cran <rebecca at bsdio.com>
---
 edk2basetools/Workspace/DscBuildData.py | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/edk2basetools/Workspace/DscBuildData.py b/edk2basetools/Workspace/DscBuildData.py
index ff5662f35702..f6bf326018c6 100644
--- a/edk2basetools/Workspace/DscBuildData.py
+++ b/edk2basetools/Workspace/DscBuildData.py
@@ -89,7 +89,8 @@ def _IsFieldValueAnArray (Value):
 '''
 
 WindowsCFLAGS = 'CFLAGS = $(CFLAGS) /wd4200 /wd4034 /wd4101 '
-LinuxCFLAGS = 'BUILD_CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '
+LinuxCFLAGS = 'CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '
+LinuxCFLAGS2 = 'BUILD_CFLAGS += -Wno-pointer-to-int-cast -Wno-unused-variable '
 PcdMakefileEnd = '''
 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.common
 !INCLUDE $(BASE_TOOLS_PATH)\Source\C\Makefiles\ms.app
@@ -2891,6 +2892,7 @@ def GenerateByteArrayValue (self, StructuredPcds):
         MakeApp = MakeApp + '\n'
 
         CC_FLAGS = LinuxCFLAGS
+        CC_FLAGS2 = LinuxCFLAGS2
         if sys.platform == "win32":
             CC_FLAGS = WindowsCFLAGS
         BuildOptions = OrderedDict()
@@ -2926,7 +2928,9 @@ def GenerateByteArrayValue (self, StructuredPcds):
             ValueList = [item for item in BuildOptions['COMMON'] if item.startswith((r"/U","-U"))]
             ValueList.extend([item for item in BuildOptions['COMMON'] if item.startswith((r"/D", "-D"))])
             CC_FLAGS += " ".join(ValueList)
+            CC_FLAGS2 += " ".join(ValueList)
         MakeApp += CC_FLAGS
+        MakeApp += "\n" + CC_FLAGS2
 
         if sys.platform == "win32":
             MakeApp = MakeApp + PcdMakefileEnd
-- 
2.34.1



-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.
View/Reply Online (#102311): https://edk2.groups.io/g/devel/message/102311
Mute This Topic: https://groups.io/mt/97973452/1813853
Group Owner: devel+owner at edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub [edk2-devel-archive at redhat.com]
-=-=-=-=-=-=-=-=-=-=-=-




More information about the edk2-devel-archive mailing list