1#! /bin/sh 2# Copyright (C) 2002-2021 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 <https://www.gnu.org/licenses/>. 16 17# Test for subdir lexers. 18 19required='cc lex' 20. test-init.sh 21 22cat >> configure.ac << 'END' 23AC_PROG_CC 24AM_PROG_LEX 25AC_OUTPUT 26END 27 28cat > Makefile.am << 'END' 29AUTOMAKE_OPTIONS = subdir-objects 30LDADD = @LEXLIB@ 31 32bin_PROGRAMS = foo/foo 33foo_foo_SOURCES = foo/foo.l 34END 35 36mkdir foo 37 38cat > foo/foo.l << 'END' 39%{ 40#define YY_NO_UNISTD_H 1 41%} 42%% 43"END" return EOF; 44. 45%% 46int 47main () 48{ 49 while (yylex () != EOF) 50 ; 51 52 return 0; 53} 54END 55 56$ACLOCAL 57$AUTOCONF 58$AUTOMAKE -a 59 60# We expect ylwrap to be used and distributed even if there is 61# only one lexer. 62test -f ylwrap 63 64mkdir sub 65cd sub 66../configure 67$MAKE foo/foo.o 68ls -l # For debugging. 69 70test -f foo/foo.c 71test -f foo/foo.o 72 73# Now, adds another lexer to test ylwrap. 74 75cd .. 76cp foo/foo.l foo/foo2.l 77cat >> Makefile.am << 'END' 78EXTRA_foo_foo_SOURCES = foo/foo2.l 79END 80 81# Make sure Makefile.in has a new time stamp: the rebuild rules are 82# used below. We do this after updating Makefile.am, that way we can 83# ensure that automake, even with --no-force, is not confused if the 84# new Makefile.am has the same time stamp as the older one (since the 85# output will change, --no-force should have no effect). 86$sleep 87 88$AUTOMAKE -a --no-force 89 90cd sub 91using_gmake || $MAKE Makefile 92$MAKE foo/foo2.o 93ls -l # For debugging. 94test -f foo/foo2.c 95test -f foo/foo2.o 96 97: 98