Hello,

I am trying to change my top-level FDF file layout by conditionally including an FDF depending on a build time define being passed or not. The behavior I am seeing is as follows.

  1. I am passing the build time define and the included fdf.inc file gets included.
  2. I am not passing the build time define and the included fdf.inc file still gets included apparently.
    1. However, there is a strange behavior which is that in the conditional block if I have anything else other than the !include statement, it gets ignored.
    2. But if there is a !include statement inside a conditional (which should fail) the include statement is still processed.
Conditional statement in top-level fdf is:

!ifdef $(BUILD_PLATFORM_XYZ)
  !include Platform/NVIDIA/XYZ.fdf.inc
!endif

When we do not pass in -D BUILD_PLATFORM_XYZ during build, Platform/NVIDIA/XYZ.fdf.inc file should not be included as it could be totally absent as well. However, the build system tries to include the file and fails with the following log.

(Python 3.5.2 on linux) Traceback (most recent call last):
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2586, in Main
    MyBuild.Launch()
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2381, in Launch
    self._MultiThreadBuildPlatform()
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2231, in _MultiThreadBuildPlatform
    Wa, self.BuildModules = self.PerformAutoGen(BuildTarget,ToolChain)
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/BinWrappers/PosixLike/../../Source/Python/build/build.py", line 2096, in PerformAutoGen
    self.Progress
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py", line 43, in __init__
    self._InitWorker(Workspace, MetaFile, Target, Toolchain, Arch, *args, **kwargs)
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py", line 112, in _InitWorker
    self.ProcessModuleFromPdf()
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py", line 188, in ProcessModuleFromPdf
    if self.FdfProfile:
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/Common/caching.py", line 28, in __get__
    Value = obj.__dict__[self._function.__name__] = self._function(obj)
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/AutoGen/WorkspaceAutoGen.py", line 164, in FdfProfile
    Fdf.ParseFile()
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/GenFds/FdfParser.py", line 1312, in ParseFile
    self.Preprocess()
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/GenFds/FdfParser.py", line 1291, in Preprocess
    self.PreprocessIncludeFile()
  File "/media/ashishsingha/Workspace/UEFI/out/nvidia/bootloader/uefi/BaseTools/Source/Python/GenFds/FdfParser.py", line 625, in PreprocessIncludeFile
    self.FileName, self.CurrentLineNumber)
GenFds.FdfParser.Warning: The include file does not exist under below directories:
<Here it lists the root diectories included in the build>.
<Here it lists the line and column number of top level fdf file which has include statement for Platform/NVIDIA/XYZ.fdf.inc but under a conditional as mentioned above.

Any help getting around this if you think I am checking for the conditional incorrectly or checking the build script for a potential bug would be highly appreciated.

Thanks
Ashish




This email message is for the sole use of the intended recipient(s) and may contain confidential information.  Any unauthorized review, use, disclosure or distribution is prohibited.  If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.