2
0

yflags-cmdline-override.sh 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. #! /bin/sh
  2. # Copyright (C) 2011-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 automake can cope with user-redefinition of $(YFLAGS)
  17. # at configure time and/or at make time.
  18. required='cc yacc'
  19. . test-init.sh
  20. cat >> configure.ac <<'END'
  21. AC_PROG_CC
  22. AC_PROG_YACC
  23. AC_OUTPUT
  24. END
  25. cat > Makefile.am <<'END'
  26. bin_PROGRAMS = foo
  27. foo_SOURCES = foo.y
  28. # A minor automake wart: automake doesn't generate code to clean
  29. # '*.output' files generated by yacc (it's not even clear if that
  30. # would be useful in general, so it's probably better to be
  31. # conservative).
  32. CLEANFILES = foo.output
  33. # As the '-d' flag won't be given at automake time, automake won't
  34. # be able to generate code to clean 'foo.h'. We can't really blame
  35. # automake for that.
  36. MAINTAINERCLEANFILES = foo.h
  37. END
  38. cat > foo.y << 'END'
  39. %{
  40. int yylex () { return 0; }
  41. void yyerror (char *s) { return; }
  42. int main () { return 0; }
  43. %}
  44. %%
  45. foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
  46. END
  47. $ACLOCAL
  48. $AUTOMAKE -a
  49. $AUTOCONF
  50. ./configure YFLAGS='-d -v'
  51. $MAKE
  52. ls -l
  53. test -f foo.c
  54. test -f foo.h
  55. test -f foo.output
  56. $MAKE maintainer-clean
  57. ls -l
  58. ./configure YFLAGS='-v'
  59. $MAKE
  60. ls -l
  61. test -f foo.c
  62. test ! -e foo.h
  63. test -f foo.output
  64. $MAKE maintainer-clean
  65. ls -l
  66. ./configure YFLAGS='-v'
  67. run_make YFLAGS=-d
  68. ls -l
  69. test -f foo.c
  70. test -f foo.h
  71. test ! -e foo.output
  72. $MAKE maintainer-clean
  73. ls -l
  74. :