1
0
Fork 0
mirror of https://github.com/notwa/rc synced 2024-06-26 01:07:11 -07:00

improve compile script

This commit is contained in:
Connor Olding 2017-03-31 01:09:26 +00:00
parent 9e29489e84
commit b47e9ec455

View File

@ -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 } || \