suffix6c.sh 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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 that '.o' and '.obj' are handled like '.$(OBJEXT)'.
  17. # See also related "grepping" test 'suffix6.sh'.
  18. . test-init.sh
  19. cat >> configure.ac << 'END'
  20. # $(LINK) is not defined automatically by Automake, since the *_SOURCES
  21. # variables don't contain any known extension (.c, .cc, .f ...),
  22. # So we need this hack -- but since such an hack can also serve as a
  23. # mild stress test, that's ok.
  24. OBJEXT=${OBJEXT-oOo}
  25. AC_SUBST([LINK], ['cat >$@'])
  26. AC_SUBST([EXEEXT], [.XxX])
  27. AC_SUBST([OBJEXT])
  28. AC_OUTPUT
  29. END
  30. unset OBJEXT
  31. cat > Makefile.am << 'END'
  32. SUFFIXES = .zoo .o .obj .@OBJEXT@
  33. bin_PROGRAMS = foo
  34. foo_SOURCES = foo.zoo
  35. .zoo.o:
  36. { echo '=.zoo.o=' && cat $<; } >$@
  37. .zoo.obj:
  38. { echo '=.zoo.obj=' && cat $<; } >$@
  39. .zoo.@OBJEXT@:
  40. { echo '=.zoo.@OBJEXT@=' && cat $<; } >$@
  41. END
  42. $ACLOCAL
  43. $AUTOCONF
  44. $AUTOMAKE
  45. ./configure
  46. cat > foo.exp <<'END'
  47. =.zoo.oOo=
  48. %ONE%
  49. END
  50. echo %ONE% > foo.zoo
  51. $MAKE
  52. cat foo.oOo
  53. cat foo.XxX
  54. diff foo.XxX foo.exp
  55. rm -f foo.* exp
  56. cat > foo.exp <<'END'
  57. =.zoo.o=
  58. %TWO%
  59. END
  60. echo %TWO% > foo.zoo
  61. run_make OBJEXT=o
  62. cat foo.o
  63. cat foo.XxX
  64. diff foo.XxX foo.exp
  65. rm -f foo.* exp
  66. cat > foo.exp <<'END'
  67. =.zoo.obj=
  68. %THREE%
  69. END
  70. echo %THREE% > foo.zoo
  71. run_make OBJEXT=obj
  72. cat foo.obj
  73. cat foo.XxX
  74. diff foo.XxX foo.exp
  75. rm -f foo.* exp
  76. :