remake-recurs-user.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. #! /bin/sh
  2. # Copyright (C) 2012-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. # Remake rules and user-defined recursive rules.
  17. . test-init.sh
  18. cat >> configure.ac << 'END'
  19. m4_include([extra-targets.m4])
  20. AC_CONFIG_FILES([sub/Makefile])
  21. AC_OUTPUT
  22. END
  23. echo 'AM_EXTRA_RECURSIVE_TARGETS([foo])' > extra-targets.m4
  24. cat > Makefile.am << 'END'
  25. SUBDIRS = sub
  26. all-local: foo
  27. foo-local:
  28. : > foo
  29. bar-local:
  30. : > bar
  31. MOSTLYCLEANFILES = foo
  32. END
  33. mkdir sub
  34. cat > sub/Makefile.am << 'END'
  35. foo-local:
  36. : > foo2
  37. MOSTLYCLEANFILES = foo2
  38. bar-local: later-target
  39. END
  40. $ACLOCAL
  41. $AUTOCONF
  42. $AUTOMAKE
  43. ./configure
  44. $MAKE
  45. test -f foo
  46. test -f sub/foo2
  47. test ! -f bar
  48. test ! -f sub/zardoz
  49. $MAKE distcheck
  50. $sleep
  51. echo 'AM_EXTRA_RECURSIVE_TARGETS([bar])' >> extra-targets.m4
  52. cat >> Makefile.am <<'END'
  53. MOSTLYCLEANFILES += bar oof
  54. all-local: bar
  55. foo-local: oof
  56. oof:
  57. : > $@
  58. END
  59. echo 'include $(srcdir)/more.am' >> sub/Makefile.am
  60. cat > sub/more.am << 'END'
  61. later-target:
  62. : > zardoz
  63. DISTCLEANFILES = zardoz
  64. END
  65. using_gmake || $MAKE Makefile
  66. $MAKE
  67. test -f foo
  68. test -f oof
  69. test -f sub/foo2
  70. test -f bar
  71. test -f sub/zardoz
  72. $MAKE distcheck
  73. :