-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild
More file actions
executable file
·88 lines (72 loc) · 1.62 KB
/
build
File metadata and controls
executable file
·88 lines (72 loc) · 1.62 KB
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
#!/bin/bash
# This will build and return an absolute path to the executable in stdout
# command line:
# ./build <path to app's cxx>
# command environment variables:
# symbols=[0|1] -- include debug symbols
# optimize=[0|1|2|3...] -- optimization level
# gprof=[0|1] -- enable profiling with gprof
# conduit=[mpi|ibv|...]
# examples:
# ./build app/fib.cxx
here="$(cd "$(dirname "$0")"; pwd -P)"
source "${here}/defaults"
roots=("${@:1}")
rootlist=""
for i in "${!roots[@]}"; do
rootlist+=\"$(python -c "import os; import sys; sys.stdout.write(os.path.realpath('${roots[$i]}'))")\",
done
cxx_flags+="+['-Wall']"
cc_flags+="+['-Wall']"
case "${symbols}" in
''|0)
;;
*)
cxx_flags+="+['-g']"
cc_flags+="+['-g']"
;;
esac
optimize="${optimize:-2}"
cxx_flags+="+['-O${optimize}']"
cc_flags+="+['-O${optimize}']"
case "${gprof}" in
''|0)
;;
*)
cxx_flags+="+['-pg']"
cc_flags+="+['-pg']"
ld_flags_1+="+['-pg']"
;;
esac
cxx_flags+="+['-iquote./src']"
cc_flags+="+['-iquote./src']"
cxx_flags+="+['-D__PROGRAMR__']"
cc_flags+="+['-D__PROGRAMR__']"
rm -f "${makeout}"
exe=$(
cd "$PROGRAMR";
(
{
python<<END_HERE
import sys
vars = {
'cxx_flags': ${cxx_flags},
'cc_flags': ${cc_flags},
'ld_flags_0': ${ld_flags_0},
'ld_flags_1': ${ld_flags_1},
}
execfile('build_config.py', vars, vars)
vars['roots'] = [${rootlist}]
sys.path = ['./bake'] + sys.path
execfile('bake/build.py', vars, vars)
END_HERE
} 3>&1 1>&2 2>&3 | tee "$makeout";
ec="${PIPESTATUS[0]}";
[ $ec -eq 0 ] && rm -f "$makeout"
) 3>&1 1>&2 2>&3
)
if [ -e "${makeout}" ]; then
less "${makeout}"
exit 1
fi
echo "${exe}"