- calls to make functions, whether built-in ones like "$(wildcard *.c)"
or user-defined ones like "$(call my-func, arg1, arg2)".
+ - pattern rules in GNU make style ("%.o: %.c").
+
+ - variable definitions with ":=", as in "foo := $(immediate-evaluation)".
+
+ - some issues specific to BSD make.
+
* The 'portability-recursive' warning category is obsolete, and has been
removed.
error $where, "required directory $reldir/$dir does not exist"
unless -d "$reldir/$dir";
- # If an `obj/' directory exists, BSD make will enter it before
- # reading `Makefile'. Hence the `Makefile' in the current directory
- # will not be read.
- #
- # % cat Makefile
- # all:
- # echo Hello
- # % cat obj/Makefile
- # all:
- # echo World
- # % make # GNU make
- # echo Hello
- # Hello
- # % pmake # BSD make
- # echo World
- # World
- msg ('portability', $where,
- "naming a subdirectory `obj' causes troubles with BSD make")
- if $dir eq 'obj';
-
# `aux' is probably the most important of the following forbidden name,
# since it's tempting to use it as an AC_CONFIG_AUX_DIR.
msg ('portability', $where,
-# Copyright (C) 2003, 2004, 2006, 2007, 2010, 2011 Free Software
+# Copyright (C) 2003, 2004, 2006, 2007, 2010, 2011, 2012 Free Software
# Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
}
- # A GNU make-style pattern rule has a single "%" in the target name.
- msg ('portability', $where,
- "`%'-style pattern rules are a GNU make extension")
- if $target =~ /^[^%]*%[^%]*$/;
-
# Diagnose target redefinitions.
if ($tdef)
{
if ($oldowner == RULE_USER)
{
# Ignore `%'-style pattern rules. We'd need the
- # dependencies to detect duplicates, and they are
- # already diagnosed as unportable by -Wportability.
+ # dependencies to detect duplicates.
if ($target !~ /^[^%]*%[^%]*$/)
{
## FIXME: Presently we can't diagnose duplicate user rules
-# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010 Free Software
-# Foundation, Inc.
+# Copyright (C) 2003, 2004, 2005, 2006, 2008, 2009, 2010, 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
|| $pretty == VAR_SILENT
|| $pretty == VAR_SORTED);
- # `:='-style assignments are not acknowledged by POSIX. Moreover it
- # has multiple meanings. In GNU make or BSD make it means "assign
- # with immediate expansion", while in OSF make it is used for
- # conditional assignments.
- msg ('portability', $where, "`:='-style assignments are not portable")
- if $type eq ':';
-
# If there's a comment, make sure it is \n-terminated.
if ($comment)
{
#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
END
cat > Makefile.am <<'END'
-# The following should expand to `-Wnone -Wno-error foreign -Wportability'.
+# The following should expand to '-Wnone -Wno-error foreign -Wportability'.
AUTOMAKE_OPTIONS = $(foo) foreign
AUTOMAKE_OPTIONS += ${bar}
foo = $(foo1)
foo3 = -Wno-error
bar = -Wportability
# This will give a warning with `-Wportability'.
-zardoz :=
+.aaa.bbb .ccc.ddd:
# This would give a warning with `-Woverride'.
install:
END
$ACLOCAL
AUTOMAKE_run
-grep '^Makefile\.am:.*:=.*not portable' stderr
+grep '^Makefile\.am:.*inference rules can have only one target' stderr
grep README stderr && Exit 1
$EGREP '(install|override)' stderr && Exit 1
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 1996, 2001, 2002, 2003, 2010, 2011 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/>.
-
-# Test that := definitions produce warnings, but otherwise work.
-
-. ./defs || Exit 1
-
-cat > Makefile.am << 'END'
-ICONS := $(wildcard *.xbm)
-END
-
-$ACLOCAL
-AUTOMAKE_fails
-grep ':=.*not portable' stderr
-
-$AUTOMAKE -Wno-portability
-grep '^ICONS *:= *\$(wildcard \*\.xbm) *$' Makefile.in
-
-:
checkall.test \
clean.test \
clean2.test \
-colneq.test \
colneq2.test \
-colneq3.test \
colon.test \
colon2.test \
colon3.test \
number.test \
objc.test \
objc2.test \
+objdir.test \
objext-pr10128.test \
obsolete.test \
oldvars.test \
override-conditional-2.test \
override-html.test \
override-suggest-local.test \
+pattern-rules.test \
+pattern-rules2.test \
parallel-am.test \
parallel-am2.test \
parallel-am3.test \
test-extensions.test \
test-extensions-cond.test \
parse.test \
-percent.test \
-percent2.test \
phony.test \
pluseq.test \
pluseq2.test \
subdir4.test \
subdir5.test \
subdir6.test \
-subdir7.test \
subdir8.test \
subdir9.test \
subdir10.test \
vala-vpath.test \
vala-mix.test \
vars.test \
+vars-assign.test \
vartar.test \
vartypos.test \
vartypo2.test \
--- /dev/null
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# A directory named 'obj' could create problems with BSD make, but
+# shouldn't with GNU make; so check that
+# - the old portability warning diagnosing it is gone, and
+# - such a directory truly causes no problems with GNU make.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([obj])
+AM_INIT_AUTOMAKE
+AC_REQUIRE_AUX_FILE([Makefile])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+END
+
+mkdir obj
+cat > obj/Makefile <<'END'
+$(error GNU make should not consider this)
+all:
+ echo "GNU make should not consider this"; exit 1
+END
+
+cat > Makefile.am <<'END'
+check-local:
+ test -f $(srcdir)/obj/Makefile
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+test -f obj/install-sh
+test ! -f install-sh
+
+./configure
+# This first make invocation actually fails with NetBSD make
+# and FreeBSD 8.2 make.
+$MAKE
+$MAKE distcheck
+
+:
--- /dev/null
+#! /bin/sh
+# Copyright (C) 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/>.
+
+# Automake do not complain about nor messes up pattern rules.
+
+. ./defs || Exit 1
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am <<'END'
+foo/%.out: bar/%.in
+ test -d $(dir $@) || $(MKDIR_P) $(dir $@)
+ cp $< $@
+%.sh: %/z
+ cp $< $@
+%:
+ echo True > $@
+noinst_DATA = foo/one.out
+noinst_SCRIPTS = two.sh mu.py
+END
+
+mkdir bar two
+echo "123456789" > bar/one.in
+echo "#!/bin/sh" > two/z
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+ if $vpath; then
+ mkdir build
+ cd build
+ srcdir=..
+ else
+ srcdir=.
+ fi
+ $srcdir/configure
+ $MAKE
+ diff $srcdir/bar/one.in ./foo/one.out
+ diff $srcdir/two/z ./two.sh
+ test `cat mu.py` = True
+ cd $srcdir
+done
+
+:
#!/bin/sh
-# Copyright (C) 2002, 2003, 2011 Free Software Foundation, Inc.
+# Copyright (C) 2002, 2003, 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
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Another test for -Wportability warning about %-style rules, plus
+# Support for pattern rules:
# make sure we don't warn about duplicate definition for
# `${ARCH}/%.$(OBJEXT):'.
# Report from Ralf Corsepius.
EOF
$ACLOCAL
-AUTOMAKE_fails
-grep '%.*pattern.*rules' stderr
-
-# No error otherwise.
$AUTOMAKE -Wno-portability
+++ /dev/null
-#!/bin/sh
-# Copyright (C) 2002, 2003, 2011 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/>.
-
-# Test to make sure that -Wportability understands %-style pattern
-# rules.
-
-. ./defs || Exit 1
-
-cat >>configure.in <<EOF
-AC_PROG_CC
-EOF
-
-cat >Makefile.am <<EOF
-bin_PROGRAMS = liver
-liver_SOURCES = foo.c
-
-%.o: %.c
- echo "gnu make extension"
-EOF
-
-$ACLOCAL
-AUTOMAKE_fails -Wportability
-grep 'Makefile.am:4:.*%' stderr
+++ /dev/null
-#! /bin/sh
-# Copyright (C) 2002, 2003, 2004, 2010, 2011 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/>.
-
-# Naming a subdirectory `obj/' is a bad idea. Automake should say so.
-
-. ./defs || Exit 1
-
-mkdir obj
-
-cat >>configure.in << 'END'
-AC_CONFIG_FILES([obj/Makefile])
-AC_OUTPUT
-END
-
-: > obj/Makefile.am
-echo 'SUBDIRS = obj' >Makefile.am
-
-$ACLOCAL
-
-AUTOMAKE_fails
-grep 'Makefile.am:1:.*obj.*BSD' stderr
-
-cat >Makefile.am <<'END'
-SUBDIRS = @STH@
-FOO = obj
-DIST_SUBDIRS = $(FOO)
-END
-
-AUTOMAKE_fails
-grep 'Makefile.am:2:.*obj.*BSD' stderr
-
-:
#! /bin/sh
-# Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+# Copyright (C) 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
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-# Test that := definitions work as expected at make time.
+# Automake do not complain about nor messes up GNU make specific
+# variable assignments (":=" and "?=").
. ./defs || Exit 1
-cat >> configure.in << 'END'
-AC_OUTPUT
-END
+echo AC_OUTPUT >> configure.in
+
+unset PREFOO FOO BAR BAZ XFOO XBAZ || :
-cat > Makefile.am << 'END'
-BAR := $(FOO)
-BAZ = $(FOO)
-FOO := foo
-.PHONY: test
-test:
- test x'$(FOO)' = x'foo'
- test x'$(BAZ)' = x'foo'
- test x'$(BAR)' = x
+cat > Makefile.am <<'END'
+PREFOO = bar
+FOO := foo$(PREFOO)$(XFOO)
+XFOO = fail
+BAR ?= barbar
+
+.PHONY: test1 test2
+test1:
+ test $(FOO) = foobar
+ test $(BAR) = barbar
+test2:
+ test $(FOO) = foobar
+ test $(BAR) = rabrab
END
$ACLOCAL
$AUTOCONF
-$AUTOMAKE -Wno-portability
-
+$AUTOMAKE
./configure
-$MAKE test
+$MAKE test1
+PREFOO=notseen FOO=notseen BAR=rabrab $MAKE test2
:
#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
cat > Makefile.am <<END
include automake-options.am
-FOO := bar
+.c.o .c.obj:
+ @echo bad
END
rm -rf autom4te*.cache
echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
$ACLOCAL
AUTOMAKE_fails -Werror -Wall --foreign
-grep '^Makefile\.am:.*:=.*not portable' stderr
+grep '^Makefile\.am:.*inference rules can have only one target' stderr
rm -rf autom4te*.cache
: > automake-options.am
#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
AUTOMAKE="$am_original_AUTOMAKE -Werror"
cat > Makefile.am <<'END'
-FOO := bar
+.c.o .c.obj:
+ @echo bad
AUTOMAKE_OPTIONS =
END
ko ()
{
AUTOMAKE_fails $*
- grep '^Makefile\.am:1:.*:=.*not portable' stderr
+ grep '^Makefile\.am:1:.*inference rules can have only one target' stderr
}
$ACLOCAL
#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
AUTOMAKE="$am_original_AUTOMAKE -Werror"
cat > Makefile.am <<'END'
-FOO := bar
+.c.o .c.obj:
+ @echo bad
AUTOMAKE_OPTIONS =
END
ko ()
{
AUTOMAKE_fails $*
- grep '^Makefile\.am:1:.*:=.*not portable' stderr
+ grep '^Makefile\.am:1:.*inference rules can have only one target' stderr
}
# Files required in gnu strictness.
#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
cat > Makefile.am <<END
AUTOMAKE_OPTIONS =
-FOO := bar
+.c.o .c.obj:
+ @echo bad
END
set_am_opts ()
AUTOMAKE_fails
$ACLOCAL
-grep '^Makefile\.am:2:.*:=.*not portable' stderr
+grep '^Makefile\.am:2:.*inference rules can have only one target' stderr
:
#! /bin/sh
-# Copyright (C) 2011 Free Software Foundation, Inc.
+# 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
ko ()
{
AUTOMAKE_run $*
- grep '^Makefile\.am:.*:=.*not portable' stderr
+ grep '^Makefile\.am:.*inference rules can have only one target' stderr
test `wc -l <stderr` -eq 1
}
cat > Makefile.am <<END
AUTOMAKE_OPTIONS =
-FOO := bar
+.c.o .c.obj:
+ @echo bad
END
$ACLOCAL