21 lines
360 B
Plaintext
21 lines
360 B
Plaintext
cc-clean(){
|
|
rm -rf ./**/*.out 2>/dev/null
|
|
}
|
|
|
|
# compile and run a single C program. Useful for prototyping.
|
|
cc-run(){
|
|
local file
|
|
if [ -z "$1" ]; then
|
|
echo "Usage: cc-run <file> [args...]" >&2
|
|
return 1
|
|
fi
|
|
|
|
file="$1"
|
|
shift
|
|
|
|
gcc "${file}" -o "${file}.out" -Wall -Wextra -Werror -g3 -fsanitize=address $@ && \
|
|
"./${file}.out"
|
|
|
|
rm "${file}.out"
|
|
}
|