-
Notifications
You must be signed in to change notification settings - Fork 20
/
build_all
executable file
·68 lines (57 loc) · 1.87 KB
/
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
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
#!/bin/sh
export FLAG_CALLED_FROM_BUILD_ALL=true
# A POSIX variable
OPTIND=1 # Reset in case getopts has been used previously in the shell.
# Initialize variables:
MAKE_OPTION="clean_release"
NUM_PROCS=1
# Check optional build variables
while getopts "h?o:j:" opt; do
case "$opt" in
h|\?)
echo "./build_all -o MAKE_OPTION -j NUM_PROCS CODE_NAME"
echo " MAKE_OPTION: compile options, one of {clean_release, release, clean_debug, debug}."
echo " NUM_PROCS: number of CPUs for parallel make (default: 1)."
echo " CODE: code list to be compiled (default: full list)"
exit 0
;;
o) MAKE_OPTION=$OPTARG
;;
j) NUM_PROCS=$OPTARG
;;
esac
done
echo "Begin building STELLOPT with option: $MAKE_OPTION with $NUM_PROCS CPUs."
# Call the toplevel makfile to setup the output directories.
make $MAKE_OPTION
make test_make
shift $((OPTIND-1))
[ "${1:-}" = "--" ] && shift
# Loop through all the available codes and make the ones specified on the
# command line. If no codes were specified, then make all of them.
for CODE in LIBSTELL ANIMEC BCYCLIC BEAMS3D BOOTSJ BNORM BOOZ_XFORM COBRAVMEC COILOPT DESCUR DESCUR_PLOT DIAGNO DKES FIELDLINES J_INVARIANT MAKEGRID NEO NESCOIL PENTA TORLINES VMEC2000 VMEC2PIES VMEC2SPEC VMEC2STEL VMEC2V690 VMEC2XGC THRIFT STELLOPTV2 WALL_ACCELERATE
do
match=0
# If command line arguments were given, then check to see
# which codes should be compiled. Otherwise compile everything.
if [ $# -ne 0 ]; then
echo $@|grep -q $CODE
if [ $? -eq 0 ]; then
match=1
fi
else
match=1
fi
# Don't try to compile codes which you don't have directories for
if ! [ -d $CODE ]; then
match=0
fi
if [ $match -eq 1 ]; then
echo "Begin building $CODE"
cd $CODE
make $MAKE_OPTION -j $NUM_PROCS
cd ..
fi
done
# make a dynamic library
#make pystel