2 # Copyright (C) 2011-2012 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'
70 cat > Makefile.am <<'END'
78 cat >> Makefile.am <<'END'
80 prog1_SOURCES = source1.c
81 prog1_CFLAGS = $(AM_CFLAGS)
84 add_match 'prog1-source1.$(OBJEXT)'
86 cat >> Makefile.am <<'END'
88 prog2_SOURCES = source2.c
89 prog2_CPPFLAGS = $(AM_CPPFLAGS)
92 add_match 'prog2-source2.$(OBJEXT)'
94 cat >> Makefile.am <<'END'
96 prog3_SOURCES = source3.cxx
97 prog3_CXXFLAGS = $(AM_CXXFLAGS)
100 add_match 'prog3-source3.$(OBJEXT)'
102 cat >> Makefile.am <<'END'
103 bin_PROGRAMS += prog4
104 prog4_SOURCES = source4.c++
105 prog4_CPPFLAGS = $(AM_CPPFLAGS)
108 add_match 'prog4-source4.$(OBJEXT)'
110 cat >> Makefile.am <<'END'
111 bin_PROGRAMS += prog5
112 prog5_SOURCES = source5.f
113 prog5_FFLAGS = $(AM_FFLAGS)
116 add_match 'prog5-source5.$(OBJEXT)'
118 cat >> Makefile.am <<'END'
119 bin_PROGRAMS += prog6
120 prog6_SOURCES = source6.f90
121 prog6_FCFLAGS = $(AM_FCFLAGS)
124 add_match 'prog6-source6.$(OBJEXT)'
126 cat >> Makefile.am <<'END'
127 bin_PROGRAMS += prog7
128 prog7_SOURCES = source7.r
129 prog7_RFLAGS = $(AM_RFLAGS)
132 add_match 'prog7-source7.$(OBJEXT)'
134 cat >> Makefile.am <<'END'
135 bin_PROGRAMS += prog8
136 prog8_SOURCES = source8.java
137 prog8_GCJFLAGS = $(AM_GCJFLAGS)
140 add_match 'prog8-source8.$(OBJEXT)'
142 cat >> Makefile.am <<'END'
143 bin_PROGRAMS += prog9
144 prog9_SOURCES = source9.upc
145 prog9_UPCFLAGS = $(AM_UPCFLAGS)
148 add_match 'prog9-source9.$(OBJEXT)'
150 cat >> Makefile.am <<'END'
151 bin_PROGRAMS += prog10
152 prog10_SOURCES = source10.m
153 prog10_OBJCFLAGS = $(AM_OBJCFLAGS)
156 add_match 'prog10-source10.$(OBJEXT)'
158 cat >> Makefile.am <<'END'
159 bin_PROGRAMS += linkprog
160 linkprog_SOURCES = linkprog.c
161 linkprog_LDFLAGS = $(AM_LDFLAGS)
164 add_match 'linkprog_LINK ='
166 cat >> Makefile.am <<'END'
167 lib_LIBRARIES += libstatic.a
168 libstatic_a_SOURCES = static123.c
169 libstatic_a_CFLAGS = $(AM_CFLAGS)
172 add_match 'libstatic_a-static123.$(OBJEXT)'
174 cat >> Makefile.am <<'END'
175 lib_LTLIBRARIES += libshared1.la
176 libshared1_la_SOURCES = shared1.c
177 libshared1_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS)
180 add_match 'libshared1_la-shared1.lo'
182 cat >> Makefile.am <<'END'
183 lib_LTLIBRARIES += libshared2.la
184 libshared2_la_SOURCES = shared2.cc
185 libshared2_la_CXXFLAGS = $(AM_CXXFLAGS)
188 add_match 'libshared2_la-shared2.lo'
190 cat >> Makefile.am <<'END'
191 bin_PROGRAMS += parse1
192 parse1_SOURCES = parse.y
193 parse1_YFLAGS = $(AM_YFLAGS)
196 add_match 'parse1-parse.c'
198 cat >> Makefile.am <<'END'
199 bin_PROGRAMS += parse2
200 parse2_SOURCES = parse.ypp
201 parse2_YFLAGS = $(AM_YFLAGS)
204 add_match 'parse2-parse.cpp'
206 cat >> Makefile.am <<'END'
207 bin_PROGRAMS += lexer1
208 lexer1_SOURCES = lex.l
209 lexer1_LFLAGS = $(AM_YFLAGS)
212 add_match 'lexer1-lex.c'
214 cat >> Makefile.am <<'END'
215 bin_PROGRAMS += lexer2
216 lexer2_SOURCES = lexer.ll
217 lexer2_LFLAGS = $(AM_YFLAGS)
220 add_match 'lexer2-lexer.cc'
229 s|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/|
230 s|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/|
231 s|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/|
232 s|^\(.*\)FLAGS *=|sub_\1FLAGS =|
235 cat - t > Makefile.am <<'END'
236 AUTOMAKE_OPTIONS = subdir-objects