Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / suffix13.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2006, 2009, 2010, 2011 Free Software
3 # Foundation, Inc.
4 #
5 # This file is part of GNU Automake.
6 #
7 # GNU Automake is free software; you can redistribute it and/or modify
8 # it under the terms of the GNU General Public License as published by
9 # the Free Software Foundation; either version 2, or (at your option)
10 # any later version.
11 #
12 # GNU Automake is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License
18 # along with Automake; see the file COPYING.  If not, write to
19 # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20 # Boston, MA 02110-1301, USA.
21
22 # Tests that Automake understands suffix rules with renamed objects
23 # and subdir objects.
24 # Reported by Florian Briegel.
25
26 . ./defs || Exit 1
27
28 set -e
29
30 cat >>configure.in <<EOF
31 AC_PROG_CC
32 AM_PROG_CC_C_O
33 AC_OUTPUT
34 EOF
35
36 cat >Makefile.am << 'END'
37 AUTOMAKE_OPTIONS = subdir-objects
38 SUFFIXES = .baz .c
39 .baz.c:
40         case $@ in sub/*) $(MKDIR_P) sub;; *) :;; esac
41 ## Account for VPATH issues on weaker make implementations (e.g. IRIX 6.5)
42         cp `test -f '$<' || echo $(srcdir)/`$< $@
43
44 DISTCLEANFILES = sub/bar.c
45
46 bin_PROGRAMS = foo
47 foo_SOURCES = foo.c sub/bar.baz
48 foo_CFLAGS =
49 END
50
51 mkdir sub
52 cat > sub/bar.baz <<'END'
53 extern int foo ();
54 int main () { return foo (); }
55 END
56 cat > foo.c <<'END'
57 int foo () { return 0; }
58 END
59
60 $ACLOCAL
61 $AUTOCONF
62 $AUTOMAKE -a
63 ./configure
64 $MAKE
65
66 $MAKE distcheck
67 $MAKE distclean
68
69 # Should also work without subdir-objects
70
71 sed '/subdir-objects/d' < Makefile.am > t
72 mv -f t Makefile.am
73 $AUTOMAKE --force
74 ./configure
75 $MAKE
76 $MAKE distcheck
77
78 :