mirror of
https://github.com/notwa/rc
synced 2025-03-18 15:45:38 -07:00
improve compile script
This commit is contained in:
parent
9e29489e84
commit
b47e9ec455
1 changed files with 11 additions and 1 deletions
12
sh/compile
12
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 } || \
|
||||
|
|
Loading…
Add table
Reference in a new issue