4
0

distclean 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. #!/bin/sh
  2. # This script cleans up all auto*-generated files. If Makefiles are present
  3. # it will run 'make distclean' first.
  4. #
  5. # Please run this script from the top-level directory.
  6. if [ ! -f tools/distclean ]; then
  7. echo "Please run this script from the top-level directory of Nagios-plugins."
  8. exit 1
  9. fi
  10. # First try git-clean, removing all ignored files will be perfect...
  11. if [ -d ".git" ]; then
  12. echo "$0: Running 'git clean -fdX', this will remove all files ignored by git..."
  13. git clean -fdX
  14. if [ "$?" -eq "0" ]; then
  15. echo "$0: Cleanup complete! Have a nice day..."
  16. exit 0
  17. fi
  18. echo "$0: git-clean error, failing back to legacy cleanup!"
  19. fi
  20. # If we get here, then git-clean did not run or failed. Using the legacy method...
  21. if [ -f Makefile ]; then
  22. echo "$0: Makefile present. Cleaning up with 'make distclean'..."
  23. make -i distclean
  24. if [ $? -ne 0 ]; then
  25. echo "Uh-oh! Make distclean failed."
  26. exit 1
  27. fi
  28. fi
  29. echo "$0: Removing auto* files..."
  30. rm -rf autom4te.cache
  31. find . -type f -name Makefile.in -print| xargs rm -f
  32. rm -f aclocal.m4 compile config.guess config.h.in config.sub configure depcomp
  33. rm -f m4/Makefile.am
  34. echo "$0: Removing miscelanious files..."
  35. rm -f po/*.gmo po/stamp-po
  36. rm -f lib/tests/*.Po
  37. rm -f doc/developer-guidelines.html
  38. rm -f INSTALL install-sh missing
  39. rm -f plugins/t/check_nagios.nagios?.status.???.tmp
  40. echo "$0: Cleanup complete! Have a nice day..."