2 # Copyright (C) 2011-2013 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)
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 <http://www.gnu.org/licenses/>.
17 # Check that even "dummy" per-target flags triggers the use of renamed
18 # objects. I.e., a definition like 'foo_CFLAGS = $(AM_CFLAGS)' should
19 # always cause Automake to trigger the semantics for per-target CFLAGS,
20 # even if AM_CFLAGS is undefined. Similarly for other *FLAGS variables
21 # (CXXFLAGS, YFLAGS, LDFLAGS, ...)
25 # Disable shell globbing if possible.
26 (set +f) >/dev/null 2>&1 && set +f
35 matches="$matches$nl$1"
41 for string in $matches; do
43 $FGREP "$string" Makefile.in
48 # Fake libtool presence, so that we won't have to require it.
49 cat > acinclude.m4 <<END
50 AC_DEFUN([AC_PROG_LIBTOOL], [AC_SUBST([LIBTOOL], [dummy])])
54 cat >> configure.ac << 'END'
69 cat > Makefile.am <<'END'
77 cat >> Makefile.am <<'END'
79 prog1_SOURCES = source1.c
80 prog1_CFLAGS = $(AM_CFLAGS)
83 add_match 'prog1-source1.$(OBJEXT)'
85 cat >> Makefile.am <<'END'
87 prog2_SOURCES = source2.c
88 prog2_CPPFLAGS = $(AM_CPPFLAGS)
91 add_match 'prog2-source2.$(OBJEXT)'
93 cat >> Makefile.am <<'END'
95 prog3_SOURCES = source3.cxx
96 prog3_CXXFLAGS = $(AM_CXXFLAGS)
99 add_match 'prog3-source3.$(OBJEXT)'
101 cat >> Makefile.am <<'END'
102 bin_PROGRAMS += prog4
103 prog4_SOURCES = source4.c++
104 prog4_CPPFLAGS = $(AM_CPPFLAGS)
107 add_match 'prog4-source4.$(OBJEXT)'
109 cat >> Makefile.am <<'END'
110 bin_PROGRAMS += prog5
111 prog5_SOURCES = source5.f
112 prog5_FFLAGS = $(AM_FFLAGS)
115 add_match 'prog5-source5.$(OBJEXT)'
117 cat >> Makefile.am <<'END'
118 bin_PROGRAMS += prog6
119 prog6_SOURCES = source6.f90
120 prog6_FCFLAGS = $(AM_FCFLAGS)
123 add_match 'prog6-source6.$(OBJEXT)'
125 cat >> Makefile.am <<'END'
126 bin_PROGRAMS += prog7
127 prog7_SOURCES = source7.r
128 prog7_RFLAGS = $(AM_RFLAGS)
131 add_match 'prog7-source7.$(OBJEXT)'
133 cat >> Makefile.am <<'END'
134 bin_PROGRAMS += prog8
135 prog8_SOURCES = source8.java
136 prog8_GCJFLAGS = $(AM_GCJFLAGS)
139 add_match 'prog8-source8.$(OBJEXT)'
141 cat >> Makefile.am <<'END'
142 bin_PROGRAMS += prog9
143 prog9_SOURCES = source9.upc
144 prog9_UPCFLAGS = $(AM_UPCFLAGS)
147 add_match 'prog9-source9.$(OBJEXT)'
149 cat >> Makefile.am <<'END'
150 bin_PROGRAMS += prog10
151 prog10_SOURCES = source10.m
152 prog10_OBJCFLAGS = $(AM_OBJCFLAGS)
155 add_match 'prog10-source10.$(OBJEXT)'
157 cat >> Makefile.am <<'END'
158 bin_PROGRAMS += linkprog
159 linkprog_SOURCES = linkprog.c
160 linkprog_LDFLAGS = $(AM_LDFLAGS)
163 add_match 'linkprog_LINK ='
165 cat >> Makefile.am <<'END'
166 lib_LIBRARIES += libstatic.a
167 libstatic_a_SOURCES = static123.c
168 libstatic_a_CFLAGS = $(AM_CFLAGS)
171 add_match 'libstatic_a-static123.$(OBJEXT)'
173 cat >> Makefile.am <<'END'
174 lib_LTLIBRARIES += libshared1.la
175 libshared1_la_SOURCES = shared1.c
176 libshared1_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS)
179 add_match 'libshared1_la-shared1.lo'
181 cat >> Makefile.am <<'END'
182 lib_LTLIBRARIES += libshared2.la
183 libshared2_la_SOURCES = shared2.cc
184 libshared2_la_CXXFLAGS = $(AM_CXXFLAGS)
187 add_match 'libshared2_la-shared2.lo'
189 cat >> Makefile.am <<'END'
190 bin_PROGRAMS += parse1
191 parse1_SOURCES = parse.y
192 parse1_YFLAGS = $(AM_YFLAGS)
195 add_match 'parse1-parse.c'
197 cat >> Makefile.am <<'END'
198 bin_PROGRAMS += parse2
199 parse2_SOURCES = parse.ypp
200 parse2_YFLAGS = $(AM_YFLAGS)
203 add_match 'parse2-parse.cpp'
205 cat >> Makefile.am <<'END'
206 bin_PROGRAMS += lexer1
207 lexer1_SOURCES = lex.l
208 lexer1_LFLAGS = $(AM_YFLAGS)
211 add_match 'lexer1-lex.c'
213 cat >> Makefile.am <<'END'
214 bin_PROGRAMS += lexer2
215 lexer2_SOURCES = lexer.ll
216 lexer2_LFLAGS = $(AM_YFLAGS)
219 add_match 'lexer2-lexer.cc'
228 s|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/|
229 s|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/|
230 s|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/|
231 s|^\(.*\)FLAGS *=|sub_\1FLAGS =|
234 cat - t > Makefile.am <<'END'
235 AUTOMAKE_OPTIONS = subdir-objects