suffix6b.sh 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 to make sure Automake supports implicit rules with dot-less
  17. # extensions. Se also related "grepping" test 'suffix6.sh'.
  18. required=GNUmake # Other makes might not grok dot-less suffix rules.
  19. . test-init.sh
  20. cat >> configure.ac << 'END'
  21. # $(LINK) is not defined automatically by Automake, since the *_SOURCES
  22. # variables don't contain any known extension (.c, .cc, .f, ...).
  23. # So we need this hack -- but since such an hack can also serve as a
  24. # mild stress test, that's ok.
  25. AC_SUBST([LINK], ['cat >$@'])
  26. AC_SUBST([OBJEXT], [oOo])
  27. AC_SUBST([EXEEXT], [.XxX])
  28. AC_OUTPUT
  29. END
  30. cat > Makefile.am << 'END'
  31. SUFFIXES = a b c .$(OBJEXT)
  32. bin_PROGRAMS = foo
  33. foo_SOURCES = fooa
  34. ab:
  35. { echo '=ab=' && cat $<; } >$@
  36. bc:
  37. { echo '=bc=' && cat $<; } >$@
  38. c.$(OBJEXT):
  39. { echo '=b.obj=' && cat $<; } >$@
  40. test:
  41. : For debugging.
  42. ls -l
  43. : Implicit intermediate files should be removed by GNU make ...
  44. test ! -r foob
  45. test ! -r fooc
  46. : ... but object files should not.
  47. cat foo.$(OBJEXT)
  48. : For debugging.
  49. cat foo.XxX
  50. : Now check that the chain of implicit rules has been executed
  51. : completely and in the correct order.
  52. (echo =b.obj= && echo =bc= && echo =ab= && echo =src=) > exp
  53. diff exp foo.XxX
  54. rm -f exp
  55. .PHONY: test
  56. check-local: test
  57. END
  58. $ACLOCAL
  59. $AUTOCONF
  60. $AUTOMAKE
  61. ./configure
  62. echo =src= > fooa
  63. $MAKE
  64. $MAKE test
  65. $MAKE distcheck
  66. :