subobj6.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #! /bin/sh
  2. # Copyright (C) 2001-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. # Test of subdir make distclean rules.
  17. # From Robert Collins.
  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. AUTOMAKE_OPTIONS = subdir-objects
  26. bin_PROGRAMS = wish
  27. wish_SOURCES = generic/a.c
  28. test-all: all
  29. test -f generic/$(am__dirstamp)
  30. test-mostlyclean: mostlyclean
  31. test ! -f generic/a.o
  32. test-distclean: distclean
  33. test ! -f generic/$(am__dirstamp)
  34. END
  35. mkdir generic
  36. cat > generic/a.c << 'END'
  37. #include <stdio.h>
  38. int main ()
  39. {
  40. printf ("maude!\n");
  41. return 0;
  42. }
  43. END
  44. $ACLOCAL
  45. $AUTOCONF
  46. $AUTOMAKE --include-deps --copy --add-missing
  47. mkdir build
  48. cd build
  49. ../configure
  50. $MAKE test-all
  51. $MAKE test-mostlyclean
  52. $MAKE test-distclean
  53. cd ..
  54. # Now test without the subdir.
  55. cat > Makefile.am << 'END'
  56. AUTOMAKE_OPTIONS = subdir-objects
  57. bin_PROGRAMS = wish
  58. wish_SOURCES = a.c
  59. END
  60. mv generic/a.c a.c
  61. $ACLOCAL
  62. $AUTOCONF
  63. $AUTOMAKE --include-deps --copy --add-missing
  64. mkdir build2
  65. cd build2
  66. ../configure
  67. $MAKE
  68. $MAKE mostlyclean
  69. :