summaryrefslogtreecommitdiff
path: root/tests/specflg-dummy.test
blob: ae6473a8b9b279f011eaa9dc5e2b83d9998d3985 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
#! /bin/sh
# Copyright (C) 2011-2012 Free Software Foundation, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

# Check that even "dummy" per-target flags triggers the use of renamed
# objects.  I.e., a definition like `foo_CFLAGS = $(AM_CFLAGS)' should
# always cause Automake to trigger the semantics for per-target CFLAGS,
# even if AM_CFLAGS is undefined. Similarly for other *FLAGS variables
# (CXXFLAGS, YFLAGS, LDFLAGS, ...)

. ./defs || Exit 1

# Disable shell globbing if possible.
(set +f) >/dev/null 2>&1 && set +f

oIFS=$IFS
nl='
'

matches=
add_match ()
{
  matches="$matches$nl$1"
}

do_check ()
{
  IFS=$nl
  for string in $matches; do
    IFS=$oIFS
    $FGREP "$string" Makefile.in
  done
  IFS=$oIFS
}

# Fake libtool presence, so that we won't have to require it.
cat > acinclude.m4 <<END
AC_DEFUN([AC_PROG_LIBTOOL], [AC_SUBST([LIBTOOL], [dummy])])
END
: > ltmain.sh

cat >> configure.ac << 'END'
AC_PROG_CC
AC_PROG_CXX
AC_PROG_YACC
AC_PROG_LEX
AC_PROG_F77
AC_PROG_FC
AM_PROG_GCJ
AM_PROG_AR
AC_PROG_RANLIB
AC_PROG_LIBTOOL
AM_PROG_UPC
AC_PROG_OBJC
AM_PROG_CC_C_O
END

cat > Makefile.am <<'END'
bin_PROGRAMS =
lib_LIBRARIES =
lib_LTLIBRARIES =
END

$ACLOCAL

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog1
prog1_SOURCES = source1.c
prog1_CFLAGS = $(AM_CFLAGS)
END

add_match 'prog1-source1.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog2
prog2_SOURCES = source2.c
prog2_CPPFLAGS = $(AM_CPPFLAGS)
END

add_match 'prog2-source2.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog3
prog3_SOURCES = source3.cxx
prog3_CXXFLAGS = $(AM_CXXFLAGS)
END

add_match 'prog3-source3.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog4
prog4_SOURCES = source4.c++
prog4_CPPFLAGS = $(AM_CPPFLAGS)
END

add_match 'prog4-source4.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog5
prog5_SOURCES = source5.f
prog5_FFLAGS = $(AM_FFLAGS)
END

add_match 'prog5-source5.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog6
prog6_SOURCES = source6.f90
prog6_FCFLAGS = $(AM_FCFLAGS)
END

add_match 'prog6-source6.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog7
prog7_SOURCES = source7.r
prog7_RFLAGS = $(AM_RFLAGS)
END

add_match 'prog7-source7.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog8
prog8_SOURCES = source8.java
prog8_GCJFLAGS = $(AM_GCJFLAGS)
END

add_match 'prog8-source8.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog9
prog9_SOURCES = source9.upc
prog9_UPCFLAGS = $(AM_UPCFLAGS)
END

add_match 'prog9-source9.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += prog10
prog10_SOURCES = source10.m
prog10_OBJCFLAGS = $(AM_OBJCFLAGS)
END

add_match 'prog10-source10.$(OBJEXT)'

cat >> Makefile.am <<'END'
bin_PROGRAMS += linkprog
linkprog_SOURCES = linkprog.c
linkprog_LDFLAGS = $(AM_LDFLAGS)
END

add_match 'linkprog_LINK ='

cat >> Makefile.am <<'END'
lib_LIBRARIES += libstatic.a
libstatic_a_SOURCES = static123.c
libstatic_a_CFLAGS = $(AM_CFLAGS)
END

add_match 'libstatic_a-static123.$(OBJEXT)'

cat >> Makefile.am <<'END'
lib_LTLIBRARIES += libshared1.la
libshared1_la_SOURCES = shared1.c
libshared1_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS)
END

add_match 'libshared1_la-shared1.lo'

cat >> Makefile.am <<'END'
lib_LTLIBRARIES += libshared2.la
libshared2_la_SOURCES = shared2.cc
libshared2_la_CXXFLAGS = $(AM_CXXFLAGS)
END

add_match 'libshared2_la-shared2.lo'

cat >> Makefile.am <<'END'
bin_PROGRAMS += parse1
parse1_SOURCES = parse.y
parse1_YFLAGS = $(AM_YFLAGS)
END

add_match 'parse1-parse.c'

cat >> Makefile.am <<'END'
bin_PROGRAMS += parse2
parse2_SOURCES = parse.ypp
parse2_YFLAGS = $(AM_YFLAGS)
END

add_match 'parse2-parse.cpp'

cat >> Makefile.am <<'END'
bin_PROGRAMS += lexer1
lexer1_SOURCES = lex.l
lexer1_LFLAGS = $(AM_YFLAGS)
END

add_match 'lexer1-lex.c'

cat >> Makefile.am <<'END'
bin_PROGRAMS += lexer2
lexer2_SOURCES = lexer.ll
lexer2_LFLAGS = $(AM_YFLAGS)
END

add_match 'lexer2-lexer.cc'

# For debugging.
cat Makefile.am

$AUTOMAKE -a
do_check

sed '
  s|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/|
  s|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/|
  s|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/|
  s|^\(.*\)FLAGS *=|sub_\1FLAGS =|
' Makefile.am > t

cat - t > Makefile.am <<'END'
AUTOMAKE_OPTIONS = subdir-objects
END

rm -f t

# For debugging.
cat Makefile.am

$AUTOMAKE
do_check

: