From b47e9ec4552d39cf2c61bf3bfe6089dc98d567d6 Mon Sep 17 00:00:00 2001 From: Connor Olding Date: Fri, 31 Mar 2017 01:09:26 +0000 Subject: [PATCH] improve compile script --- sh/compile | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sh/compile b/sh/compile index 1f56a54..13ae555 100755 --- a/sh/compile +++ b/sh/compile @@ -29,11 +29,21 @@ compile() { fi local file=${@[-1]} - [ "${file##*.}" = "c" ] || sepples=1 + [ "${file##*.}" = "c" ] || [ "${file##*.}" = "h" ] || sepples=1 { [ $1 = clang ] && CC="clang" && CXX="clang++" && shift } || \ { [ $1 = gcc ] && CC="gcc" && CXX="g++" && shift } + if [ CC=clang ]; then + debug_flags+=(-ftrapv) + if [ -z $MSYSTEM ]; then # only available on linux + debug_flags+=(-fsanitize=undefined) # this SHOULD work with mingw, + # but it fails to link. + debug_flags+=(-fsanitize=address) + debug_flags+=(-flto -fsanitize=cfi) + fi + fi + { [ $1 = debug ] && our_flags+=($debug_flags) && shift } || \ { [ $1 = release ] && our_flags+=($release_flags) && shift } || \ { [ $1 = derelease ] && our_flags+=($dr_flags) && shift } || \