-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.bash
executable file
·70 lines (62 loc) · 917 Bytes
/
build.bash
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
#
# This script is inspired by Karl Landstrom's build script for
# obnc-libext_0.7.0.tar.gz
#
set -o errexit -o nounset
function run() {
echo "$@"
eval "$@"
}
function build_obncdocs() {
run obncdoc
}
function build_modules() {
for test in ?*Test.Mod; do
run obnc "$test"
done
run obncdoc
}
function clean_modules() {
if [[ -d "./.obnc" ]]; then
rm -rf "./.obnc"
fi
for FNAME in *Test; do
rm -f "${FNAME}"
done
if [[ -d "obncdoc" ]]; then
rm -rf "obncdoc"
fi
}
function usage() {
echo "usage: "
printf "\tbuild [clean|docs]\n"
printf "\tbuild -h\n"
echo
printf "\tclean\tdelete all generated files\n"
printf "\t-h\tdisplay help and exit\n"
}
for arg in "$@"; do
case "$arg" in
docs)
build_obncdocs
exit 0
;;
clean)
clean_modules
exit 0
;;
-h)
usage
exit 0
;;
*)
{
echo "invalid command"
usage
} >&2
exit 1
;;
esac
done
build_modules