summaryrefslogtreecommitdiffstats
path: root/BaseTools/Source/Python/AutoGen
Commit message (Collapse)AuthorAgeFilesLines
* BaseTools/Source/Python: New Target/ToolChain/Arch in DSC [BuildOptions]Michael D Kinney2021-04-292-36/+129
| | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3359 Update BaseTools to support new build targets, new tool chains, and new architectures declared in DSC file [BuildOptions] sections. * Do not expand * when tools_def.txt is parsed. Only expand when both tools_def.txt and DSC [BuilsOptions] sections have been parsed. This also requires more flexible matching of tool keys that contain * in tool key fields. * Pre-scan the platform DSC file for FAMILY and TOOLCHAIN declarations DSC in [BuildOptions] sections before the FAMILY and TOOLCHAIN need to be known. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/GenMake: Sort generated makefile tool definitionsMichael D Kinney2021-04-271-4/+8
| | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3353 Sort the tool definition content of generated makefiles to help verify that makefile contents have not changed after BaseTools code changes. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools/Source/Python: Verify TAB_TOD_DEFINES_FAMILY key presentMichael D Kinney2021-04-232-5/+15
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3344 Veify that TAB_TOD_DEFINES_FAMILY key is present in ToolDef dictionary before access. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools/PlatformAutoGen: MAKE_FLAGS and MAKE_PATH fixesMichael D Kinney2021-04-141-15/+21
| | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3312 Update parsing of MAKE_FLAGS in DSC [BuildOptions] sections to split the flags into a list to be compatible with running the make command using Popen(). Parsing MAKE_FLAGS from tools_def.txt already uses _SplitOption(). This change uses the same _SplitOption() method for MAKE_FLAGS from a DSC [BuildOptions] section. Also update the parsing of MAKE_PATH to support MAKE_PATH from tools_def.txt or the DSC [BuildOptions] section. MAKE_PATH in DSC [BuildOptions] section is higher priority than MAKE_PATH in tools_def.txt. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix the improper error loggingIrene Park2021-01-061-1/+1
| | | | | | | | | EdkLogger.ERROR() was replaced with EdkLogger.error() to deliver the expected error message when an error occurs. Signed-off-by: Irene Park <ipark@nvidia.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Should always define PCD TOKEN value as Zero for static PCDYunhua Feng2020-12-231-2/+1
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=3120 FixedAtBuild, PatchableInModule and FeatureFlag PCD don't use PCD TOKEN. Their PCD TOKEN value can always be zero. AutoGen.h will not be changed when static PCD is added or removed. Dynamic PCD add or remove will still cause dynamic PCD token value be changed. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Signed-off-by: Yunhua Feng <fengyunhua@byosoft.com.cn> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Resolve index out of range errors.Mingyue Liang2020-11-191-1/+2
| | | | | | | | | | | | | | | | | | | | This problem is generated by solving bz2972's patch, and the commit ID is 0af7f8e6a9253960ba820cd6ddfd8c36543d30cb. This is a problem when updating the DEPs file. The code does not consider that there is only one line of content in the file, so the filter condition is added to prevent the index from exceeding the range. Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Limit command line length.Mingyue Liang2020-11-102-9/+44
| | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2528 Currently, CL command contains multiple C files will be compiled, and that caused command line too long, which may trigger build error. In order to solve this issue, the following rules is used in this scene: If the number of C files is greater than one, a txt file will be used to record these C files, and replaces the corresponding content in command line with the file name. Else (only one C file listed in the command line), the length of the whole CL command line will determine whether use a file to record. If the length exceeds the limited max length, use the recording file; else C file name directly listed in the command line Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Enable Module Scope Structure PcdBob Feng2020-11-054-8/+19
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2648 This patch is to enable the Module scoped Structure Pcd usage. User can set structure pcd field value in module scope. For example, under the [components] section of a dsc file, user can override some field value for a specific module. Package/Module.inf{ <PcdsFixedAtBuild> gUefiTokenSpaceGuid.StructurePcdModule.FieldName | 5 } Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Tested-by: Liming Gao <gaoliming@byosoft.com.cn> Acked-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Add EDKII_DSC_PLATFORM_GUID MACROfengyunhua2020-10-131-0/+3
| | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2969 Add EDKII_DSC_PLATFORM_GUID MACRO to AutoGen.h and AutoGen.c Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Signed-off-by: Yunhua Feng <fengyunhua@byosoft.com.cn> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Tested-by: Michael Kubacki <michael.kubacki@microsoft.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn>
* BaseTools: Remove CanSkip calling for incremental buildBob Feng2020-09-251-3/+0
| | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2978 If a module add a new PCD, the pcd token number will be reassigned. The new Pcd token number should be updated to all module's autogen files. CanSkip can only detect a single module's change but not others. CanSkip block the pcd token number update in incremental build, so this patch is going to remove this call. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Yuwei Chen<yuwei.chen@intel.com>
* BaseTools: Normalize case of pathname when evaluating Macros.Mingyue Liang2020-09-251-2/+4
| | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2880 Currently, When doing the Incremental build, the directory macros extended to absolute path in output Makefile, which is inconsistent with the output of Clean build. When we do macro replacement, we can't replace macro due to inconsistent path case, which results in inconsistent display of incremental build and clean build in makefile.Therefore, the path is converted to achieve the correct macro replacement. Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools: Add included files to deps_target file.Mingyue Liang2020-09-251-3/+1
| | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2882 After changing the name of the include source file, when doing incremental build, the previous source file is not covered in the. DEPs file, and a build error occurs. The root cause is that the build tools filter out some dependency files, which are listed in inf source section, from the deps_target file. Add those files back to deps_target file to resolve the above problem. Signed-off-by: Mingyue Liang <mingyuex.liang@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com>
* BaseTools: Sort the Pcd set when generating the VPD binaryBob Feng2020-09-081-1/+1
| | | | | | | | | | | | | | If VPD PcdNvStoreDefaultValueBuffer is used, all DynamicHii and DynamicExHii PCD value will be generated into that VPD. In order to generate the same VPD binary file in every build, sort the Pcd set when generating VPD. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <gaoliming@byosoft.com.cn> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Liming Gao <gaoliming@byosoft.com.cn> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools: fix ucs-2 lookup on python 3.9Cole Robinson2020-08-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | python3.9 changed/fixed codec.register behavior to always replace hyphen with underscore for passed in codec names: https://bugs.python.org/issue37751 So the custom Ucs2Search needs to be adapted to handle 'ucs_2' in addition to existing 'ucs-2' for back compat. This fixes test failures on python3.9, example: ====================================================================== FAIL: testUtf16InUniFile (CheckUnicodeSourceFiles.Tests) ---------------------------------------------------------------------- Traceback (most recent call last): File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Python/AutoGen/UniClassObject.py", line 375, in PreProcess FileIn = UniFileClassObject.OpenUniFile(LongFilePath(File.Path)) File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Python/AutoGen/UniClassObject.py", line 303, in OpenUniFile UniFileClassObject.VerifyUcs2Data(FileIn, FileName, Encoding) File "/builddir/build/BUILD/edk2-edk2-stable202002/BaseTools/Source/Python/AutoGen/UniClassObject.py", line 312, in VerifyUcs2Data Ucs2Info = codecs.lookup('ucs-2') LookupError: unknown encoding: ucs-2 Signed-off-by: Cole Robinson <crobinso@redhat.com> Reviewed-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Move CreateAsBuiltInf into AutoGenWorker for parallelBob Feng2020-08-141-1/+1
| | | | | | | | | | | AsBuiltInf can be created during AutoGen phase. Move CreateAsBuiltInf into AutoGenWorker to make this step run in parallel. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Jaben Carsey <jaben.carsey@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Improve the method of checking queue emptyFeng, Bob C2020-08-071-6/+20
| | | | | | | | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2807 The Queue.empty() method is not reliable in the multiple process runtime environment. This patch uses a new method to check if all modules are processed and workers need to be stopped. That is to add a None item at the bottom of the queue. Worker check if it gets that None item to know if all the module is processed. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Yuwei Chen <yuwei.chen@intel.com> Cc: Lucy Yan <lucyyan@google.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Add Guid name support in GenFfs.Yuwei Chen2020-07-171-0/+24
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2762 The Fv Section in the FDF files use hard coding Guid values which is inconvenient to manage. This patch adds Guid name support in GenFfs to solve this problem. Signed-off-by: Yuwei Chen <yuwei.chen@intel.com> Reviewed-by: Bob Feng<bob.c.feng@intel.com>
* BaseTools: Fix string concatenationPierre Gondois2020-07-021-1/+1
| | | | | | | | | | | | | | | | Using Python 3.7.2 on win32, when printing a FileBuildRule instance, the following error occurs: File "edk2\BaseTools\Source\Python\AutoGen\BuildEngine.py", line 177, in __str__ DestString = ", ".join(self.DestFileList) TypeError: sequence item 0: expected str instance, PathClass found This patch converts each PathClass element of the list to a string instance before concatenating them. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Generate multiple rules when multiple output filesPierre Gondois2020-07-022-17/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch modifies the Makefile generation not to stop adding Makfile rules when the first final target is found. E.g.: If the following rules are described in build_rule.txt: -[Rule1]: .X files generate .Y and .Z files; -[Rule2]: .Z files generate .Z1 files. Currently, if a File1.X file was part of the sources of a module, only [Rule1] would be generated in the Makefile. Indeed, there are no rules to apply to .Y files: .Y files are a final target. However, there is still [Rule2] to apply to .Z files. This patch also adds a dependency between the first ouput file of a rule and the other output files. For instance, with the same example as above, File1.Y and File1.Z are generated by the following rule: File1.Y: File1.X <Generate File1.Y> <Generate File1.Z> and the new dependency is: File1.Z: File1.Y This is necessary to keep a dependency order during the execution of the Makefile. Indeed, .Y and .Z files are generated by the execution of a common set of commands, and without this rule, there is no explicit dependency relation between them. Signed-off-by: Pierre Gondois <Pierre.Gondois@arm.com> Suggested-by: Tomas Pilar <Tomas.Pilar@arm.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools:GuidedSectionTools.txt is not generated correctlyFan, ZhijuX2020-03-311-1/+2
| | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2538 For LzmaCompress or BrotliCompress, the platform may use the different options and add their batch file, such as LzmaCompressPlatform. Then, specify it in platform.dsc [BuildOptions] to override the default one in tools_def.txt. *_*_*_LZMA_PATH = LzmaCompressPlatform This override tool will be used. But, its name is not specified in the generated GuidedSectionTools.txt. Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools:Fix build tools print traceback info issueFan, ZhijuX2020-03-241-3/+0
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2610 We meet a case that the DEC file declaring the PCD isn't included in the INF.it cause build tools report Traceback error. Remove raise statements that generate Tracebacks that were only intended for development/debug. With the raise statements removed proper error messages are shown. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Remove invalid leading space before !INCLUDE in MakefileBob Feng2020-03-021-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2563 This patch is to fix a incremental build regression bug which happen when using nmake. That's introduced by 818283de3f6d. If there is white space before !INCLUDE instruction, nmake will not process it. Source code's dependent header files are listed in ${deps_file} file, if it's not included successfully, nmake will not detect the change of those header file. This patch has been verified in Windows with VS2015 and Linux with GCC5. The header file add/modify/delete can trig the incremental build with this fix. There is no impact on the clean build. Cc: Andrew Fish <afish@apple.com> Cc: Laszlo Ersek <lersek@redhat.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Acked-by: Laszlo Ersek <lersek@redhat.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Tested-by: Liming Gao <liming.gao@intel.com>
* BaseTools:build failure in CLANGPDB tool chainFan, ZhijuX2020-02-131-0/+2
| | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2520 Incremental build failure in CLANGPDB tool chain on Windows host The build failure is like below when do incremental build. The root cause is in generated deps_target file. It has one line ":". Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Remove caret in NASM_INC macroPierre Gondois2020-02-121-3/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | NASM_INC contains the list of directory to include when using the nasm assembler. In nmake makefiles, a trailing backslash escapes the newline char and replaces it with a space ' '. To have a literal trailing backslash, it must be escaped with a caret '^'. This is not necessary for GNU makefiles. On windows platforms, for the NASM_INC macro, a caret escaping a trailing a backslash was appended to the last included folder regardless of the makefile type. For instance, "/Include/" was replaced by "/Include/^\". This is causing a build failure on windows platforms using GNU makefiles since the caret '^' doesn't escape any chars in GNU makefiles and is thus conserved. "/Include^\" was replaced by "/Include\/" in nmake makefiles, but remained "/Include/^\" in GNU makefiles. This patch removes the caret '^' on the build using GNU makefiles. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Rationalise makefile generationPierre Gondois2020-02-123-84/+101
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The GenMake.py script tests the platform environment to determine the type of makefile that needs to be generated. If a Windows build host is detected, the makefile generated is of Nmake type. Otherwise a GNUmake type is generated. Furthermore, the <TARGET>_<TAGNAME>_<ARCH>_MAKE_PATH option in tools_def.template defines the make tool to use. E.g.: for VS2017 this is configured to use Nmake, cf. *_VS2017_*_MAKE_PATH = DEF(VS2017_BIN_HOST)\nmake.exe while for GCC5 it is setup to use GNU make. *_GCC5_*_MAKE_PATH = DEF(GCC_HOST_PREFIX)make This prevents using the GCC compiler toolchain on a Windows build host. To address this issue this patch introduces 2 factors to determine the generated makefile output. 1. Platform -> to determine shell commands used in makefile. 2. MakeTool -> to determine the type of makefile that needs to be generated. Signed-off-by: Pierre Gondois <pierre.gondois@arm.com> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fixed a Incremental build issueBob Feng2020-02-091-1/+1
| | | | | | | | | | The .map file is not update to FFS_OUTPUT_DIR folder in the incremental build. Signed-off-by: Guo Dong <guo.dong@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Fixed a incremental build bugBob Feng2020-01-192-3/+11
| | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2451 If removing a header file from source code and file system, the incremental build will fail. This patch is to fix this issue by setting each header file as a target without any actions in makefile. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools:Fix GenFds issue for BuildOption replace GenFdsOptionFan, ZhijuX2020-01-131-19/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2455 BuildOption is used by TargetTxtClassObj.py GenFdsOption is used by GenFds.py When the GenFds tool is used alone (e.g. python3 -m GenFds.GenFds -h) With the OptionParser function, the first detected function prints the help message import TargetTxtClassObj to GenFds, The BuildOption will be executed and replace GenFdsOption We removed all objects associated with this problem that were created directly during the import process (e.g. BuildOption, BuildTarget = MyOptionParser(), TargetTxt = TargetTxtDict()) The Patch is going to fix this issue Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix build failure when multiple build targets givenBob Feng2019-12-182-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2371 This patch is to fix a regression issue that build fails if multiple build targets given. Two changes cause this regression issue. One is AutoGen object __hash__ function only hash file path and arch, missing ToolChain and build target. The other is changing the multiple-thread-genfds function as default build behavior. To generate the genffs command to Makefile, there is a global data set is used, GenFdsGlobalVariable, which cause build tool use the data of first build-target build in the second build-target build. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Steven Shi <steven.shi@intel.com> Cc: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Remove redundant binary cache fileSteven Shi2019-12-101-29/+0
| | | | | | | | | | | | | Redesign the binary cache and not need to save the cache intermediate result and state in memory as a ModuleBuildCacheIR class instance. So remove the CacheIR.py which define the ModuleBuildCacheIR class. Signed-off-by: Steven Shi <steven.shi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Leverage compiler output to optimize binary cacheSteven Shi2019-12-104-644/+581
| | | | | | | | | | | | | | | | | Redesign the binary cache and bases on the compiler to output the dependency header files info for every module. The binary cache will directly consume the dependency header files info and doesn't parse the C source code by iteself. Also redesign the dependency files list format for module and try to share the common lib hash result as more as possible in local process. Remove the unnecessary share data access across multiprocessing. Signed-off-by: Steven Shi <steven.shi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: enhance the CacheCopyFile method arg namesSteven Shi2019-12-101-3/+3
| | | | | | | | | | | Enhance the CacheCopyFile method arg names to be more clear and readable Signed-off-by: Steven Shi <steven.shi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: store more complete output files in binary cacheSteven Shi2019-12-101-16/+4
| | | | | | | | | | | | | Binary cache use the OutputFile method to return the module built output files needed to store in cache, but current OutputFile implementation doesn't return complete output files. Enhance the OutputFile method to return more complete output files. Signed-off-by: Steven Shi <steven.shi@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Enhance Basetool for incremental buildBob Feng2019-12-103-59/+331
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2311 Include dependency file in Makefile to enhance incremental build Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Steven Shi <steven.shi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Avoid "is" with a literal Python 3.8 warningsPhilippe Mathieu-Daude2019-12-061-1/+1
| | | | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2304 The following statement produces a SyntaxWarning with Python 3.8: if str(FdRegion.RegionType) is 'FILE' and self.Platform.VpdToolGuid in \ str(FdRegion.RegionDataList): BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py:168: SyntaxWarning: \ "is" with a literal. Did you mean "=="? Change the 'is' operator by the conventional '==' comparator. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools:Add [packages] section in dsc fileFan, ZhijuX2019-11-203-6/+25
| | | | | | | | | | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=2270 Currently a PCD (e.g. FeaturePCD) cannot be used in a conditional statement in a DSC/FDF file without a module in the build referencing the PCD package DEC file. An example implementation that to support this is to allow a [Packages] section in the DSC file to list additional package dependencies for PCD references in the package DSC/FDF files. this patch is going to add the ability to have the [packages] section defined in the DSC file Cc: Liming Gao <liming.gao@intel.com> Cc: Bob Feng <bob.c.feng@intel.com> Signed-off-by: Zhiju.Fan <zhijux.fan@intel.com> Acked-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix an incremental build issue caused by macro in #includeLin, Derek (HPS SW)2019-10-181-7/+11
| | | | | | | | | | | | | | | | When c/h file use macro after #include, for example, In this case, GenMake is not able to create a healthy dependency for the c file. GenMake used to add $(FORCE_REBUILD) dependency in the c file, this guarantee the c file is always compiled in incremental build. But, this function is broken since 05217d210e8da37b47d0be58ec363f7af2fa1c18 which enable /MP for MSVC compiler, in order to compile multiple c files in one command multi-processing. The fix here is adding '$(FORCE_REBUILD)' back to retain the original function. Line number 1728 and 978 are the code pieces which handle this logic. Signed-off-by: Derek Lin <derek.lin2@hpe.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: add missing newlines at end of filesLeif Lindholm2019-10-041-1/+1
| | | | | | | | | | | | Some scripts in Source/Python were missing newlines at end of files, so add them. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Leif Lindholm <leif.lindholm@linaro.org> Reviewed-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>
* BaseTools: Fix GenMake multi-workspace failureKubacki, Michael A2019-10-041-3/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | REF:https://bugzilla.tianocore.org/show_bug.cgi?id=2232 Commit 0075ab2cec introduced an issue that causes an exception when multiple workspace packages paths are specified. For example, if edk2-platforms is used, the root directory will contain an edk and edk2-platforms directory representing the respective repositories. In GenMake, the path to the package DEC file for a module is discovered by getting the relative path of the INF to the workspace root directory. Each directory in the relative path is incrementally joined to the WORKSPACE directory. The file list in the joined path is searched for a DEC file. As an example, if the build command is used on a package outside the edk2 repository, the INF file path is relative to the edk2-platforms directory not edk2. This causes directory paths to be built that do not exist. Commit 0075ab2cec replaced the os.path.exists() call with a try except block that always fails when os.listdir() is invoked to enumerate the list of files in the built directory path on packages outside edk2. This commit restores the original conditional statement which avoids calling os.listdir() with an invalid directory path. Cc: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Signed-off-by: Michael Kubacki <michael.a.kubacki@intel.com> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com> Reviewed-by: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Fix the lib order in static_library_files.lstFeng, Bob C2019-09-291-1/+1
| | | | | | | | | | | | | | | | | | | | | Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=2216 This patch is going to fix the lib order in static_library_files.lst. This issue is introduced by commit 673d09a2dd. Before 673d09a2dd, build tool apply build rule for the module's library firstly and then apply build rule for module itself. Now, build tool apply build rule for module self and then for its library. That behavior impact the lib order in static_library_files.lst. This patch is to call module's LibraryAutoGenList function explicitly, where the applying build rule action for library is triggered. Cc: Liming Gao <liming.gao@intel.com> Cc: dann frazier <dann.frazier@canonical.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Tested-by: dann frazier <dann.frazier@canonical.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: init DependencyHeaderFileSet for each MakeFile classFeng, Bob C2019-09-241-1/+5
| | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2203 This patch is going to fix a regression issue that build breaks when the custom makefile exist. Cc: Liming Gao <liming.gao@intel.com> Cc: Steven Shi <steven.shi@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* Revert "BaseTools: Improve GetDependencyList function"Liming Gao2019-09-211-16/+13
| | | | | | | | | | This reverts commit bc9e4194cf3edaf9524c83098ba3f72008c70190. This change causes the dependent header files are missing in Makefile. It makes the incremental build not work. So, revert this change. Cc: Bob Feng<bob.c.feng@Intel.com> Signed-off-by: Liming Gao <liming.gao@intel.com> Reviewed-by: Bob Feng<bob.c.feng@Intel.com>
* BaseTools: remove unnecessary calls of os.existFeng, Bob C2019-09-175-60/+63
| | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2101 This patch is going to remove unnecessary calls of os.exist() Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Improve GetDependencyList functionFeng, Bob C2019-09-171-13/+16
| | | | | | | | | | | | | | | | REF: https://bugzilla.tianocore.org/show_bug.cgi?id=2102 GetDependencyList get the header file via re.findall in the whole header file. This patch is to pre-process the header file and to feed the shorter string to re.findall. This patch is to improve GetDependencyList() efficiency Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools:change some incorrect parameter defaultsFan, ZhijuX2019-09-172-3/+7
| | | | | | | | | | | | | | | BZ:https://bugzilla.tianocore.org/show_bug.cgi?id=1858 for Dict={},There are pitfalls in the way this default parameter is set and Dict is not used in functions, other functions have these two cases, I will change some incorrect parameter defaults This patch is going to fix this issue 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: Bob Feng <bob.c.feng@intel.com>
* BaseTools: Enable --genfds-multi-thread to default buildFeng, Bob C2019-09-112-4/+3
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1302 This patch enable --genfds-multi-thread to default build. This patch keep --genfds-multi-thread build option for compatibility and also add a new build option to disable genfds-multi-thread as --no-genfds-multi-thread. Cc: Liming Gao <liming.gao@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Fixed the bug of multi-thread genffs for override infFeng, Bob C2019-09-112-2/+2
| | | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=1302 If there is a inf override, and multi-thread genffs is enabled, build will fail. This patch is going to fix this bug. Cc: Liming Gao <liming.gao@intel.com> Cc: Steven Shi <steven.shi@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Sort Pcd settings to make PcdTokenNumber be fixedFeng, Bob C2019-09-101-1/+2
| | | | | | | | | | | | BZ: https://bugzilla.tianocore.org/show_bug.cgi?id=2147 This patch is to sort the Pcd settings so that PcdTokenNumber will not change if the platform's Pcd settings are the same. Signed-off-by: Bob Feng <bob.c.feng@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Steven Shi <steven.shi@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com>
* BaseTools: Fixed issue for IgnoreAutoGenFeng, Bob C2019-09-105-4/+34
| | | | | | | | | | | | | https://bugzilla.tianocore.org/show_bug.cgi?id=2080 This patch is to improve build -u option to re-use GlobalVar_<platformguid>_<arch>.bin file which is introduced by multiple-process-autogen feature. Cc: Liming Gao <liming.gao@intel.com> Cc: Steven Shi <steven.shi@intel.com> Signed-off-by: Bob Feng <bob.c.feng@intel.com> Acked-by: Liming Gao <liming.gao@intel.com>