-
Notifications
You must be signed in to change notification settings - Fork 63
/
build
executable file
·34 lines (29 loc) · 916 Bytes
/
build
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
#!/bin/bash
Fail()
{
echo "FATAL($0): $1"
exit 1
}
if [[ "$1" == "debug" ]]; then
BUILDOPT='-g -O0'
elif [[ -z "$1" ]]; then
BUILDOPT='-O3'
else
Fail "unrecognized command line option"
fi
mkdir -p bin
# C++ demo programs
for name in altazsearch; do
rm -f bin/${name}
echo "Compiling ${name}.cpp"
g++ ${BUILDOPT} -Wall -Werror -x c++ -std=c++11 -o bin/${name} -I../../source/c ${name}.cpp ../../source/c/astronomy.c ||
Fail "Error building ${name}.cpp"
done
# C demo programs
for name in solar_time gravity galactic camera moonphase positions linux_riseset riseset seasons culminate horizon lunar_eclipse triangulate ecliptic_vector; do
rm -f bin/${name}
echo "Compiling ${name}.c"
gcc ${BUILDOPT} -Wall -Werror -o bin/${name} -I../../source/c ../../source/c/astronomy.c astro_demo_common.c ${name}.c -lm ||
Fail "Error building ${name}.c"
done
exit 0