#!/bin/sh
echo "AfterStep distibution cleanup script"
echo "You must run this script in your distribution root dir, like that:"
echo "cd /usr/src/AfterStep/AfterStep_devel && makeasclean" 

# make clean
dirs=`find . -name Makefile | sed 's/Makefile$//'`
for i in $dirs; do
  make -C $i clean
  done

# cleanup afterstep dir
cd afterstep
rm -f asmail audio autoexec base.*bpp compatibility pager wharf zharf
rm -f non-configurable/startmenu
cd ..

# cleanup autoconf dir
cd autoconf
rm -f Makefile.defines Makefile.common Makefile.common.lib configure
cd ..

# removing all empty files from sources
rm -f `find asimagelib -empty`
rm -f `find lib -empty`
rm -f `find include -empty`
rm -f `find src -empty`

# removing some debug leftovers from sources
rm -f `find asimagelib -name "errors"`
rm -f `find lib -name "errors"`
rm -f `find src -name "errors"`

# remove configure droppings
rm -f `find . -name "config.cache"`
rm -f `find . -name "config.h"`
rm -f `find . -name "config.log"`
rm -f `find . -name "config.status"`
rm -f `find . -name "*.in" | sed 's/.in$//'`

# remove backups
rm -f `find . -name "*~"`
rm -f `find . -name "*.bak"`

# remove object files and libraries
rm -f `find . -name "*.o"`
rm -f `find . -name "*.a"`
rm -f `find . -name "*.so"`
rm -f `find . -name "*.so.*"`

# remove patch droppings
rm -f `find . -name "*.rej"`
rm -f `find . -name "*.orig"`

# remove profiling information (for gprof)
rm -f `find . -name "gmon.out"`
