#!/bin/sh optimisation=3 warnings="-Wunused-label -Wunused-value -Wunused-variable" gcc_options="$warnings -Wfatal-errors -std=c11 -O$optimisation" c=source/c-precompiled compile_libsph_dg() { # compile from c to machine code in a shared library. the version-script specifies the list of exported bindings gcc "$c/main.c" -o temp/libsph-dg.so -Wl,--version-script=other/export -shared -fpic -llmdb $gcc_options } compile_test() { export LIBRARY_PATH="$PWD/temp" gcc "$c/test-main.c" -o temp/test-libsph-dg -llmdb -lsph-dg -lpthread $gcc_options } mkdir -p temp && compile_libsph_dg $@ && compile_test $@ && chmod 755 temp/*