maken.sh 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #! /bin/sh
  2. # Copyright (C) 2009-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. # Ensure that 'make -n dist' and 'make -n distcheck' do not change files
  17. # on disk, due to GNU make executing rules containing '$(MAKE)'.
  18. # Also, ensure that 'make -n dist' and 'make -n distcheck' show what
  19. # would happen, at least when using GNU make.
  20. . test-init.sh
  21. mkdir sub
  22. cat >> configure.ac << 'END'
  23. AC_CONFIG_FILES([sub/Makefile])
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am <<'END'
  27. SUBDIRS = sub
  28. distcheck-hook:
  29. @: > stamp-distcheck-hook
  30. test-no-distdir:
  31. test ! -d $(distdir)
  32. test ! -f stamp-distcheck-hook
  33. test ! -f sub/stamp-sub-dist-hook
  34. END
  35. cat >sub/Makefile.am <<'END'
  36. dist-hook:
  37. @: > stamp-sub-dist-hook
  38. END
  39. $ACLOCAL
  40. $AUTOCONF
  41. $AUTOMAKE
  42. ./configure
  43. echo stamp > stampfile
  44. $sleep
  45. for target in dist distcheck; do
  46. $MAKE -n $target
  47. if using_gmake; then
  48. $MAKE -n $target | grep stamp-sub-dist-hook || exit 1
  49. fi
  50. $MAKE test-no-distdir
  51. # No file has been actually touched or created.
  52. is_newest stampfile $(find . -type f) sub
  53. done
  54. :