yacc-depend2.sh 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. # Make sure depcomp does not needlessly update headers and objects
  17. # for yacc rules. This test still fails with FreeBSD make (but passes
  18. # with NetBSD make).
  19. required='cc yacc'
  20. . test-init.sh
  21. cat >> configure.ac << 'END'
  22. AC_PROG_CC
  23. AC_PROG_YACC
  24. AC_OUTPUT
  25. END
  26. cat > Makefile.am << 'END'
  27. bin_PROGRAMS = foo
  28. AM_YFLAGS = -d
  29. foo_SOURCES = foo.y main.c
  30. BUILT_SOURCES = foo.h
  31. .PHONY: test-time-unchanged test-time-changed
  32. test-time-unchanged:
  33. is_newest foo.y foo.h main.$(OBJEXT)
  34. test-time-changed:
  35. is_newest main.$(OBJEXT) foo.y foo.h
  36. END
  37. cat > foo.y << 'END'
  38. %{
  39. int yylex () { return 0; }
  40. void yyerror (char *s) { return; }
  41. %}
  42. %token TOKEN
  43. %%
  44. foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
  45. END
  46. cat > main.c << 'END'
  47. #include "foo.h"
  48. int main(void)
  49. {
  50. return yyparse ();
  51. }
  52. END
  53. $ACLOCAL
  54. $AUTOCONF
  55. $AUTOMAKE -a
  56. # Try to enable dependency tracking if possible, even if that means
  57. # using slow dependency extractors.
  58. ./configure --enable-dependency-tracking
  59. $MAKE
  60. ls -l # For debugging.
  61. $sleep
  62. touch foo.y
  63. $MAKE
  64. $MAKE test-time-unchanged
  65. $sleep
  66. sed 's/TOKEN/TEKON/g' foo.y > t
  67. mv -f t foo.y
  68. $MAKE
  69. $MAKE test-time-changed
  70. :