#!/bin/sh

########################################################################
# Remove all automake detritus, leaving just
# configure.in and Makefile.am
#
# This script assumes you use 'config-aux' to store temporary autoconf
# files in.  See comment in 'autoboot'.
########################################################################

set -x 

if test -f Makefile ; then
    gmake distclean
    rm -f Makefile
fi

# Remove standard autoconf detritus
rm -Rf autom4te*.cache 
rm -f aclocal.m4 upcr_config.h.in configure Makefile.in		      \
    stamp-h.in config.status config.log config.cache configure.scan   \
    config-aux/Makefile.in \
    upc_include/Makefile.in test/Makefile.in umalloc/Makefile.in \
    profile/Makefile.in man/Makefile.in

# Remove 'config-aux' dir only if it exists and is not empty
#   -- may contain user M4 macro files
rmdir config-aux 2>/dev/null

if test -d totalview; then
    ( cd totalview && ./unBootstrap )
fi

if test -d gasnet; then
    ( cd gasnet && ./unBootstrap )
fi

