diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2017-02-28 17:48:47 +0000 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2017-02-28 17:48:47 +0000 |
commit | c1b4d59dfb4b751c85cc348c7081c13f572c9958 (patch) | |
tree | e1d329a3e10d30899e83b3202c976f7e56f4d969 /configure | |
parent | dba9aa017ec07db49a7bd163f0b4943e3238f83f (diff) |
configure: Put temporary directory in build tree, and delete it
We were putting the temporary directory we use for configure tests
under /tmp/, but never deleting it, so if you ran configure a lot
you'd build up a big stock of useless directories.
Switch to using a scheme like GNU autotools and QEMU, where we
put the configure tempdir in the build tree, and delete it
just when configure exits successfully.
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'configure')
-rwxr-xr-x | configure | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -13,7 +13,20 @@ # Locate the directory where this configure script is SRCDIR="$(cd "$(dirname "$0")"; pwd)" -tmp_dir=`mktemp -d -t risu_configure_check_XXXXXX` +# Temporary directory used for files created by this script. +# Like autoconf (and like QEMU) we put this directory in the +# build directory, which means we can just give it a fixed name and +# blow it away when configure is run, and we don't need to jump +# through complicated hoops to delete it when configure exits +# abnormally (it may be useful for debug purposes on an +# abnormal exit). +tmp_dir="config-temp" +rm -rf "$tmp_dir" +mkdir -p "$tmp_dir" +if [ $? -ne 0 ]; then + echo "ERROR: could not create temporary directory" + exit 1 +fi compile() { $CC $CFLAGS -c -o ${1}.o ${1}.c 2>/dev/null @@ -125,6 +138,8 @@ if test ! -e Makefile; then ln -s "${SRCDIR}/Makefile" . fi +rm -r "$tmp_dir" + echo "type 'make' to start the build" exit 0 |