remake-subdir3.sh 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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 remaking rules work when subdir Makefile.in has been removed.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. AC_CONFIG_FILES([sub/Makefile])
  20. AC_OUTPUT
  21. END
  22. cat > Makefile.am <<'END'
  23. SUBDIRS = sub
  24. END
  25. mkdir sub
  26. : > sub/Makefile.am
  27. $ACLOCAL
  28. $AUTOMAKE
  29. $AUTOCONF
  30. ./configure
  31. $MAKE
  32. do_check ()
  33. {
  34. run_make -O
  35. test $(grep -c "/missing " stdout) -eq 1
  36. }
  37. # Now, we are set up. Ensure that, for either missing Makefile.in,
  38. # or updated Makefile.am, rebuild rules are run, and run exactly once
  39. # only.
  40. rm -f Makefile.in
  41. do_check
  42. rm -f sub/Makefile.in
  43. do_check
  44. $sleep # Let touched files appear newer.
  45. touch Makefile.am
  46. do_check
  47. touch sub/Makefile.am
  48. do_check
  49. :