Blame SOURCES/edk2-BaseTools-Source-C-split-O2-to-BUILD_OPTFLAGS.patch

cc9195
From bd8f7996e759b1aa2549efc6062dbed8ac9b8dcb Mon Sep 17 00:00:00 2001
cc9195
From: Laszlo Ersek <lersek@redhat.com>
cc9195
Date: Wed, 29 Aug 2018 17:12:00 +0200
cc9195
Subject: [PATCH 3/7] BaseTools/Source/C: split "-O2" to BUILD_OPTFLAGS
cc9195
cc9195
Message-id: <20180829151204.26958-4-lersek@redhat.com>
cc9195
Patchwork-id: 81961
cc9195
O-Subject:  [RHEL8/virt212 edk2 PATCH 3/7] BaseTools/Source/C: split "-O2" to
cc9195
	BUILD_OPTFLAGS
cc9195
Bugzilla: 1607906
cc9195
Acked-by: Thomas Huth <thuth@redhat.com>
cc9195
Acked-by: Vitaly Kuznetsov <vkuznets@redhat.com>
cc9195
cc9195
The option "-O2" is not a preprocessor flag, but a code generation
cc9195
(compilation) flag. Move it from BUILD_CPPFLAGS to BUILD_CFLAGS and
cc9195
BUILD_CXXFLAGS.
cc9195
cc9195
Because "VfrCompile/GNUmakefile" uses "-O2" through BUILD_CPPFLAGS, and
cc9195
because it doesn't use BUILD_CXXFLAGS, we have to introduce BUILD_OPTFLAGS
cc9195
separately, so that "VfrCompile/GNUmakefile" can continue using just this
cc9195
flag.
cc9195
cc9195
This patch doesn't change behavior.
cc9195
cc9195
Cc: Liming Gao <liming.gao@intel.com>
cc9195
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
cc9195
Ref: https://bugzilla.redhat.com/show_bug.cgi?id=1540244
cc9195
Contributed-under: TianoCore Contribution Agreement 1.1
cc9195
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
cc9195
Reviewed-by: Liming Gao <liming.gao@intel.com>
cc9195
(cherry picked from commit b8a66170264395edeaa61e6d22930a58e576a685)
cc9195
---
cc9195
 BaseTools/Source/C/Makefiles/header.makefile |  6 +++++-
cc9195
 BaseTools/Source/C/VfrCompile/GNUmakefile    | 11 +++++++----
cc9195
 2 files changed, 12 insertions(+), 5 deletions(-)
cc9195
cc9195
diff --git a/BaseTools/Source/C/Makefiles/header.makefile b/BaseTools/Source/C/Makefiles/header.makefile
cc9195
index 08421ba..498c6cf 100644
cc9195
--- a/BaseTools/Source/C/Makefiles/header.makefile
cc9195
+++ b/BaseTools/Source/C/Makefiles/header.makefile
cc9195
@@ -68,7 +68,8 @@ $(error Bad HOST_ARCH)
cc9195
 endif
cc9195
 
cc9195
 INCLUDE = $(TOOL_INCLUDE) -I $(MAKEROOT) -I $(MAKEROOT)/Include/Common -I $(MAKEROOT)/Include/ -I $(MAKEROOT)/Include/IndustryStandard -I $(MAKEROOT)/Common/ -I .. -I . $(ARCH_INCLUDE) 
cc9195
-BUILD_CPPFLAGS = $(INCLUDE) -O2
cc9195
+BUILD_CPPFLAGS = $(INCLUDE)
cc9195
+BUILD_OPTFLAGS = -O2
cc9195
 ifeq ($(DARWIN),Darwin)
cc9195
 # assume clang or clang compatible flags on OS X
cc9195
 BUILD_CFLAGS = -MD -fshort-wchar -fno-strict-aliasing -Wall -Werror -Wno-deprecated-declarations -Wno-self-assign -Wno-unused-result -nostdlib -g
cc9195
@@ -91,6 +92,9 @@ ifeq ($(DARWIN),Darwin)
cc9195
 endif
cc9195
 endif
cc9195
 
cc9195
+# keep BUILD_OPTFLAGS last
cc9195
+BUILD_CFLAGS   += $(BUILD_OPTFLAGS)
cc9195
+BUILD_CXXFLAGS += $(BUILD_OPTFLAGS)
cc9195
   
cc9195
 .PHONY: all
cc9195
 .PHONY: install
cc9195
diff --git a/BaseTools/Source/C/VfrCompile/GNUmakefile b/BaseTools/Source/C/VfrCompile/GNUmakefile
cc9195
index c4ec61a..bbe562c 100644
cc9195
--- a/BaseTools/Source/C/VfrCompile/GNUmakefile
cc9195
+++ b/BaseTools/Source/C/VfrCompile/GNUmakefile
cc9195
@@ -25,6 +25,9 @@ OBJECTS = AParser.o DLexerBase.o ATokenBuffer.o EfiVfrParser.o VfrLexer.o VfrSyn
cc9195
 
cc9195
 VFR_CPPFLAGS = -DPCCTS_USE_NAMESPACE_STD $(BUILD_CPPFLAGS)
cc9195
 
cc9195
+# keep BUILD_OPTFLAGS last
cc9195
+VFR_CXXFLAGS = $(BUILD_OPTFLAGS)
cc9195
+
cc9195
 LINKER = $(BUILD_CXX)
cc9195
 
cc9195
 EXTRA_CLEAN_OBJECTS = EfiVfrParser.cpp EfiVfrParser.h VfrParser.dlg VfrTokens.h VfrLexer.cpp VfrLexer.h VfrSyntax.cpp tokens.h
cc9195
@@ -58,16 +61,16 @@ Pccts/dlg/dlg:
cc9195
 	BIN_DIR='.' $(MAKE) -C Pccts/dlg
cc9195
 
cc9195
 ATokenBuffer.o: Pccts/h/ATokenBuffer.cpp
cc9195
-	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
cc9195
+	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
cc9195
 
cc9195
 DLexerBase.o: Pccts/h/DLexerBase.cpp
cc9195
-	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
cc9195
+	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
cc9195
 
cc9195
 AParser.o: Pccts/h/AParser.cpp
cc9195
-	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
cc9195
+	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
cc9195
 
cc9195
 VfrSyntax.o: VfrSyntax.cpp
cc9195
-	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $? -o $@
cc9195
+	$(BUILD_CXX) -c $(VFR_CPPFLAGS) $(INC) $(VFR_CXXFLAGS) $? -o $@
cc9195
 	
cc9195
 clean: localClean
cc9195
 
cc9195
-- 
cc9195
1.8.3.1
cc9195