diff options
author | Pierre Gondois <pierre.gondois@arm.com> | 2020-07-01 22:06:01 +0800 |
---|---|---|
committer | mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> | 2020-07-02 10:09:17 +0000 |
commit | 6511277827fd33023418e2ee72d6ab2b89a925f9 (patch) | |
tree | ea339a438c7c3317771b33cafd6daa85ccaa9e4e /BaseTools/Source/Python/AutoGen/GenMake.py | |
parent | 01356d2963fcd9ff90166674d054e17d265e0a5f (diff) | |
download | edk2-6511277827fd33023418e2ee72d6ab2b89a925f9.tar.gz edk2-6511277827fd33023418e2ee72d6ab2b89a925f9.tar.bz2 edk2-6511277827fd33023418e2ee72d6ab2b89a925f9.zip |
BaseTools: Generate multiple rules when multiple output files
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>
Diffstat (limited to 'BaseTools/Source/Python/AutoGen/GenMake.py')
-rwxr-xr-x | BaseTools/Source/Python/AutoGen/GenMake.py | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/BaseTools/Source/Python/AutoGen/GenMake.py b/BaseTools/Source/Python/AutoGen/GenMake.py index bbb3c29446..0314d0ea34 100755 --- a/BaseTools/Source/Python/AutoGen/GenMake.py +++ b/BaseTools/Source/Python/AutoGen/GenMake.py @@ -1054,6 +1054,12 @@ cleanlib: TargetDict = {"target": self.PlaceMacro(T.Target.Path, self.Macros), "cmd": "\n\t".join(T.Commands),"deps": Deps}
self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(TargetDict))
+ # Add a Makefile rule for targets generating multiple files.
+ # The main output is a prerequisite for the other output files.
+ for i in T.Outputs[1:]:
+ AnnexeTargetDict = {"target": self.PlaceMacro(i.Path, self.Macros), "cmd": "", "deps": self.PlaceMacro(T.Target.Path, self.Macros)}
+ self.BuildTargetList.append(self._BUILD_TARGET_TEMPLATE.Replace(AnnexeTargetDict))
+
def ParserCCodeFile(self, T, Type, CmdSumDict, CmdTargetDict, CmdCppDict, DependencyDict):
if not CmdSumDict:
for item in self._AutoGenObject.Targets[Type]:
|