automake-ng
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Automake-NG] [PATCH 05/12] [ng] cleanup: remove a workaround for BSD ma


From: Stefano Lattarini
Subject: [Automake-NG] [PATCH 05/12] [ng] cleanup: remove a workaround for BSD make (default sources and VPATH)
Date: Mon, 21 May 2012 09:36:22 +0200

* automake.in (handle_source_transform): If a rule existed to build a
source file with a $(srcdir) prefix, we used that prefix in our variables
too, for the sake of BSD Make.  This is not necessary with GNU make, so
drop it.
* t/vpath-built-sources.sh: New test.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 automake.in              |    9 ------
 t/vpath-built-sources.sh |   73 ++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+), 9 deletions(-)
 create mode 100755 t/vpath-built-sources.sh

diff --git a/automake.in b/automake.in
index f2aa402..039b269 100644
--- a/automake.in
+++ b/automake.in
@@ -2047,15 +2047,6 @@ sub handle_source_transform ($$$$%)
                 . "backward compatibility.)");
            $default_source = $old_default_source;
          }
-       # If a rule exists to build this source with a $(srcdir)
-       # prefix, use that prefix in our variables too.  This is for
-       # the sake of BSD Make.
-       if (rule '$(srcdir)/' . $default_source
-           || rule '${srcdir}/' . $default_source)
-         {
-           $default_source = '$(srcdir)/' . $default_source;
-         }
-
        &define_variable ($one_file . "_SOURCES", $default_source, $where);
        push (@sources, $default_source);
        push (@dist_sources, $default_source);
diff --git a/t/vpath-built-sources.sh b/t/vpath-built-sources.sh
new file mode 100755
index 0000000..1f47073
--- /dev/null
+++ b/t/vpath-built-sources.sh
@@ -0,0 +1,73 @@
+#! /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/>.
+
+# In a VPATH build, a target starting with $(srcdir) is triggered to
+# build a source with the same name but without the $(srcdir).
+
+required=cc
+. ./defs || Exit 1
+
+ocwd=`pwd` || fatal_ "couldn't get current working directory"
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+noinst_PROGRAMS = p1 p2 p3 tp1 tp2 tp3
+
+write-it = echo 'int main (void) { return 0; }' >$@
+
+# We keep all the targets on separate lines to make sure the dumb
+# Automake parser actually sees them all.
+$(srcdir)/p1.c:
+       $(write-it)
+${srcdir}/p2.c:
+       $(write-it)
address@hidden@/p3.c:
+       $(write-it)
+$(top_srcdir)/tp1.c:
+       $(write-it)
+${top_srcdir}/tp2.c:
+       $(write-it)
address@hidden@/tp3.c:
+       $(write-it)
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+mkdir build
+cd build
+../configure
+$MAKE all
+
+cd "$ocwd"
+rm -f *.c
+mkdir -p sub1/sub2/sub3
+cd sub1/sub2/sub3
+"$ocwd"/configure --disable-dependency-tracking
+$MAKE all
+
+cd "$ocwd"
+rm -f *.c
+./configure
+$MAKE all
+$MAKE distcheck
+
+:
-- 
1.7.9.5




reply via email to

[Prev in Thread] Current Thread [Next in Thread]