build.sh (748B)
1 #!/bin/sh 2 3 cc=${CC:-cc} 4 debug=${DEBUG} 5 version=$(git describe --dirty --always) 6 7 cflags="-march=native -O3 -Wall -DVERSION=\"${version}\"" 8 #cflags="${cflags} -fproc-stat-report" 9 #cflags="${cflags} -Rpass-missed=.*" 10 ldflags="-lm -lGL -lglfw" 11 12 testcflags="$cflags -O0 -ggdb -D_DEBUG -Wno-unused-function -Wno-undefined-internal" 13 14 [ ! -s "./config.h" ] && cp config.def.h config.h 15 16 if [ $debug ]; then 17 # Hot Reloading/Debugging 18 cflags="$cflags -D_DEBUG -Wno-unused-function -Wno-undefined-internal" 19 #cflags="$cflags -fsanitize=address,undefined" 20 21 libcflags="$cflags -ggdb -O0 -fPIC" 22 libldflags="$ldflags -shared" 23 24 ${cc} $libcflags vtgl.c -o vtgl.so $libldflags 25 fi 26 27 ${cc} $cflags -o vtgl main.c $ldflags 28 ${cc} $testcflags -o test test.c $ldflags