suffix8.tap 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #! /bin/sh
  2. # Copyright (C) 2002-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 multiple derivations for the
  17. # same suffix.
  18. # From PR/37.
  19. required='cc libtoolize'
  20. . test-init.sh
  21. plan_ 10
  22. cat >>configure.ac <<'END'
  23. AM_PROG_AR
  24. AM_PROG_LIBTOOL
  25. AC_OUTPUT
  26. END
  27. cat >Makefile.am << 'END'
  28. # $(LINK) is not defined automatically by Automake, since the *_SOURCES
  29. # variables don't contain any known extension (.c, .cc, .f ...),
  30. # So we need this hack.
  31. LINK = :
  32. bin_PROGRAMS = foo
  33. lib_LTLIBRARIES = libfoo.la
  34. foo_SOURCES = foo.x_
  35. libfoo_la_SOURCES = bar.x_
  36. # The elaborate cp commands below account for VPATH issues on
  37. # weaker make implementations (e.g. IRIX 6.5).
  38. .x_.y_:
  39. cp `test -f '$<' || echo $(srcdir)/`$< $@
  40. .y_.o:
  41. cp `test -f '$<' || echo $(srcdir)/`$< $@
  42. .y_.obj:
  43. cp `test -f '$<' || echo $(srcdir)/`$< $@
  44. .y_.z_:
  45. cp `test -f '$<' || echo $(srcdir)/`$< $@
  46. .z_.lo:
  47. cp `test -f '$<' || echo $(srcdir)/`$< $@
  48. # Some make implementations don't remove intermediate files
  49. # automatically, thus causing "make distcheck" to fail if
  50. # this is not added.
  51. MOSTLYCLEANFILES = *.y_ *.z_
  52. .PHONY: test0 test1 test2
  53. test0:
  54. echo $(foo_OBJECTS) | grep '^foo\.foo$$'
  55. echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
  56. test1:
  57. echo $(foo_OBJECTS) | grep '^foo\.$(OBJEXT)$$'
  58. echo $(libfoo_la_OBJECTS) | grep '^bar\.lo$$'
  59. test2: $(foo_OBJECTS) $(libfoo_la_OBJECTS)
  60. test -f foo.$(OBJEXT)
  61. test -f bar.lo
  62. check-local: test1 test2
  63. END
  64. echo 'int main (void) { return 0; }' > foo.x_
  65. echo 'int bar (void) { return 0; }' > bar.x_
  66. # We must protect the TAP driver from the output of configure, since
  67. # that might output a stray "ok" on a line of its own (due to a
  68. # libtool bug on Mac OS X), thus causing a spurious test result to
  69. # be seen. See automake bug#11897.
  70. protect_output ()
  71. {
  72. st=0; "$@" >output 2>&1 || st=1
  73. sed 's/^/ /' output
  74. test $st -eq 0
  75. }
  76. command_ok_ "libtoolize" libtoolize
  77. command_ok_ "aclocal" $ACLOCAL
  78. command_ok_ "autoconf" $AUTOCONF
  79. command_ok_ "automake" $AUTOMAKE -a
  80. command_ok_ "configure" protect_output ./configure
  81. command_ok_ "make test0" run_make OBJEXT=foo test0
  82. command_ok_ "make test1" $MAKE test1
  83. directive=''; make_can_chain_suffix_rules || directive=TODO
  84. for target in test2 all distcheck; do
  85. command_ok_ "make $target" \
  86. -D "$directive" -r "suffix rules not chained" \
  87. protect_output $MAKE $target
  88. done
  89. :