trees: don't hardcode use of mkpayload_grub

instead, make it a helper function, defined in target.cfg

this means that we can also do the same with other projects
in the future, and it is expected that we will have to.

these helper functions are used in cases where we want
additional actions to be performed.

actually, the helper could be anything. for example, you
could write:

mkhelper="./build foo bar"

and it would do that (at the point of execution, PWD
is the root directory of the build system)

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit2
Leah Rowe 2024-06-27 16:51:48 +01:00 committed by Leah Rowe
parent 623ad90ef0
commit 7451fa629c
4 changed files with 7 additions and 3 deletions

View File

@ -4,3 +4,4 @@ bootstrapargs="--gnulib-srcdir=gnulib/ --no-git"
autoconfargs="--with-platform=coreboot --disable-werror"
makeargs="FS_PAYLOAD_MODULES=\"\""
btype="autohell"
mkhelper="mkpayload_grub"

View File

@ -4,3 +4,4 @@ bootstrapargs="--gnulib-srcdir=gnulib/ --no-git"
autoconfargs="--with-platform=coreboot --disable-werror"
makeargs="FS_PAYLOAD_MODULES=\"\""
btype="autohell"
mkhelper="mkpayload_grub"

View File

@ -4,3 +4,4 @@ bootstrapargs="--gnulib-srcdir=gnulib/ --no-git"
autoconfargs="--with-platform=coreboot --disable-werror"
makeargs="FS_PAYLOAD_MODULES=\"\""
btype="autohell"
mkhelper="mkpayload_grub"

View File

@ -12,7 +12,7 @@ set -u -e
cbmakeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
eval `setvars "" xarch cdir config config_name xlang mode makeargs \
elfdir project target target_dir targets tree _f target1 bootstrapargs \
autoconfargs cmakedir listfile autogenargs xtree btype`
autoconfargs cmakedir listfile autogenargs xtree btype mkhelper`
main()
{
@ -150,7 +150,7 @@ handle_src_tree()
load_project_config()
{
eval `setvars "" xarch xlang tree bootstrapargs autoconfargs xtree \
tree_depend makeargs btype`
tree_depend makeargs btype mkhelper`
[ -f "$1/target.cfg" ] || btype="auto"
# target.cfg optional on single-tree so return if missing.
@ -244,7 +244,8 @@ run_make_command()
make -C "$cdir" $mode -j$XBMK_THREADS $makeargs || $err "$cdir mk$mode"
[ "$project" = "grub" ] && [ -z "$mode" ] && mkpayload_grub
[ -z "$mkhelper" ] || [ -n "$mode" ] || $mkhelper || \
$err "$cdir: helper command failed: $mkhelper" # eg mkpayload_grub
[ "$mode" != "clean" ] && return 0
make -C "$cdir" distclean 2>/dev/null || :