#!/bin/csh -f

touch mus-config.h
cp tools/ffitest.c .
cp tools/tauto.scm .
cp ~/cl/t923.scm .
cp ~/cl/t101.scm .
cp tools/*.scm .
cp ~/cl/make-repl .
cp ~/cl/low-primes.scm .
cp ~/cl/full-s7test.scm .
cp ~/cl/lt.scm .
cp ~/cl/peak-phases.scm .

echo ' '
echo '-------- base case --------'
echo ' '
gcc s7.c -c -I. -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm
sed 's/(define full-s7test #f)/(define full-s7test #t)/g' s7test.scm > fulltest.scm
repl fulltest.scm
repl tauto.scm

echo ' '
echo '-------- base case + nrepl --------'
echo ' '
gcc s7.c -c -I. -g3 -ldl -lm -Wl,-export-dynamic
gcc -o nrepl nrepl.c -g3 -Wall s7.o -I. -Wl,-export-dynamic -lnotcurses-core -lm -ldl
nrepl s7test.scm

echo ' '
echo '-------- s7-debugging/system-extras --------'
echo ' '
gcc s7.c -c -I. -DS7_DEBUGGING -DWITH_SYSTEM_EXTRAS -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm
repl t101.scm

echo ' '
echo '-------- with-gmp --------'
echo ' '
gcc s7.c -c -I. -g3 -DWITH_GMP -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lgmp -lmpfr -lmpc -lm -ldl -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- with-gmp precision --------'
echo ' '
gcc s7.c -c -I. -g3 -DWITH_GMP -DDEFAULT_BIGNUM_PRECISION=512 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lgmp -lmpfr -lmpc -lm -ldl -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- with-pure-s7 --------'
echo ' '
gcc s7.c -c -I. -DWITH_PURE_S7 -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm
repl fulltest.scm

echo ' '
echo '-------- with-history --------'
echo ' '
gcc s7.c -c -I. -DWITH_HISTORY -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- with-history size --------'
echo ' '
gcc s7.c -c -I. -DWITH_HISTORY -DDEFAULT_HISTORY_SIZE=32 -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- initial sizes --------'
echo ' '
gcc s7.c -c -I. -g3 -DINITIAL_HEAP_SIZE=32768 -DINITIAL_STACK_SIZE=512 -DINITIAL_PROTECTED_OBJECTS_SIZE=4 -DGC_TEMPS_SIZE=512 -DSYMBOL_TABLE_SIZE=10009 -DNUM_SMALL_INTS=512 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- optimized/disable-deprecated --------'
echo ' '
gcc s7.c -c -I. -O2 -g -DDISABLE_DEPRECATED -fomit-frame-pointer -funroll-loops -Wall -march=native -ldl -lm -Wl,-export-dynamic 
gcc -o repl repl.c -g -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm
repl fulltest.scm

echo ' '
echo '-------- with-main --------'
echo ' '
gcc s7.c -o repl -DWITH_MAIN -DUSE_SND=0 -I. -g3 -ldl -lm -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- max-string-input --------'
echo ' '
gcc s7.c -c -I. -DMAX_SIZE_FOR_STRING_PORT=1024 -DDEFAULT_PRINT_LENGTH=8 -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl fulltest.scm

echo ' '
echo '-------- silly stuff --------'
echo ' '
gcc s7.c -c -I. -DEXTRA_EXPONENT_MARKERS=1 -DS7_ALIGNED=1 -DWITH_VECTORIZE=0 -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- gc --------'
echo ' '
gcc s7.c -c -I. -DGC_RESIZE_HEAP_FRACTION=0.72 -DOUTPUT_PORT_DATA_SIZE=128 -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
repl s7test.scm

echo ' '
echo '-------- valgrind --------'
echo ' '
gcc s7.c -c -I. -g3 -ldl -lm -Wl,-export-dynamic
gcc -o repl repl.c -g3 -Wall s7.o -I. -lm -ldl -Wl,-export-dynamic
valgrind repl s7test.scm
valgrind repl fulltest.scm
