[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
1bis-gary-strip-target-suffix-from-default-source.patch
From: |
Gary V. Vaughan |
Subject: |
1bis-gary-strip-target-suffix-from-default-source.patch |
Date: |
Wed, 26 Nov 2003 12:02:17 +0000 |
User-agent: |
Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.5) Gecko/20030925 Thunderbird/0.3 |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
I was a little rushed last night, but now I've attached a hand rolled patch
file that applies cleanly to automake-1.7f.
Cheers,
Gary.
- --
Gary V. Vaughan ())_. address@hidden,gnu.org}
Research Scientist ( '/ http://www.oranda.demon.co.uk
GNU Hacker / )= http://www.gnu.org/software/libtool
Technical Author `(_~)_ http://sources.redhat.com/autobook
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.2 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org
iD8DBQE/xJZJFRMICSmD1gYRAqC7AJ9bhhSmfTXzSIODdriJk5jbWa4bLgCgo2c1
kDWfzRy4jud53RYfnemlvKE=
=c/Et
-----END PGP SIGNATURE-----
Index: ChangeLog
from Gary V. Vaughan <address@hidden>
* automake.in (&handle_source_transform): Calculate a default file
for use in the absence of an appropriate _SOURCES declaration by
first stripping any suffix from the unxformed target name, and
appending `.c'.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.247
diff -u -p -u -r1.247 NEWS
--- NEWS 18 Nov 2003 21:23:02 -0000 1.247
+++ NEWS 19 Nov 2003 11:13:39 -0000
@@ -10,6 +10,14 @@ New in 1.7e:
* New features
+ - Default source file names in the absence of a _SOURCES declaration
+ are made by removing any target extension before appending `.c', so
+ to make the libtool module `foo.la' from `foo.c', you only need to
+ do this:
+
+ lib_LTLIBRARIES = foo.la
+ foo_la_LDFLAGS = -module
+
- AR's `cru' flags are now set in a global ARFLAGS variable instead
of being hard-coded in each $(AR) invocation, so they can be
substituted from configure.ac. This has been requested by people
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1516
diff -u -p -u -r1.1516 automake.in
--- automake.in 17 Nov 2003 23:18:19 -0000 1.1516
+++ automake.in 19 Nov 2003 11:14:01 -0000
@@ -1807,16 +1807,17 @@ sub handle_source_transform
my @keys = sort keys %used_pfx;
if (scalar @keys == 0)
{
- &define_variable ($one_file . "_SOURCES", $unxformed . ".c", $where);
- push (@sources, $unxformed . '.c');
- push (@dist_sources, $unxformed . '.c');
+ (my $default_source = $unxformed) =~ s/(\..*)?$/.c/;
+ &define_variable ($one_file . "_SOURCES", $default_source, $where);
+ push (@sources, $default_source);
+ push (@dist_sources, $default_source);
%linkers_used = ();
my (@result) =
&handle_single_transform_list ($one_file . '_SOURCES',
$one_file . '_SOURCES',
$one_file, $obj,
- "$unxformed.c");
+ $default_source);
$linker ||= &resolve_linker (%linkers_used);
define_pretty_variable ($one_file . '_OBJECTS', TRUE, $where, @result);
}
Index: doc/automake.texi
===================================================================
diff -burp automake-1.7f/doc/automake.texi doc/automake.texi
--- automake-1.7f/doc/automake.texi 2003-11-11 00:01:49.000000000 +0000
+++ doc/automake.texi 2003-11-24 17:17:55.000000000 +0000
@@ -2308,11 +2308,25 @@ corresponding @samp{.o}. Then all are l
If @samp{hello_SOURCES} is not specified, then it defaults to the single
file @file{hello.c}; that is, the default is to compile a single C file
-whose base name is the name of the program itself. (This is a terrible
-default but we are stuck with it for historical reasons.)
+whose base name is the name of the program itself. In this context,
+the base name is always the name that would have gone to the left of
+the @samp{_SOURCES} primary, before canonicalization and with any
+suffixes replaced with @samp{.c} (This is a terrible default but we
+are stuck with it for historical reasons.)
@vindex _SOURCES
@vindex SOURCES
+For example if you have the following somewhere in your
address@hidden with no corresponding @samp{libfoo_a_SOURCES}:
+
address@hidden
+lib_LIBRARIES = libfoo.a
address@hidden example
+
address@hidden
address@hidden will be built using a default source file named
address@hidden
+
Multiple programs can be built in a single directory. Multiple programs
can share a single source file, which must be listed in each
@samp{_SOURCES} definition.
@@ -2866,6 +2880,13 @@ Ordinarily, Automake requires that a Lib
@samp{lib}. However, when building a dynamically loadable module you
might wish to use a "nonstandard" name.
+If @samp{mymodule_SOURCES} is not specified, then it defaults to the single
+file @file{mymodule.c}; that is, the default is to compile a single C file
+whose base name is the name of the module itself. (This is a terrible
+default but we are stuck with it for historical reasons.)
address@hidden _SOURCES
address@hidden SOURCES
+
@node Libtool Flags
@subsection _LIBADD and _LDFLAGS
@cindex _LIBADD, libtool
Index: tests/Makefile.am
===================================================================
diff -burpN automake-1.7f/tests/Makefile.am tests/Makefile.am
--- automake-1.7f/tests/Makefile.am 2003-11-18 20:26:23.000000000 +0000
+++ tests/Makefile.am 2003-11-24 16:38:02.000000000 +0000
@@ -293,6 +293,7 @@ ltcond2.test \
ltconv.test \
ltdeps.test \
ltlibobjs.test \
+ltlibsrc.test \
maintclean.test \
make.test \
makej.test \
Index: tests/ltlibsrc.test
===================================================================
diff -burp automake-1.7f/tests/ltlibsrc.test tests/ltlibsrc.test
--- automake-1.7f/tests/ltlibsrc.test 1970-01-01 01:00:00.000000000 +0100
+++ tests/ltlibsrc.test 2003-11-24 17:03:22.000000000 +0000
@@ -0,0 +1,59 @@
+#! /bin/sh
+# Copyright (C) 2003 Free Software Foundation, Inc.
+#
+# This file is part of GNU Automake.
+#
+# GNU Automake 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.
+#
+# GNU Automake 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 Automake; see the file COPYING. If not, write to
+# the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+# Boston, MA 02111-1307, USA.
+
+# Test to make sure a sensible default source for libraries is used.
+
+required='libtool gcc'
+. ./defs || exit 1
+
+cat > configure.in << 'END'
+AC_INIT([foo], [0.1])
+AC_CONFIG_SRCDIR([foo.c])
+AM_INIT_AUTOMAKE
+AC_PROG_CC
+AC_PROG_LIBTOOL
+AC_CONFIG_FILES(Makefile)
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+pkglib_LTLIBRARIES = foo.la
+foo_la_LDFLAGS = -module
+END
+
+cat > foo.c << 'END'
+int foo (void) { return 0; }
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+mkdir sub
+cd sub
+
+../configure
+$MAKE || exit 1
+
+test -f foo.la || exit 1
+:
+
+exit 0
- 1bis-gary-strip-target-suffix-from-default-source.patch,
Gary V. Vaughan <=