doc: typos in test file.
[automake.git] / t / target-cflags.sh
blob5ce42711e7fbd3be55d2095614ab59cabb3d7b06
1 #! /bin/sh
2 # Copyright (C) 2000-2024 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 2, 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 <https://www.gnu.org/licenses/>.
17 # Test to make sure target specific CFLAGS work
18 # Assar Westerlund <assar@sics.se>
20 required=cc
21 . test-init.sh
23 cat >> configure.ac << 'END'
24 AC_PROG_CC
25 AC_OUTPUT
26 END
28 cat > Makefile.am << 'END'
29 AUTOMAKE_OPTIONS = no-dependencies
31 bin_PROGRAMS = foo bar
32 foo_CFLAGS = -DFOO
33 END
35 cat > foo.c << 'END'
36 #include <stdio.h>
37 #ifdef FOO
38 int main(void)
40 return 0;
42 #endif
43 END
45 cat > bar.c << 'END'
46 #ifndef FOO
47 int main(void)
49 return 0;
51 #endif
52 END
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE -a
57 mkdir build
59 cd build
60 ../configure
61 $MAKE
62 if ! cross_compiling; then
63 ./foo
64 ./bar
66 cd ..
68 ./configure
69 $MAKE
70 if ! cross_compiling; then
71 ./foo
72 ./bar