mirror of
https://github.com/notwa/rc
synced 2024-06-28 18:17:11 -07:00
improve compile script
This commit is contained in:
parent
9e29489e84
commit
b47e9ec455
12
sh/compile
12
sh/compile
|
@ -29,11 +29,21 @@ compile() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local file=${@[-1]}
|
local file=${@[-1]}
|
||||||
[ "${file##*.}" = "c" ] || sepples=1
|
[ "${file##*.}" = "c" ] || [ "${file##*.}" = "h" ] || sepples=1
|
||||||
|
|
||||||
{ [ $1 = clang ] && CC="clang" && CXX="clang++" && shift } || \
|
{ [ $1 = clang ] && CC="clang" && CXX="clang++" && shift } || \
|
||||||
{ [ $1 = gcc ] && CC="gcc" && CXX="g++" && 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 = debug ] && our_flags+=($debug_flags) && shift } || \
|
||||||
{ [ $1 = release ] && our_flags+=($release_flags) && shift } || \
|
{ [ $1 = release ] && our_flags+=($release_flags) && shift } || \
|
||||||
{ [ $1 = derelease ] && our_flags+=($dr_flags) && shift } || \
|
{ [ $1 = derelease ] && our_flags+=($dr_flags) && shift } || \
|
||||||
|
|
Loading…
Reference in New Issue
Block a user