Merge branch 'msvc'
[platform/upstream/automake.git] / tests / subobj6.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003, 2004, 2010 Free Software Foundation,
3 # Inc.
4 #
5 # This program is free software; you can redistribute it and/or modify
6 # it under the terms of the GNU General Public License as published by
7 # the Free Software Foundation; either version 2, or (at your option)
8 # any later version.
9 #
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 # GNU General Public License for more details.
14 #
15 # You should have received a copy of the GNU General Public License
16 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
17
18 # Test of subdir make distclean rules.
19 # From Robert Collins
20
21 required=gcc
22 . ./defs || Exit 1
23
24 set -e
25
26 cat >> configure.in << 'END'
27 AM_PROG_CC_C_O
28 AC_OUTPUT
29 END
30
31 cat > Makefile.am << 'END'
32 AUTOMAKE_OPTIONS = subdir-objects
33 bin_PROGRAMS = wish
34 wish_SOURCES = generic/a.c
35
36 test-all: all
37         test -f generic/$(am__dirstamp)
38 test-mostlyclean: mostlyclean
39         test ! -f generic/a.o
40 test-distclean: distclean
41         test ! -f generic/$(am__dirstamp)
42 END
43
44 mkdir generic
45 cat > generic/a.c << 'END'
46 #include <stdio.h>
47 int main ()
48 {
49    printf ("maude!\n");
50    return 0;
51 }
52 END
53
54 $ACLOCAL
55 $AUTOCONF
56 $AUTOMAKE --include-deps --copy --add-missing
57
58 mkdir build
59 cd build
60
61 ../configure
62 $MAKE test-all
63 $MAKE test-mostlyclean
64 $MAKE test-distclean
65
66 cd ..
67
68 # Now test without the subdir.
69 cat > Makefile.am << 'END'
70 AUTOMAKE_OPTIONS = subdir-objects
71 bin_PROGRAMS = wish
72 wish_SOURCES = a.c
73 END
74
75 mv generic/a.c a.c
76
77 $ACLOCAL
78 $AUTOCONF
79 $AUTOMAKE --include-deps --copy --add-missing
80
81 mkdir build2
82 cd build2
83
84 ../configure
85 $MAKE
86 $MAKE mostlyclean
87
88 :