tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / libobj12.sh
1 #! /bin/sh
2 # Copyright (C) 2002-2013 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 # Test if a file can be mentioned in LIBOBJS and explicitly.
18 # (See libobj13.sh for the LTLIBRARIES check.)
19
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 AC_PROG_CC
24 AM_PROG_AR
25 AC_PROG_RANLIB
26 AC_LIBOBJ([foo])
27 AC_LIBOBJ([bar])
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am << 'END'
32 noinst_LIBRARIES = libfoo.a libbar.a
33 noinst_PROGRAMS = p1 p2
34
35 libfoo_a_SOURCES =
36 libfoo_a_LIBADD = @LIBOBJS@
37
38 libbar_a_SOURCES = foo.c
39
40 p1_SOURCES =
41 p1_LDADD = @LIBOBJS@
42
43 p2_SOURCES = bar.c
44 END
45
46 : > ar-lib
47 : > foo.c
48 : > bar.c
49
50 $ACLOCAL
51
52 # This however should be diagnosed, since foo.c and bar.c are in @LIBOBJS@.
53 cat >> Makefile.am << 'END'
54 libfoo_a_SOURCES += foo.c
55 p1_SOURCES += bar.c
56 END
57
58 AUTOMAKE_fails
59 grep 'foo\.c.*explicitly mentioned' stderr
60 grep 'bar\.c.*explicitly mentioned' stderr
61
62 # Global 'LDADD' can also come into play.
63 cat > Makefile.am << 'END'
64 noinst_PROGRAMS = a b
65 LDADD = @LIBOBJS@
66 END
67
68 $AUTOMAKE
69 grep 'a_DEPENDENCIES.*LIBOBJS' Makefile.in
70
71 cat >> Makefile.am << 'END'
72 a_SOURCES = foo.c
73 END
74 AUTOMAKE_fails
75 grep 'foo\.c.*explicitly mentioned' stderr
76
77 :