1diff --git a/minic/mcc b/minic/mcc
2index 492947e..5258aac 100755
3--- a/minic/mcc
4+++ b/minic/mcc
5@@ -31,9 +31,9 @@ then
6 fi
7
8
9-$DIR/minic < $file > /tmp/minic.ssa &&
10-$QBE < /tmp/minic.ssa > /tmp/minic.s &&
11-cc /tmp/minic.s $flags
12+$DIR/minic < $file > ${TMPDIR:-/tmp}/minic.ssa &&
13+$QBE < ${TMPDIR:-/tmp}/minic.ssa > ${TMPDIR:-/tmp}/minic.s &&
14+cc ${TMPDIR:-/tmp}/minic.s $flags
15
16 if test $? -ne 0
17 then
18diff --git a/tools/cra.sh b/tools/cra.sh
19index 5988267..57a4b34 100755
20--- a/tools/cra.sh
21+++ b/tools/cra.sh
22@@ -2,7 +2,7 @@
23
24 DIR=`cd $(dirname "$0"); pwd`
25 QBE=$DIR/../qbe
26-BUGF=/tmp/bug.id
27+BUGF=${TMPDIR:-/tmp}/bug.id
28 FIND=$1
29 FIND=${FIND:-afl-find}
30
31diff --git a/tools/test.sh b/tools/test.sh
32index 23c6663..fb36222 100755
33--- a/tools/test.sh
34+++ b/tools/test.sh
35@@ -4,7 +4,7 @@ dir=`dirname "$0"`
36 bin=$dir/../qbe
37 binref=$dir/../qbe.ref
38
39-tmp=/tmp/qbe.zzzz
40+tmp=${TMPDIR:-/tmp}/qbe.zzzz
41
42 drv=$tmp.c
43 asm=$tmp.s