Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / target-cflags.test
blob14ca79dc3e10d804ca652c1b1d3e6dd39dfd6a15
1 #! /bin/sh
2 # Copyright (C) 2000, 2001, 2002, 2004 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 # Test to make sure target specific CFLAGS work
18 # Assar Westerlund <assar@sics.se>
20 required=gcc
21 . ./defs || Exit 1
23 cat > configure.in << 'END'
24 AC_INIT(foo.c)
25 AM_INIT_AUTOMAKE(target-cflags,0.0)
26 AC_PROG_CC
27 AM_PROG_CC_C_O
28 AC_OUTPUT(Makefile)
29 END
31 cat > Makefile.am << 'END'
32 AUTOMAKE_OPTIONS = foreign no-dependencies
34 bin_PROGRAMS = foo bar
35 foo_CFLAGS = -DFOO
36 END
38 cat > foo.c << 'END'
39 #include <stdio.h>
40 #ifdef FOO
41 int main(void) {
42 return 0;
44 #endif
45 END
47 cat > bar.c << 'END'
48 #ifndef FOO
49 int main(void)
51 return 0;
53 #endif
54 END
56 set -e
58 $ACLOCAL
59 $AUTOCONF
60 $AUTOMAKE -a
61 mkdir build
63 cd build
64 ../configure
65 $MAKE
66 ./foo
67 ./bar
68 cd ..
70 ./configure
71 $MAKE
72 ./foo
73 ./bar