BaseTools/Scripts: Add python script to run a makefile
authorMichael D Kinney <michael.d.kinney@intel.com>
Wed, 2 Aug 2017 21:16:49 +0000 (14:16 -0700)
committerMichael D Kinney <michael.d.kinney@intel.com>
Fri, 11 Aug 2017 18:21:04 +0000 (11:21 -0700)
commitc8d385265fa38e0933768fccc8dc0bf5b8725037
tree9f76d7019e5da10db4ef046c7d5108707194fff9
parentaf9c4e5e67ab12a77434564ff61c124ef0e5b5dd
BaseTools/Scripts: Add python script to run a makefile

https://bugzilla.tianocore.org/show_bug.cgi?id=670

Add the python script RunMakefile.py that can be used
in a PREBUILD/POSTBUIILD action to invoke a makefile
passing in context as makefile defines.  The command
line arguments passed into RunMakefile.py are converted
to the following set of defines.

* ACTIVE_PLATFORM
* TARGET_ARCH
* TOOL_CHAIN_TAG
* CONF_DIRECTORY
* TARGET
* EXTRA_FLAGS

In addition, a makefile can access the system environment
variables including WORKSPACE and PACKAGES_PATH.

The makefile target from the following set is also passed
into the makefile.  If no target is passed into build, then
the 'all' target is used.

[all|fds|genc|genmake|clean|cleanall|cleanlib|modules|libraries|run]

A platform DSC file can use a statements in the [Defines]
section of the following form to use this script.  MAKEFILE
is a WORKSPACE or PACKAGES_PATH relative path to the makefile
to run.

[Defines]
  PREBUILD  = python BaseTools/Script/RunMakefile.py --makefile MAKEFILE
  POSTBUILD = python BaseTools/Script/RunMakefile.py --makefile MAKEFILE

Cc: Liming Gao <liming.gao@intel.com>
Cc: Yonghong Zhu <yonghong.zhu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Michael Kinney <michael.d.kinney@intel.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
BaseTools/Scripts/RunMakefile.py [new file with mode: 0644]