The script herrmann1.sh invoked the program itself which is not needed and would in fact invoke it during compilation as the script is what compiles the program. The program is to be invoked via the script itself but the script also compiles the program as well. Fixed the script for shellcheck. Note that there still is a problem in that with older gcc versions it's supposed to animate on compilation but this no longer works. See the bugs.md for details.
28 lines
704 B
Bash
Executable File
28 lines
704 B
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
name=herrmann1
|
|
|
|
# Make sure things are clean to start with...
|
|
rm -f "${name}" "${name}-1.c" "${name}-2.c" "${name}-3.c"
|
|
|
|
defs=""
|
|
for p in ${1+"$@"}; do
|
|
defs="$defs \"-D$p\""
|
|
done
|
|
|
|
cp "${name}.c" "${name}-1.c"
|
|
touch "${name}-3.c"
|
|
|
|
until cmp -s "${name}-1.c" "${name}-3.c" > /dev/null; do
|
|
eval "${CC:-cc}" -E "${name}-1.c" -o "${name}-2.c" -P "$defs" 2> error || exit
|
|
mv -f "${name}-1.c" "${name}-3.c"
|
|
sed -e 's/ */ /g' -e 's/^ //' -e '/^$/ d' -e 's:^/ \*:/*:' \
|
|
< "${name}-2.c" > "${name}-1.c"
|
|
head "${name}-1.c"
|
|
done
|
|
|
|
eval "${CC:-cc}" "${name}-1.c" -o "${name}" 2> error && rm error
|
|
|
|
# Clean up intermediates...
|
|
rm -f "${name}-1.c" "${name}-2.c" "${name}-3.c"
|