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>
20240612_branch
Leah Rowe 2024-06-07 15:02:32 +01:00
parent 3eef7f37f2
commit 668bcbf69c
1 changed files with 2 additions and 3 deletions

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
}
@ -292,6 +289,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"