aboutsummaryrefslogtreecommitdiff
path: root/bin/build-all.sh
diff options
context:
space:
mode:
authorSelene ToyKeeper2023-11-07 11:04:34 -0700
committerSelene ToyKeeper2023-11-07 11:04:34 -0700
commit96bb6aeb178182c95558c5157b6ddfaecfceb785 (patch)
tree6cd898456b8754e60d39f51d98e55b6cb895a01f /bin/build-all.sh
parentMerge branch 'pull15' into trunk (diff)
downloadanduril-96bb6aeb178182c95558c5157b6ddfaecfceb785.tar.gz
anduril-96bb6aeb178182c95558c5157b6ddfaecfceb785.tar.bz2
anduril-96bb6aeb178182c95558c5157b6ddfaecfceb785.zip
shell script cleanup (fix lint warnings, remove unused scripts)
Diffstat (limited to '')
-rwxr-xr-xbin/build-all.sh35
1 files changed, 18 insertions, 17 deletions
diff --git a/bin/build-all.sh b/bin/build-all.sh
index 0dec247..130923f 100755
--- a/bin/build-all.sh
+++ b/bin/build-all.sh
@@ -1,4 +1,4 @@
-#!/usr/bin/env sh
+#!/usr/bin/env bash
# Anduril / FSM build wrapper script
# Copyright (C) 2017-2023 Selene ToyKeeper
# SPDX-License-Identifier: GPL-3.0-or-later
@@ -6,9 +6,12 @@
# Usage: build-all.sh [pattern]
# If pattern given, only build targets which match.
-if [ ! -z "$1" ]; then
+# enable "**" for recursive glob (requires bash)
+shopt -s globstar
+
+if [ "$#" -gt 0 ]; then
# multiple search terms with "AND"
- SEARCH=$@
+ SEARCH=( "$@" )
# memes
[ "$1" = "me" ] && shift && shift && echo "Make your own $*." && exit 1
fi
@@ -27,18 +30,19 @@ FAIL=0
PASSED=''
FAILED=''
-# build targets are hw/*/**/$UI.h
-for TARGET in $( find hw/*/*/ -name "$UI".h ) ; do
+# build targets are hw/$vendor/$model/**/$ui.h
+for TARGET in hw/*/*/**/"$UI".h ; do
# friendly name for this build
NAME=$(echo "$TARGET" | perl -ne 's|/|-|g; /hw-(.*)-'"$UI"'.h/ && print "$1\n";')
# limit builds to searched patterns, if given
SKIP=0
- if [ ! -z "$SEARCH" ]; then
- for text in $SEARCH ; do
- echo "$NAME $TARGET" | grep -i -- "$text" > /dev/null
- if [ 0 != $? ]; then SKIP=1 ; fi
+ if [ ${#SEARCH[@]} -gt 0 ]; then
+ for text in "${SEARCH[@]}" ; do
+ if ! echo "$NAME $TARGET" | grep -i -- "$text" > /dev/null ; then
+ SKIP=1
+ fi
done
fi
if [ 1 = $SKIP ]; then continue ; fi
@@ -46,18 +50,15 @@ for TARGET in $( find hw/*/*/ -name "$UI".h ) ; do
# announce what we're going to build
echo "===== $UI : $NAME ====="
- # try to compile
- bin/build.sh "$TARGET"
-
- # track result, and rename compiled files
- if [ 0 = $? ] ; then
- mv -f "ui/$UI/$UI".hex hex/"$UI".$NAME.hex
+ # try to compile, track result, and rename compiled files
+ if bin/build.sh "$TARGET" ; then
+ mv -f "ui/$UI/$UI".hex "hex/$UI.$NAME.hex"
echo " > hex/$UI.$NAME.hex"
- PASS=$(($PASS + 1))
+ PASS=$((PASS + 1))
PASSED="$PASSED $NAME"
else
echo "ERROR: build failed"
- FAIL=$(($FAIL + 1))
+ FAIL=$((FAIL + 1))
FAILED="$FAILED $NAME"
fi