tests: cosmetic changes in t/extra-sources.sh
[platform/upstream/automake.git] / t / suffix6c.sh
1 #! /bin/sh
2 # Copyright (C) 2001-2013 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Test to make sure that '.o' and '.obj' are handled like '.$(OBJEXT)'.
18 # See also related "grepping" test 'suffix6.sh'.
19
20 . test-init.sh
21
22 cat >> configure.ac << 'END'
23 # $(LINK) is not defined automatically by Automake, since the *_SOURCES
24 # variables don't contain any known extension (.c, .cc, .f ...),
25 # So we need this hack -- but since such an hack can also serve as a
26 # mild stress test, that's ok.
27 OBJEXT=${OBJEXT-oOo}
28 AC_SUBST([LINK], ['cat >$@'])
29 AC_SUBST([EXEEXT], [.XxX])
30 AC_SUBST([OBJEXT])
31 AC_OUTPUT
32 END
33
34 unset OBJEXT
35
36 cat > Makefile.am << 'END'
37 SUFFIXES = .zoo .o .obj .@OBJEXT@
38
39 bin_PROGRAMS = foo
40 foo_SOURCES = foo.zoo
41
42 .zoo.o:
43         { echo '=.zoo.o=' && cat $<; } >$@
44 .zoo.obj:
45         { echo '=.zoo.obj=' && cat $<; } >$@
46 .zoo.@OBJEXT@:
47         { echo '=.zoo.@OBJEXT@=' && cat $<; } >$@
48 END
49
50 $ACLOCAL
51 $AUTOCONF
52 $AUTOMAKE
53
54 ./configure
55
56 cat > foo.exp <<'END'
57 =.zoo.oOo=
58 %ONE%
59 END
60 echo %ONE% > foo.zoo
61 $MAKE
62 cat foo.oOo
63 cat foo.XxX
64 diff foo.XxX foo.exp
65
66 rm -f foo.* exp
67
68 cat > foo.exp <<'END'
69 =.zoo.o=
70 %TWO%
71 END
72 echo %TWO% > foo.zoo
73 run_make OBJEXT=o
74 cat foo.o
75 cat foo.XxX
76 diff foo.XxX foo.exp
77
78 rm -f foo.* exp
79
80 cat > foo.exp <<'END'
81 =.zoo.obj=
82 %THREE%
83 END
84 echo %THREE% > foo.zoo
85 run_make OBJEXT=obj
86 cat foo.obj
87 cat foo.XxX
88 diff foo.XxX foo.exp
89
90 rm -f foo.* exp
91
92 :