mirror of
https://codeberg.org/libreboot/lbmk.git
synced 2026-07-13 14:59:34 +02:00
unify build/clean scripts: use handle/make instead
The -c option is added for distclean, and -x for crossgcc-clean, in handle/make/config about 100 sloc removed from lbmk Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
@@ -49,7 +49,7 @@ cbfstool=""
|
||||
|
||||
main()
|
||||
{
|
||||
while getopts b:m:u: option
|
||||
while getopts b:m:u:c:x: option
|
||||
do
|
||||
case "${1}" in
|
||||
-b)
|
||||
@@ -61,6 +61,12 @@ main()
|
||||
-m)
|
||||
mode="menuconfig"
|
||||
shift ;;
|
||||
-c)
|
||||
mode="distclean"
|
||||
shift ;;
|
||||
-x)
|
||||
mode="crossgcc-clean"
|
||||
shift ;;
|
||||
*)
|
||||
fail "Invalid option" ;;
|
||||
esac
|
||||
@@ -139,9 +145,16 @@ handle_dependencies()
|
||||
fail "handle_dependencies: ${target_dir}: undefined cpu type"
|
||||
|
||||
codedir="${project}/${tree}"
|
||||
[ -d "${codedir}" ] || \
|
||||
if [ ! -d "${codedir}" ]; then
|
||||
if [ "${mode}" = "distclean" ] || \
|
||||
[ "${mode}" = "crossgcc-clean" ]; then
|
||||
printf "Directory '%s' does not exist; skipping clean" \
|
||||
"${codedir}" 1>&2
|
||||
exit 0
|
||||
fi
|
||||
./update project trees "${project}" "${target}" || \
|
||||
fail "handle_dependencies: can't fetch ${project}/${target}"
|
||||
fi
|
||||
|
||||
# u-boot and coreboot are both compiled with coreboot's crossgcc
|
||||
if [ "${project}" = "coreboot" ] || [ "${project}" = "u-boot" ]; then
|
||||
@@ -239,8 +252,12 @@ run_make_command()
|
||||
|| fail "run_make_command: ${codedir}: can't set version"
|
||||
fi
|
||||
make -C "${codedir}" -j$(nproc) ${mode} || \
|
||||
fail "run_make_command: make-all: ${codedir} (${project}/${target})"
|
||||
if [ "${mode}" = "oldconfig" ] || [ "${mode}" = "menuconfig" ]; then
|
||||
fail "run_make: !make-${mode}: ${codedir} (${project}/${target})"
|
||||
if [ -e "${codedir}/.git" ] && [ "${project}" = "u-boot" ] && \
|
||||
[ "${mode}" = "distclean" ]; then
|
||||
git -C "${codedir}" clean -fdx || \
|
||||
err "run_make_command: ${codedir}: cannot clean u-boot git"
|
||||
elif [ "${mode}" = "oldconfig" ] || [ "${mode}" = "menuconfig" ]; then
|
||||
cp "${codedir}/.config" "${config}" || \
|
||||
fail "run_make: can't edit config: ${project}/${target}"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user