initial commit
This commit is contained in:
commit
9224afc09e
1 changed files with 24 additions and 0 deletions
24
cash.sh
Normal file
24
cash.sh
Normal file
|
@ -0,0 +1,24 @@
|
|||
_try_cc() {
|
||||
local out="$1"
|
||||
shift
|
||||
local infile
|
||||
infile=$(mktemp --suffix .c)
|
||||
cat > "$infile"
|
||||
ccache hash_dir=false \
|
||||
"${CC:-cc}" -o "$out" "$infile" "$@"
|
||||
code=$?
|
||||
rm "$infile" || :
|
||||
return $?
|
||||
}
|
||||
|
||||
cash() {
|
||||
local out
|
||||
out=$(mktemp)
|
||||
_try_cc "$out" "$@" || {
|
||||
code=$?
|
||||
echo 'Error: compilation failed' >&2
|
||||
rm "$out" || :
|
||||
return "$code"
|
||||
}
|
||||
echo "$out"
|
||||
}
|
Loading…
Reference in a new issue