trees: avoid kconfig make commands generically

don't hardcode the check based on whether the current
project is grub. instead, define "btype" in target.cfg

if unset, we assume kconfig and permit kconfig commands
e.g. make menuconfig, make silentoldconfig, etc

this is to avoid the deadliest of sins:
project-specific hacks

Signed-off-by: Leah Rowe <leah@libreboot.org>
audit6
Leah Rowe 2024-06-27 15:55:56 +01:00
parent eb9c1872b6
commit 7a15ba18cb
5 changed files with 13 additions and 9 deletions

View File

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

View File

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

View File

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

View File

@ -1 +1,2 @@
cmakedir="UEFIExtract" cmakedir="UEFIExtract"
btype="cmake"

View File

@ -11,8 +11,8 @@ set -u -e
cbmakeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS" cbmakeargs="UPDATED_SUBMODULES=1 CPUS=$XBMK_THREADS"
eval `setvars "" xarch cdir config config_name xlang mode makeargs \ eval `setvars "" xarch cdir config config_name xlang mode makeargs \
listfile project target target_dir targets tree _f target1 bootstrapargs \ elfdir project target target_dir targets tree _f target1 bootstrapargs \
autoconfargs cmakedir elfdir autogenargs xtree` autoconfargs cmakedir listfile autogenargs xtree btype`
main() main()
{ {
@ -63,7 +63,7 @@ build_projects()
fetch_project_repo; return 0 fetch_project_repo; return 0
fi fi
load_project_config "$cfgsdir" load_project_config "$cfgsdir" || return 0
[ -f "$listfile" ] || listfile="" # optional on single-tree [ -f "$listfile" ] || listfile="" # optional on single-tree
dest_dir="$elfdir" dest_dir="$elfdir"
@ -131,7 +131,7 @@ handle_src_tree()
fetch_project_trees; return 1 fetch_project_trees; return 1
fi fi
load_project_config "$target_dir" load_project_config "$target_dir" || return 1
x_ mkdir -p "$elfdir/$target" x_ mkdir -p "$elfdir/$target"
chkvars tree chkvars tree
@ -153,8 +153,10 @@ handle_src_tree()
load_project_config() load_project_config()
{ {
eval `setvars "" xarch xlang tree bootstrapargs autoconfargs xtree \ eval `setvars "" xarch xlang tree bootstrapargs autoconfargs xtree \
tree_depend makeargs` tree_depend makeargs btype`
eval `setcfg "$1/target.cfg" 0`; return 0 eval `setcfg "$1/target.cfg" 0`
[ -z "$btype" ] || [ "${mode%config}" = "$mode" ] || \
return 1; return 0
} }
check_cross_compiler() check_cross_compiler()
@ -213,11 +215,9 @@ elfcheck()
handle_makefile() handle_makefile()
{ {
[ "$project" = "grub" ] && [ "${mode%config}" != "$mode" ] && return 0
check_makefile "$cdir" && x_ make clean -C "$cdir" check_makefile "$cdir" && x_ make clean -C "$cdir"
x_ cp "$config" "$cdir/.config" x_ cp "$config" "$cdir/.config"
[ -n "$mode" ] || [ "$project" = "grub" ] || make -C "$cdir" \ [ -n "$mode" ] || [ -n "$btype" ] || make -C "$cdir" \
silentoldconfig || make -C "$cdir" oldconfig || : silentoldconfig || make -C "$cdir" oldconfig || :
run_make_command || $err "handle_makefile $cdir: no makefile!" run_make_command || $err "handle_makefile $cdir: no makefile!"