Tim Crawford c1dafbbfad scripts: Always set EC build dir
Building EC was broken as the build output from the previous board was
not being cleaned. `BUILD` is now always set, defaulting to "build",
instead of only when `BOARD` is specified. For good measure, add it
to the clean command in case a custom path is used.

Fixes: 569321f9ac79 ("scripts: Set EC build dir")
Signed-off-by: Tim Crawford <tcrawford@system76.com>
2023-10-12 13:27:55 -06:00

23 lines
404 B
Bash
Executable File

#!/usr/bin/env bash
set -e
if [ -z "$1" -o ! -e "$1" -o -z "$2" ]
then
echo "$0 <config> <output>" >&2
exit 1
fi
EC_ARGS=()
while read line; do
if [[ "$line" != "#"* ]]; then
EC_ARGS+=("$line")
fi
done < "$1"
BUILD_DIR="build"
make -C ec BUILD="$BUILD_DIR" clean
make -C ec VERSION="${VERSION}" "${EC_ARGS[@]}" BUILD="$BUILD_DIR" -j "$(nproc)"
cp "ec/$BUILD_DIR/ec.rom" "$2"