-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.sh
executable file
·47 lines (42 loc) · 989 Bytes
/
build.sh
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
#!/usr/bin/env bash
set -eo pipefail
log() {
echo "$(date '+%Y-%m-%d %H:%M:%S') - $1"
}
usage() {
echo "Usage: $0 {build-debug|build-release|run-debug|run-release|clean|debug-gdb}"
exit 1
}
if [ "$#" -eq 0 ]; then
usage
fi
case $1 in
build-debug)
log "Building the project in debug mode..."
bazel build //src:elfpacker --config=debug
;;
build-release)
log "Building the project in release mode..."
bazel build //src:elfpacker --config=release
;;
run-debug)
log "Running the project in debug mode..."
bazel run //src:elfpacker --config=debug -- "$@"
;;
run-release)
log "Running the project in release mode..."
bazel run //src:elfpacker --config=release -- "$@"
;;
clean)
log "Cleaning build artifacts..."
bazel clean
;;
debug-gdb)
log "Launching GDB to debug the project..."
bazel build //src:elfpacker --config=debug
gdb --args bazel-bin/src/elfpacker "$@"
;;
*)
usage
;;
esac