distcleancheck.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. #! /bin/sh
  2. # Copyright (C) 2008-2017 Free Software Foundation, Inc.
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 2, or (at your option)
  7. # any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # Make sure the suggested 'distcleancheck_listfiles' in the manual works.
  17. # The example Makefile.am we use is from the FAQ entry 'distcleancheck'.
  18. required=cc
  19. . test-init.sh
  20. cat >>configure.ac << 'END'
  21. AC_PROG_CC
  22. AC_OUTPUT
  23. END
  24. cat > Makefile.am << 'END'
  25. # This Makefile.am is bogus. See @node{distcleancheck} in the manual
  26. # for how to fix it properly.
  27. bin_PROGRAMS = foo
  28. foo_SOURCES = foo.c
  29. dist_man_MANS = foo.1
  30. # We write './foo.1' inside the rule on purpose, to avoid VPATH rewriting
  31. # done by some 'make' implementations.
  32. foo.1: foo$(EXEEXT)
  33. echo man page for foo$(EXEEXT) > ./foo.1
  34. ## Ignore warnings about overridden variables
  35. AUTOMAKE_OPTIONS = -Wno-override
  36. distcleancheck_listfiles = \
  37. find . -type f -exec sh -c 'test -f $(srcdir)/$$1 || echo $$1' \
  38. sh '{}' ';'
  39. END
  40. cat >foo.c <<'END'
  41. int main () { return 0; }
  42. END
  43. $ACLOCAL
  44. $AUTOCONF
  45. $AUTOMAKE
  46. ./configure
  47. $MAKE
  48. $MAKE distcheck
  49. # Now ensure that we really needed the override.
  50. sed '/distcleancheck_listfiles/,$d' Makefile.am > t
  51. mv -f t Makefile.am
  52. $AUTOMAKE
  53. ./configure
  54. $MAKE
  55. run_make -E -e FAIL distcheck
  56. grep 'ERROR:.*files left in build directory after distclean' stderr
  57. grep '^\./foo\.1$' stderr
  58. :