]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools:copy the common PcdValueCommon.c to output directory
authorFan, ZhijuX <zhijux.fan@intel.com>
Wed, 11 Mar 2020 09:51:21 +0000 (17:51 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 12 Mar 2020 02:02:55 +0000 (02:02 +0000)
REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2568

PcdValueInit shares the same Edk2\BaseTools\Source\C\PcdValueCommon.c.
To avoid the conflict, it should copy this file to its output directory,
If so, PcdValueCommon.c file will be private for PcdValueInit

Cc: Liming Gao <liming.gao@intel.com>
Cc: Bob Feng <bob.c.feng@intel.com>
Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
BaseTools/Source/Python/Workspace/DscBuildData.py

index 476c7edaf9da6852f58ae3ccbe585d11939c7307..6d32b63cd19dfb04942575052fac1e67e16c588c 100644 (file)
@@ -55,6 +55,7 @@ def _IsFieldValueAnArray (Value):
     return False\r
 \r
 PcdValueInitName = 'PcdValueInit'\r
+PcdValueCommonName = 'PcdValueCommon'\r
 \r
 PcdMainCHeader = '''\r
 /**\r
@@ -2634,10 +2635,10 @@ class DscBuildData(PlatformBuildClassObject):
 \r
         MakeApp = PcdMakefileHeader\r
         if sys.platform == "win32":\r
-            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + 'INC = '\r
+            MakeApp = MakeApp + 'APPFILE = %s\%s.exe\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s\%s.obj %s.obj\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + 'INC = '\r
         else:\r
             MakeApp = MakeApp + PcdGccMakefile\r
-            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon"))) + \\r
+            MakeApp = MakeApp + 'APPFILE = %s/%s\n' % (self.OutputPath, PcdValueInitName) + 'APPNAME = %s\n' % (PcdValueInitName) + 'OBJECTS = %s/%s.o %s.o\n' % (self.OutputPath, PcdValueInitName, os.path.join(self.OutputPath, PcdValueCommonName)) + \\r
                       'include $(MAKEROOT)/Makefiles/app.makefile\n' + 'INCLUDE +='\r
 \r
         IncSearchList = []\r
@@ -2742,6 +2743,14 @@ class DscBuildData(PlatformBuildClassObject):
         IncFileList = GetDependencyList(IncludeFileFullPaths, SearchPathList)\r
         for include_file in IncFileList:\r
             MakeApp += "$(OBJECTS) : %s\n" % include_file\r
+        if sys.platform == "win32":\r
+            PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source\C\Common\PcdValueCommon.c"))\r
+            MakeApp = MakeApp + '%s\PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath)\r
+            MakeApp = MakeApp + '\tcopy /y %s $@\n' % (PcdValueCommonPath)\r
+        else:\r
+            PcdValueCommonPath = os.path.normpath(mws.join(GlobalData.gGlobalDefines["EDK_TOOLS_PATH"], "Source/C/Common/PcdValueCommon.c"))\r
+            MakeApp = MakeApp + '%s/PcdValueCommon.c : %s\n' % (self.OutputPath, PcdValueCommonPath)\r
+            MakeApp = MakeApp + '\tcp -f %s %s/PcdValueCommon.c\n' % (PcdValueCommonPath, self.OutputPath)\r
         MakeFileName = os.path.join(self.OutputPath, 'Makefile')\r
         MakeApp += "$(OBJECTS) : %s\n" % MakeFileName\r
         SaveFileOnChange(MakeFileName, MakeApp, False)\r