-
Notifications
You must be signed in to change notification settings - Fork 12
/
do-build
executable file
·48 lines (39 loc) · 1.13 KB
/
do-build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#! /usr/bin/env bash
# do-build [ --platform <platform> ] [ --results <results-dir> ]
set -e -o pipefail
print() { echo "$1" >&2; }
inform() { print "$0: $1"; }
warn() { print "Warning: $1"; }
error() { inform "Error: $1"; }
fail() { [ "$1" ] && error "$1"; return 1; }
usage() { print "$USAGE"; fail "$1"; }
# The usage message
USAGE='Usage: do-build [ --platform <platform> ] [ --results <repository> ]'
# Defaults for options
OPT_PLATFORM=leanXcam
OPT_RESULTS=
# Read options
while [ "${1:0:1}" == '-' ]; do
if [ "$1" == '--platform' ]; then
[ "$2" ] && OPT_PLATFORM=$2 || usage "Options requires an argument: $1"
shift
elif [ "$1" == '--results' ]; then
[ "$2" ] && OPT_RESULTS=$2 || usage "Options requires an argument: $1"
shift
else
usage "Unknown option: $1"
fi
shift
done
[ "$1" ] && usage "No arguments required."
if [ "$OPT_PLATFORM" == "leanXcam" ]; then
make distclean
make SCS/BF537_LEANXCAM_defconfig
elif [ "$OPT_PLATFORM" == "indXcam" ]; then
make distclean
make SCS/BF537_INDXCAM_defconfig
else
fail "Unknown platform: $OPT_PLATFORM"
fi
time make
[ "$OPT_RESULTS" ] && cp "images/uImage" "HISTORY" "$OPT_RESULTS"