Files
astronomy/demo/c/build
Don Cross 054985606e Revert "Use _FORTIFY_SOURCE=3 to improve C/C++ code verification."
This reverts commit a7e747c100.
This broke the GitHub Actions automated tests, because they
are using gcc 11 (which does not support level 3 fortification),
and they already predefine another fortification level.

I realize this would also hinder other contributors who
are not using gcc 12. At least I tried it once on my own
system and didn't find any problems, which is nice.
2023-09-11 15:02:14 -04:00

35 lines
916 B
Bash
Executable File

#!/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