What's the purpose of your scripts? Who is the intended audience?
For example, are you building cross compilers to build software for embedded platforms?
If not, why not just install the compiler provided by your Linux distro?
To build a cross-compiler, you may want to check the
crosstool-NG toolchain building project.
There are also some others.
As for a direct answer to your question, most packages have targets for '
make' like 'clean',
'distclean', 'mostlyclean' or 'realclean' to restore the directory.
If you're not confident of the results, just blow away the directory (rm -rf dir) and untar it again.