forked from AI-Planning/pddl-generators
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_all
executable file
·42 lines (38 loc) · 992 Bytes
/
build_all
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
#! /bin/bash
set -euo pipefail
cd "$(dirname "$0")"
build_dir ()
{
if [ -e CMakeLists.txt ]; then
cmake .
fi
if [ -e Makefile ]; then
# Handle "./build_all test" and "./build_all clean" separately:
# don't try to run the command if it doesn't exist.
if [ "$#" -eq 1 ] && [ "$@" == "test" ]; then
make --dry-run test > /dev/null && (make test > /dev/null && echo "Tests passed." || exit 1)
elif [ "$#" -eq 1 ] && [ "$@" == "clean" ]; then
make --dry-run clean > /dev/null && (make clean > /dev/null && echo "Cleaned up." || exit 1)
else
make "$@"
fi
fi
}
SAVE_LOGS="n"
if [ "$#" -eq 1 ] && [ "$@" == "save-logs" ]; then
SAVE_LOGS="y"
shift
fi
for DIR in * ; do
if [ -d $DIR ]; then
echo
echo "Domain: $DIR"
cd $DIR
if [ "$SAVE_LOGS" == "y" ]; then
build_dir > make-out.log 2> make-err.log
else
build_dir
fi
cd ..
fi
done