yflags.sh 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #! /bin/sh
  2. # Copyright (C) 2010-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. # Check that $(YFLAGS) takes precedence over both $(AM_YFLAGS) and
  17. # $(foo_YFLAGS).
  18. # Please keep this in sync with the sister tests:
  19. # - yflags-cxx.sh
  20. # - lflags.sh
  21. # - lflags-cxx.sh
  22. . test-init.sh
  23. cat >fake-yacc <<'END'
  24. #!/bin/sh
  25. echo '/*' "$*" '*/' >y.tab.c
  26. echo 'extern int dummy;' >> y.tab.c
  27. END
  28. chmod a+x fake-yacc
  29. cat >> configure.ac <<'END'
  30. AC_SUBST([CC], [false])
  31. # Simulate presence of Yacc using our fake-yacc script.
  32. AC_SUBST([YACC], ['$(abs_top_srcdir)'/fake-yacc])
  33. AC_OUTPUT
  34. END
  35. cat > Makefile.am <<'END'
  36. AUTOMAKE_OPTIONS = no-dependencies
  37. bin_PROGRAMS = foo bar
  38. foo_SOURCES = main.c foo.y
  39. bar_SOURCES = main.c bar.y
  40. AM_YFLAGS = __am_flags__
  41. bar_YFLAGS = __bar_flags__
  42. END
  43. $ACLOCAL
  44. $AUTOMAKE -a
  45. grep '\$(YFLAGS).*\$(bar_YFLAGS)' Makefile.in && exit 1
  46. grep '\$(YFLAGS).*\$(AM_YFLAGS)' Makefile.in && exit 1
  47. : > foo.y
  48. : > bar.y
  49. $AUTOCONF
  50. ./configure
  51. run_make YFLAGS=__user_flags__ foo.c bar-bar.c
  52. cat foo.c
  53. cat bar-bar.c
  54. grep '__am_flags__.*__user_flags__' foo.c
  55. grep '__bar_flags__.*__user_flags__' bar-bar.c
  56. :