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
|
#! /bin/sh
# Copyright (C) 1999-2021 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 <https://www.gnu.org/licenses/>.
# Test executable-specific and library-specific flags, both with
# and without dependency tracking.
. test-init.sh
makefiles='Makefile libMakefile Makefile2 libMakefile2'
cat > configure.ac << END
AC_INIT([$me], [1.0])
AM_INIT_AUTOMAKE([-Wno-extra-portability])
AC_CONFIG_FILES([$makefiles])
AC_PROG_CC
AC_PROG_CXX
AC_PROG_RANLIB
AC_OUTPUT
END
$ACLOCAL
cat > Makefile.am << 'END'
bin_PROGRAMS = foo
foo_SOURCES = foo.c
foo_CFLAGS = -DBAR
END
cat > libMakefile.am << 'END'
lib_LIBRARIES = libfoo.a
libfoo_a_SOURCES = foo.c bar.cc
libfoo_a_CFLAGS = -DBAR
libfoo_a_CXXFLAGS = -DZOT
END
cat - Makefile.am > Makefile2.am << 'END'
AUTOMAKE_OPTIONS = no-dependencies
END
cat - libMakefile.am > libMakefile2.am << 'END'
AUTOMAKE_OPTIONS = no-dependencies
END
makefiles=$(for mkf in $makefiles; do echo $mkf.in; done)
$AUTOMAKE
# Sanity check.
for mkf in $makefiles; do test -f $mkf || exit 99; done
# Regression test for missing space.
$FGREP ')-c' $makefiles && exit 1
# Regression test for botchedly transformed object names.
$FGREP '.o.o' $makefiles && exit 1
$FGREP '.obj.obj' $makefiles && exit 1
$FGREP '.$(OBJEXT).$(OBJEXT)' $makefiles && exit 1
# Watch against non-transformed "foo.$(OBJEXT)", "foo.o" and "foo.obj"
# (and similarly for bar).
$EGREP '[^-](foo|bar)\.[o$]' $makefiles && exit 1
# All our programs and libraries have per-target flags, so all
# the compilers invocations must use an explicit '-c' option.
grep '\$.COMPILE' $makefiles | grep -v ' -c' && exit 1
$FGREP 'foo-foo.$(OBJEXT)' Makefile.in
$FGREP 'foo-foo.$(OBJEXT)' Makefile2.in
$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile.in
$FGREP 'libfoo_a-foo.$(OBJEXT)' libMakefile2.in
$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile.in
$FGREP 'libfoo_a-bar.$(OBJEXT)' libMakefile2.in
$FGREP '$(foo_CFLAGS)' Makefile.in
$FGREP '$(foo_CFLAGS)' Makefile2.in
$FGREP '$(libfoo_a_CFLAGS)' libMakefile.in
$FGREP '$(libfoo_a_CFLAGS)' libMakefile2.in
:
|