Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / subobjname.test
blobc474a413b218f71d1c9e218e111160603feec57c
1 #! /bin/sh
2 # Copyright (C) 2002 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 3, or (at your option)
7 # any later version.
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 # Make sure we reuse variables whenever possible, to limit
18 # combinational explosion. (This test is named after the &subobjname
19 # sub in Automake).
21 . ./defs || Exit 1
23 set -e
25 cat >> configure.in << 'END'
26 AC_PROG_CC
27 AM_CONDITIONAL([FOO1], [some test])
28 AM_CONDITIONAL([FOO2], [some test])
29 AM_CONDITIONAL([FOO3], [some test])
30 AC_OUTPUT
31 END
33 cat > Makefile.am << 'END'
34 noinst_PROGRAMS = c d
36 if FOO1
37 A1=a1.c
38 endif
40 if FOO2
41 A2=a2.c
42 endif
44 if FOO3
45 A3=a3.c
46 endif
48 B=$(A1) $(A2) $(A3)
50 c_SOURCES=$(B)
51 d_SOURCES=$(B)
52 END
54 $ACLOCAL
55 $AUTOMAKE -a
57 # Sanity check: make sure am_c_OBJECTS and am_d_OBJECTS are used
58 # in the Makefile. (This is an internal detail, so better make
59 # sure we update this test if the naming changes in the future.)
60 grep '^am_c_OBJECTS = ' Makefile.in
61 grep '^am_d_OBJECTS = ' Makefile.in
63 # Now the actual test. Are both values equal?
64 cobj=`sed -n '/^am_c_OBJECTS = / {
65 s/.* = \(.*\)$/\1/
67 }' Makefile.in`
68 dobj=`sed -n '/^am_d_OBJECTS = / {
69 s/^.* = \(.*\)$/\1/
71 }' Makefile.in`
72 test "$cobj" = "$dobj"