#!/bin/sh
# cleanup: remove files generated by configure and build
# Run by R CMD build before building the source tarball. Can also be
# run manually after roxygen2::roxygenise() to remove the debug
# objects it leaves behind before a release build.

# Generated Makevars
rm -f src/Makevars

# Compiled objects and shared libraries
rm -f src/*.o src/*.so src/*.dll

# R symbol table generated during compilation
rm -f src/symbols.rds

# Configure artifacts (root and src/ in case configure was run there)
rm -f config.log config.status
rm -f src/config.log src/config.status

# Autoconf cache directories
rm -rf autom4te.cache 2>/dev/null || true
rm -rf tools/autom4te.cache 2>/dev/null || true
rm -rf src/autom4te.cache 2>/dev/null || true

exit 0
