#!/bin/sh -e optimisation=3 target_dir=temp c=source/c c_sc=source/c-precompiled root="$PWD" warnings="-Wunused-label -Wunused-value -Wunused-variable" gcc_options="-funsigned-char -std=c17 -Wfatal-errors -Wno-pointer-sign $warnings -I$c/foreign -I$c/foreign/sph-sc-lib -I$c_sc -fno-math-errno -lm" debug_preprocess_sph_sp() { target="$target_dir/sph-sp.c" source="$c_sc/sph-sp/main.c" gcc "$source" $gcc_options -o "$target" -lpthread -E } compile_sph_sp() { target="$target_dir/libsph-sp.so" source="$c_sc/sph-sp/main.c" gcc "$source" $gcc_options -o "$target" -shared -lpthread -fno-builtin -fpic -O$optimisation } compile_test_sph_sp() { export LIBRARY_PATH="$root/temp" gcc "$c_sc/test/main.c" -o temp/test-libsph-sp $gcc_options -lsph-sp -Og } mkdir -p "$target_dir" compile_sph_sp compile_test_sph_sp