lex-subobj-nodep.sh 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  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. # Ensure subdirs for subdir scanners are generated when subdir-objects
  17. # are used, even when dependency tracking is disabled.
  18. required='cc lex'
  19. . test-init.sh
  20. cat >>configure.ac <<\END
  21. AC_PROG_CC
  22. AC_PROG_LEX
  23. AC_OUTPUT
  24. END
  25. cat >Makefile.am <<\END
  26. AUTOMAKE_OPTIONS = subdir-objects
  27. bin_PROGRAMS = p1 p2
  28. p1_SOURCES = sub1/s1.l
  29. p2_SOURCES = sub2/s2.l
  30. p2_CPPFLAGS = -DWHATEVER
  31. END
  32. mkdir sub1 sub2
  33. cat >sub1/s1.l <<\END
  34. %{
  35. #define YY_NO_UNISTD_H 1
  36. %}
  37. %%
  38. "END" return EOF;
  39. .
  40. %%
  41. int main (void)
  42. {
  43. while (yylex () != EOF)
  44. ;
  45. return 0;
  46. }
  47. int yywrap(void)
  48. {
  49. return 1;
  50. }
  51. END
  52. cp sub1/s1.l sub2/s2.l
  53. $ACLOCAL
  54. $AUTOCONF
  55. $AUTOMAKE -a
  56. mkdir build
  57. cd build
  58. ../configure --disable-dependency-tracking
  59. $MAKE sub1/s1.c
  60. $MAKE sub2/s2.c
  61. rm -rf sub1 sub2
  62. $MAKE
  63. :