Merge branch 'maint'
[platform/upstream/automake.git] / t / lex-subobj-nodep.sh
1 #! /bin/sh
2 # Copyright (C) 2011-2012 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
17 # Ensure subdirs for subdir scanners are generated when subdir-objects
18 # are used, even when dependency tracking is disabled.
19
20 required='cc lex'
21 . ./defs || exit 1
22
23 cat >>configure.ac <<\END
24 AC_PROG_CC
25 AM_PROG_CC_C_O
26 AC_PROG_LEX
27 AC_OUTPUT
28 END
29
30 cat >Makefile.am <<\END
31 AUTOMAKE_OPTIONS = subdir-objects
32 bin_PROGRAMS = p1 p2
33 p1_SOURCES = sub1/s1.l
34 p2_SOURCES = sub2/s2.l
35 p2_CPPFLAGS = -DWHATEVER
36 END
37
38 mkdir sub1 sub2
39
40 cat >sub1/s1.l <<\END
41 %{
42 #define YY_NO_UNISTD_H 1
43 %}
44 %%
45 "END"   return EOF;
46 .
47 %%
48 int main (void)
49 {
50   while (yylex () != EOF)
51     ;
52   return 0;
53 }
54
55 int yywrap(void)
56 {
57   return 1;
58 }
59 END
60
61 cp sub1/s1.l sub2/s2.l
62
63 $ACLOCAL
64 $AUTOCONF
65 $AUTOMAKE -a
66 mkdir build
67 cd build
68 ../configure --disable-dependency-tracking
69 $MAKE sub1/s1.c
70 $MAKE sub2/s2.c
71 rm -rf sub1 sub2
72 $MAKE
73
74 :