1#! /bin/sh 2# Copyright (C) 2011-2021 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 <https://www.gnu.org/licenses/>. 16 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, ...) 22 23. test-init.sh 24 25# Disable shell globbing if possible. 26(set +f) >/dev/null 2>&1 && set +f 27 28oIFS=$IFS 29nl=' 30' 31 32matches= 33add_match () 34{ 35 matches="$matches$nl$1" 36} 37 38do_check () 39{ 40 IFS=$nl 41 for string in $matches; do 42 IFS=$oIFS 43 $FGREP "$string" Makefile.in 44 done 45 IFS=$oIFS 46} 47 48# Fake libtool presence, so that we won't have to require it. 49cat > acinclude.m4 <<END 50AC_DEFUN([AC_PROG_LIBTOOL], [AC_SUBST([LIBTOOL], [dummy])]) 51END 52: > ltmain.sh 53 54cat >> configure.ac << 'END' 55AC_PROG_CC 56AC_PROG_CXX 57AC_PROG_YACC 58AC_PROG_LEX 59AC_PROG_F77 60AC_PROG_FC 61AM_PROG_GCJ 62AM_PROG_AR 63AC_PROG_RANLIB 64AC_PROG_LIBTOOL 65AM_PROG_UPC 66AC_PROG_OBJC 67END 68 69cat > Makefile.am <<'END' 70bin_PROGRAMS = 71lib_LIBRARIES = 72lib_LTLIBRARIES = 73END 74 75$ACLOCAL 76 77cat >> Makefile.am <<'END' 78bin_PROGRAMS += prog1 79prog1_SOURCES = source1.c 80prog1_CFLAGS = $(AM_CFLAGS) 81END 82 83add_match 'prog1-source1.$(OBJEXT)' 84 85cat >> Makefile.am <<'END' 86bin_PROGRAMS += prog2 87prog2_SOURCES = source2.c 88prog2_CPPFLAGS = $(AM_CPPFLAGS) 89END 90 91add_match 'prog2-source2.$(OBJEXT)' 92 93cat >> Makefile.am <<'END' 94bin_PROGRAMS += prog3 95prog3_SOURCES = source3.cxx 96prog3_CXXFLAGS = $(AM_CXXFLAGS) 97END 98 99add_match 'prog3-source3.$(OBJEXT)' 100 101cat >> Makefile.am <<'END' 102bin_PROGRAMS += prog4 103prog4_SOURCES = source4.c++ 104prog4_CPPFLAGS = $(AM_CPPFLAGS) 105END 106 107add_match 'prog4-source4.$(OBJEXT)' 108 109cat >> Makefile.am <<'END' 110bin_PROGRAMS += prog5 111prog5_SOURCES = source5.f 112prog5_FFLAGS = $(AM_FFLAGS) 113END 114 115add_match 'prog5-source5.$(OBJEXT)' 116 117cat >> Makefile.am <<'END' 118bin_PROGRAMS += prog6 119prog6_SOURCES = source6.f90 120prog6_FCFLAGS = $(AM_FCFLAGS) 121END 122 123add_match 'prog6-source6.$(OBJEXT)' 124 125cat >> Makefile.am <<'END' 126bin_PROGRAMS += prog7 127prog7_SOURCES = source7.r 128prog7_RFLAGS = $(AM_RFLAGS) 129END 130 131add_match 'prog7-source7.$(OBJEXT)' 132 133cat >> Makefile.am <<'END' 134bin_PROGRAMS += prog8 135prog8_SOURCES = source8.java 136prog8_GCJFLAGS = $(AM_GCJFLAGS) 137END 138 139add_match 'prog8-source8.$(OBJEXT)' 140 141cat >> Makefile.am <<'END' 142bin_PROGRAMS += prog9 143prog9_SOURCES = source9.upc 144prog9_UPCFLAGS = $(AM_UPCFLAGS) 145END 146 147add_match 'prog9-source9.$(OBJEXT)' 148 149cat >> Makefile.am <<'END' 150bin_PROGRAMS += prog10 151prog10_SOURCES = source10.m 152prog10_OBJCFLAGS = $(AM_OBJCFLAGS) 153END 154 155add_match 'prog10-source10.$(OBJEXT)' 156 157cat >> Makefile.am <<'END' 158bin_PROGRAMS += linkprog 159linkprog_SOURCES = linkprog.c 160linkprog_LDFLAGS = $(AM_LDFLAGS) 161END 162 163add_match 'linkprog_LINK =' 164 165cat >> Makefile.am <<'END' 166lib_LIBRARIES += libstatic.a 167libstatic_a_SOURCES = static123.c 168libstatic_a_CFLAGS = $(AM_CFLAGS) 169END 170 171add_match 'libstatic_a-static123.$(OBJEXT)' 172 173cat >> Makefile.am <<'END' 174lib_LTLIBRARIES += libshared1.la 175libshared1_la_SOURCES = shared1.c 176libshared1_la_LIBTOOLFLAGS = $(AM_LIBTOOLFLAGS) 177END 178 179add_match 'libshared1_la-shared1.lo' 180 181cat >> Makefile.am <<'END' 182lib_LTLIBRARIES += libshared2.la 183libshared2_la_SOURCES = shared2.cc 184libshared2_la_CXXFLAGS = $(AM_CXXFLAGS) 185END 186 187add_match 'libshared2_la-shared2.lo' 188 189cat >> Makefile.am <<'END' 190bin_PROGRAMS += parse1 191parse1_SOURCES = parse.y 192parse1_YFLAGS = $(AM_YFLAGS) 193END 194 195add_match 'parse1-parse.c' 196 197cat >> Makefile.am <<'END' 198bin_PROGRAMS += parse2 199parse2_SOURCES = parse.ypp 200parse2_YFLAGS = $(AM_YFLAGS) 201END 202 203add_match 'parse2-parse.cpp' 204 205cat >> Makefile.am <<'END' 206bin_PROGRAMS += lexer1 207lexer1_SOURCES = lex.l 208lexer1_LFLAGS = $(AM_YFLAGS) 209END 210 211add_match 'lexer1-lex.c' 212 213cat >> Makefile.am <<'END' 214bin_PROGRAMS += lexer2 215lexer2_SOURCES = lexer.ll 216lexer2_LFLAGS = $(AM_YFLAGS) 217END 218 219add_match 'lexer2-lexer.cc' 220 221# For debugging. 222cat Makefile.am 223 224$AUTOMAKE -a 225do_check 226 227sed ' 228 s|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/| 229 s|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/| 230 s|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/| 231 s|^\(.*\)FLAGS *=|sub_\1FLAGS =| 232' Makefile.am > t 233 234cat - t > Makefile.am <<'END' 235AUTOMAKE_OPTIONS = subdir-objects 236END 237 238rm -f t 239 240# For debugging. 241cat Makefile.am 242 243$AUTOMAKE 244do_check 245 246: 247