trees: simplified copy_elf() handling

don't create elfdir, create dest_dir, which is elfdir
plus the location within it

only create dest_dir within copy_elf, which is only
called if actually compiling the code

this avoids creating empty elf directories, and it
generally cleans up all handling, unifying the
handling of directories into a single function,
namely copy_elf() which already exists

Signed-off-by: Leah Rowe <leah@libreboot.org>
This commit is contained in:
Leah Rowe 2024-06-07 15:02:32 +01:00 committed by Leah Rowe
parent d0d9b1204f
commit 573199c07d

View file

@ -68,8 +68,6 @@ build_projects()
[ "$mode" = "distclean" ] && mode="clean"
run_make_command || return 0
[ -f "$listfile" ] || return 0
[ -n "$mode" ] || x_ mkdir -p "$elfdir"
[ -n "$mode" ] || copy_elf; return 0
}
@ -87,7 +85,6 @@ build_targets()
targets="$(items "$cfgsdir")" || $err "Can't get options for $cfgsdir"
[ $# -gt 0 ] && targets=$@
[ -z "$mode" ] && x_ mkdir -p "$elfdir"
handle_targets
}
@ -290,6 +287,8 @@ copy_elf()
[ -n "$listfile" ] || return 0
[ -f "$listfile" ] || return 0
x_ mkdir -p "$dest_dir"
while read -r f; do
[ -f "$cdir/$f" ] && x_ cp "$cdir/$f" "$dest_dir"
done < "$listfile"