2 # Copyright (C) 2010-2013 Free Software Foundation, Inc.
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)
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.
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/>.
17 # Check that $(LFLAGS) takes precedence over both $(AM_LFLAGS) and
19 # Please keep this in sync with the sister tests lflags.sh, yflags.sh
26 echo '/*' "$*" '*/' >lex.yy.c
27 echo 'extern int dummy;' >> lex.yy.c
31 cat >> configure.ac <<'END'
32 AC_SUBST([CXX], [false])
33 # Simulate presence of Lex using our fake-lex script.
34 AC_SUBST([LEX], ['$(abs_top_srcdir)'/fake-lex])
35 AC_SUBST([LEX_OUTPUT_ROOT], [lex.yy])
36 AC_SUBST([LEXLIB], [''])
40 cat > Makefile.am <<'END'
41 AUTOMAKE_OPTIONS = no-dependencies
42 bin_PROGRAMS = foo bar
43 foo_SOURCES = main.cc foo.ll
44 bar_SOURCES = main.cc bar.l++
45 AM_LFLAGS = __am_flags__
46 bar_LFLAGS = __bar_flags__
52 grep '\$(LFLAGS).*\$(bar_LFLAGS)' Makefile.in && exit 1
53 grep '\$(LFLAGS).*\$(AM_LFLAGS)' Makefile.in && exit 1
60 run_make LFLAGS=__user_flags__ foo.cc bar-bar.c++
65 grep '__am_flags__.*__user_flags__' foo.cc
66 grep '__bar_flags__.*__user_flags__' bar-bar.c++