| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133 | #!/bin/sh# Copyright (C) 2010-2017 Free Software Foundation, Inc.## This program is free software; you can redistribute it and/or modify# it under the terms of the GNU General Public License as published by# the Free Software Foundation; either version 2, or (at your option)# any later version.## This program is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the# GNU General Public License for more details.## You should have received a copy of the GNU General Public License# along with this program.  If not, see <http://www.gnu.org/licenses/>.# Check silent-rules mode for Lex.required='cc lex'. test-init.shmkdir subcat >>configure.ac <<'EOF'AC_PROG_LEXAC_CONFIG_FILES([sub/Makefile])AC_OUTPUTEOFcat > Makefile.am <<'EOF'# Need generic and non-generic rules.bin_PROGRAMS = foo1 foo2foo1_SOURCES = foo.lfoo2_SOURCES = $(foo1_SOURCES)foo2_LFLAGS = -nfoo2_CFLAGS = $(AM_CFLAGS)SUBDIRS = subLDADD = $(LEXLIB)EOFcat > sub/Makefile.am <<'EOF'AUTOMAKE_OPTIONS = subdir-objects# Need generic and non-generic rules.bin_PROGRAMS = bar1 bar2bar1_SOURCES = bar.lbar2_SOURCES = $(bar1_SOURCES)bar2_LFLAGS = -nbar2_CFLAGS = $(AM_CFLAGS)LDADD = $(LEXLIB)EOFcat > foo.l <<'EOF'%{#define YY_NO_UNISTD_H 1%}%%"END"   return EOF;.%%/* Avoid possible link errors. */int yywrap (void) { return 1; }int   main (void) { return 0; }EOFcp foo.l sub/bar.l$ACLOCAL$AUTOMAKE --add-missing$AUTOCONF# Ensure per-target rules are used, to ensure their coverage below.$FGREP 'foo2-foo.c' Makefile.in || exit 99$FGREP 'bar2-bar.c' sub/Makefile.in || exit 99./configure --enable-silent-rulesrun_make -O$EGREP ' (-c|-o)' stdout && exit 1$EGREP '(mv|ylwrap) ' stdout && exit 1grep 'LEX .*foo\.' stdoutgrep 'LEX .*bar\.' stdoutgrep ' CC .*foo\.' stdoutgrep ' CC .*bar\.' stdoutgrep 'CCLD .*foo1' stdoutgrep 'CCLD .*bar1' stdoutgrep 'CCLD .*foo2' stdoutgrep 'CCLD .*bar2' stdout# Cleaning and then rebuilding with the same V flag (and without# removing the generated sources in between) shouldn't trigger a# different set of rules.$MAKE cleanrun_make -O$EGREP ' (-c|-o)' stdout && exit 1$EGREP '(mv|ylwrap) ' stdout && exit 1# Don't look for LEX, as probably lex hasn't been re-run.grep ' CC .*foo\.' stdoutgrep ' CC .*bar\.' stdoutgrep 'CCLD .*foo1' stdoutgrep 'CCLD .*bar1' stdoutgrep 'CCLD .*foo2' stdoutgrep 'CCLD .*bar2' stdout# Ensure a truly clean rebuild.$MAKE cleanrm -f *foo.c sub/*bar.crun_make -O V=1grep ' -c ' stdoutgrep ' -o ' stdoutgrep 'ylwrap ' stdout$EGREP '(LEX|CC|CCLD) ' stdout && exit 1# Cleaning and then rebuilding with the same V flag (and without# removing the generated sources in between) shouldn't trigger a# different set of rules.$MAKE cleanrun_make -O V=1# Don't look for ylwrap, as probably lex hasn't been re-run.grep ' -c ' stdoutgrep ' -o ' stdout$EGREP '(LEX|CC|CCLD) ' stdout && exit 1:
 |