diff options
author | Leah Rowe <leah@libreboot.org> | 2023-09-02 23:42:34 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-09-03 01:53:35 +0100 |
commit | 7c6b35cf95128a58b91a1d58b31469438fe1f5cc (patch) | |
tree | ef6e5eb392129240e31ea457b99253c9f35055b1 /script/handle | |
parent | cec37747b75ee8e7fa146ff061b6a5d4aea98309 (diff) |
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>
Diffstat (limited to 'script/handle')
-rwxr-xr-x | script/handle/make/config | 25 |
1 files changed, 21 insertions, 4 deletions
diff --git a/script/handle/make/config b/script/handle/make/config index 1b395600..c148ebca 100755 --- a/script/handle/make/config +++ b/script/handle/make/config @@ -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 |