[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
AM_LIBTOOLFLAGS, maude_LIBTOOLFLAGS, and LIBTOOLFLAGS (Was: Re: libtool
From: |
Alexandre Duret-Lutz |
Subject: |
AM_LIBTOOLFLAGS, maude_LIBTOOLFLAGS, and LIBTOOLFLAGS (Was: Re: libtool --silent based on MAKEFLAGS?) |
Date: |
Sun, 12 Dec 2004 16:48:30 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
>>> "adl" == Alexandre Duret-Lutz <address@hidden> writes:
>>> "Ralf" == Ralf Wildenhues <address@hidden> writes:
adl> [...]
Ralf> So, how about this? Let's have Automake include $(LIBTOOLFLAGS) in
Ralf> their libtool invocation. The user can then use
Ralf> LIBTOOLFLAGS=--silent
Ralf> at either configure or make time. This approach is Automake-centric,
Ralf> but other buildtools can do similar.
adl> Sounds sensible to me. People have also asked this to specify
adl> --preserve-dup-deps, and --tag=FOO in cases Automake cannot
adl> guess it.
adl> Let's make it `$(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS)' with
adl> `$(AM_LIBTOOLFLAGS)' replaced by `libfoo_la_LIBTOOLFLAGS' if it exists.
adl> I'm working on this right now.
Here is my proposal.
2004-12-12 Alexandre Duret-Lutz <address@hidden>
* automake.in (check_user_variables): New function, extracted
from ...
(handle_languages): ... here.
(handle_languages, define_compiler_variable, define_link_variable):
Honore LIBTOOLFLAGS.
(handle_single_transform): Check _LIBTOOLFLAGS in
addition to other per-target flags for Libtool objects.
(handle_libtool): Warn if LIBTOOLFLAGS is defined.
* doc/automake.texi (Libtool Flags, Program and Library Variables,
Flag Variables Ordering): Document LIBTOOLFLAGS.
* tests/libtool7.test: Check basic support for LIBTOOLFLAGS.
* tests/libtool8.test: Make sure Automake warns about LIBTOOLFLAGS
definitions.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.290
diff -u -r1.290 NEWS
--- NEWS 4 Nov 2004 22:19:41 -0000 1.290
+++ NEWS 12 Dec 2004 15:44:39 -0000
@@ -14,6 +14,9 @@
AM_CPPFLAGS and per-target _CPPFLAGS, and supports dependency
tracking, unlike non-preprocessed assembler (*.s).
+ - Libtool generic flags (those that go before the --mode=MODE option)
+ can be specified using AM_LIBTOOLFLAGS and target_LIBTOOLFLAGS.
+
- aclocal now also supports -Wmumble and -Wno-mumble options.
New in 1.9:
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1590
diff -u -r1.1590 automake.in
--- automake.in 8 Dec 2004 22:00:47 -0000 1.1590
+++ automake.in 12 Dec 2004 15:44:41 -0000
@@ -1087,6 +1087,31 @@
return $extension;
}
+# check_user_variables (@LIST)
+# ----------------------------
+# Make sure each variable VAR in @LIST do not exist, suggest using AM_VAR
+# otherwise.
+sub check_user_variables (@)
+{
+ my @dont_override = @_;
+ foreach my $flag (@dont_override)
+ {
+ my $var = var $flag;
+ if ($var)
+ {
+ for my $cond ($var->conditions->conds)
+ {
+ if ($var->rdef ($cond)->owner == VAR_MAKEFILE)
+ {
+ msg_cond_var ('gnu', $cond, $flag,
+ "`$flag' is a user variable, "
+ . "you should not override it;\n"
+ . "use `AM_$flag' instead.");
+ }
+ }
+ }
+ }
+}
# Call finish function for each language that was used.
sub handle_languages
@@ -1261,8 +1286,12 @@
$libtool_tag = '--tag=' . $lang->libtool_tag . ' '
}
+ my $ptltflags = "${derived}_LIBTOOLFLAGS";
+ $ptltflags = 'AM_LIBTOOLFLAGS' unless set_seen $ptltflags;
+
my $obj_ltcompile =
- "\$(LIBTOOL) $libtool_tag--mode=compile $obj_compile";
+ "\$(LIBTOOL) $libtool_tag\$($ptltflags) \$(LIBTOOLFLAGS) "
+ . "--mode=compile $obj_compile";
# We _need_ `-o' for per object rules.
my $output_flag = $lang->output_flag || '-o';
@@ -1423,23 +1452,7 @@
# ... and so is LDFLAGS.
push @dont_override, 'LDFLAGS' if $lang->link;
- foreach my $flag (@dont_override)
- {
- my $var = var $flag;
- if ($var)
- {
- for my $cond ($var->conditions->conds)
- {
- if ($var->rdef ($cond)->owner == VAR_MAKEFILE)
- {
- msg_cond_var ('gnu', $cond, $flag,
- "`$flag' is a user variable, "
- . "you should not override it;\n"
- . "use `AM_$flag' instead.");
- }
- }
- }
- }
+ check_user_variables @dont_override;
}
# If the project is entirely C++ or entirely Fortran 77 (i.e., 1
@@ -1571,7 +1584,9 @@
# Do we have per-executable flags for this executable?
my $have_per_exec_flags = 0;
- foreach my $flag (@{$lang->flags})
+ my @peflags = @{$lang->flags};
+ push @peflags, 'LIBTOOLFLAGS' if $nonansi_obj eq '.lo';
+ foreach my $flag (@peflags)
{
if (set_seen ("${derived}_$flag"))
{
@@ -2270,6 +2285,8 @@
push (@libtool_rms, "\t-rm -rf ${dir}.libs ${dir}_libs");
}
+ check_user_variables 'LIBTOOLFLAGS';
+
# Output the libtool compilation rules.
$output_rules .= &file_contents ('libtool',
new Automake::Location,
@@ -5694,7 +5711,8 @@
# define_variable ($VAR, $VALUE, $WHERE)
# --------------------------------------
-# Define a new user variable VAR to VALUE, but only if not already defined.
+# Define a new Automake Makefile variable VAR to VALUE, but only if
+# not already defined.
sub define_variable ($$$)
{
my ($var, $value, $where) = @_;
@@ -5754,7 +5772,8 @@
if $lang->libtool_tag && exists $libtool_tags{$lang->libtool_tag};
&define_variable ($var, $value, INTERNAL);
&define_variable ("LT$var",
- "\$(LIBTOOL) $libtool_tag--mode=compile $value",
+ "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=compile $value",
INTERNAL)
if var ('LIBTOOL');
}
@@ -5776,7 +5795,8 @@
# CCLINK = $(CCLD) blah blah...
&define_variable ($lang->linker,
((var ('LIBTOOL') ?
- "\$(LIBTOOL) $libtool_tag--mode=link " : '')
+ "\$(LIBTOOL) $libtool_tag\$(AM_LIBTOOLFLAGS) "
+ . "\$(LIBTOOLFLAGS) --mode=link " : '')
. $lang->link),
INTERNAL);
}
Index: doc/automake.texi
===================================================================
RCS file: /cvs/automake/automake/doc/automake.texi,v
retrieving revision 1.74
diff -u -r1.74 automake.texi
--- doc/automake.texi 11 Dec 2004 00:29:28 -0000 1.74
+++ doc/automake.texi 12 Dec 2004 15:44:42 -0000
@@ -3038,7 +3038,7 @@
* Conditional Libtool Sources:: Choosing Library Sources Conditionally
* Libtool Convenience Libraries:: Building Convenience Libtool Libraries
* Libtool Modules:: Building Libtool Modules
-* Libtool Flags:: Using _LIBADD and _LDFLAGS
+* Libtool Flags:: Using _LIBADD, _LDFLAGS, and _LIBTOOLFLAGS
* LTLIBOBJS:: Using $(LTLIBOBJS) and $(LTALLOCA)
* Libtool Issues:: Common Issues Related to Libtool's Use
@end menu
@@ -3343,19 +3343,49 @@
the single file @file{mymodule.c} (@pxref{Default _SOURCES}).
@node Libtool Flags
address@hidden _LIBADD and _LDFLAGS
address@hidden @code{_LIBADD}, @code{_LDFLAGS}, and @code{_LIBTOOLFLAGS}
@cindex @code{_LIBADD}, libtool
@cindex @code{_LDFLAGS}, libtool
address@hidden @code{_LIBTOOLFLAGS}, libtool
address@hidden AM_LIBTOOLFLAGS
address@hidden LIBTOOLFLAGS
address@hidden maude_LIBTOOLFLAGS
As shown in previous sections, the @address@hidden
variable should be used to list extra libtool objects (@file{.lo}
files) or libtool libraries (@file{.la}) to add to @var{library}.
The @address@hidden variable is the place to list
-additional libtool flags, such as @samp{-version-info},
address@hidden, and a lot more. See @xref{Link mode, , Using libltdl,
+additional libtool linking flags, such as @samp{-version-info},
address@hidden, and a lot more. See @xref{Link mode, , Link mode,
libtool, The Libtool Manual}.
+The @command{libtool} command has two kinds of options: mode-specific
+options and generic options. Mode-specific options such as the
+aforementioned linking flags should be lumped with the other flags
+passed to the tool invoked by @command{libtool} (hence the use of
address@hidden@var{library}_LDFLAGS} for libtool linking flags). Generic
+options include @address@hidden and @samp{--silent}
+(@pxref{Invoking libtool, , Invoking @command{libtool}, libtool, The
+Libtool Manual} for more options) should appear before the mode
+selection on the command line; in @file{Makefile.am}s they should
+be listed in the @address@hidden variable.
+
+If @address@hidden is not defined, the global
address@hidden variable is used instead.
+
+These flags are passed to libtool after the @address@hidden
+option computed by Automake (if any), so
address@hidden@var{library}_LIBTOOLFLAGS} (or @samp{AM_LIBTOOLFLAGS}) is the
+good place to override or supplement the @address@hidden
+setting.
+
+The libtool rules also use a @code{LIBTOOLFLAGS} variable that should
+not be set in @file{Makefile.am}: this is a user variable (@pxref{Flag
+Variables Ordering}. It allows users to run @samp{make
+LIBTOOLFLAGS=--silent}, for instance.
+
+
@node LTLIBOBJS, Libtool Issues, Libtool Flags, A Shared Library
@subsection @code{LTLIBOBJS} and @code{LTALLOCA}
@cindex @code{LTLIBOBJS}, special handling
@@ -3572,6 +3602,12 @@
This variable is used to pass extra flags to the link step of a program
or a shared library.
address@hidden maude_LIBTOOLFLAGS
+This variable is used to pass extra options to @command{libtool}.
+These options are output before @command{libtool}'s @code{--mode=MODE}
+option, so they should not be mode-specific options (those belong to
+the compiler or linker flags). @xref{Libtool Flags}.
+
@item maude_DEPENDENCIES
It is also occasionally useful to have a program depend on some other
target which is not actually part of that program. This can be done
@@ -7953,6 +7989,7 @@
@cindex @code{AM_GCJFLAGS} and @code{GCJFLAGS}
@cindex @code{AM_LDFLAGS} and @code{LDFLAGS}
@cindex @code{AM_LFLAGS} and @code{LFLAGS}
address@hidden @code{AM_LIBTOOLFLAGS} and @code{LIBTOOLFLAGS}
@cindex @code{AM_OBJCFLAGS} and @code{OBJCFLAGS}
@cindex @code{AM_RFLAGS} and @code{RFLAGS}
@cindex @code{AM_YFLAGS} and @code{YFLAGS}
@@ -7965,6 +8002,7 @@
@cindex @code{GCJFLAGS} and @code{AM_GCJFLAGS}
@cindex @code{LDFLAGS} and @code{AM_LDFLAGS}
@cindex @code{LFLAGS} and @code{AM_LFLAGS}
address@hidden @code{LIBTOOLFLAGS} and @code{AM_LIBTOOLFLAGS}
@cindex @code{OBJCFLAGS} and @code{AM_OBJCFLAGS}
@cindex @code{RFLAGS} and @code{AM_RFLAGS}
@cindex @code{YFLAGS} and @code{AM_YFLAGS}
@@ -7974,7 +8012,8 @@
answer holds for all the compile flags used in Automake:
@code{CCASFLAGS}, @code{CFLAGS}, @code{CPPFLAGS}, @code{CXXFLAGS},
@code{FCFLAGS}, @code{FFLAGS}, @code{GCJFLAGS}, @code{LDFLAGS},
address@hidden, @code{OBJCFLAGS}, @code{RFLAGS}, and @code{YFLAGS}.
address@hidden, @code{LIBTOOLFLAGS}, @code{OBJCFLAGS}, @code{RFLAGS},
+and @code{YFLAGS}.
@code{CPPFLAGS}, @code{AM_CPPFLAGS}, and @code{mumble_CPPFLAGS} are
three variables that can be used to pass flags to the C preprocessor
@@ -9696,5 +9735,5 @@
@c LocalWords: syscalls perlhist acl pm multitable headitem fdl appendixsec
@c LocalWords: LTALLOCA MALLOC malloc memcmp strdup alloca libcompat xyz DFOO
@c LocalWords: unprefixed buildable preprocessed DBAZ DDATADIR WARNINGCFLAGS
address@hidden LocalWords: LIBFOOCFLAGS LIBFOOLDFLAGS ftable testSubDir obj
address@hidden LocalWords: LIBFOOCFLAGS LIBFOOLDFLAGS ftable testSubDir obj
LIBTOOLFLAGS
@c LocalWords: barexec Pinard's
Index: tests/libtool7.test
===================================================================
RCS file: /cvs/automake/automake/tests/libtool7.test,v
retrieving revision 1.2
diff -u -r1.2 libtool7.test
--- tests/libtool7.test 7 Sep 2004 21:03:32 -0000 1.2
+++ tests/libtool7.test 12 Dec 2004 15:44:42 -0000
@@ -19,6 +19,7 @@
# Boston, MA 02111-1307, USA.
# Make sure we allow Libtool's -dlopen/-dlpreopen
+# Also check basic support for AM_LIBTOOLFLAGS/LIBTOOLFLAGS
required='libtoolize gcc'
. ./defs || exit 1
@@ -34,12 +35,14 @@
cat > Makefile.am << 'END'
AUTOMAKE_OPTIONS = subdir-objects
+AM_LIBTOOLFLAGS = --silent
lib_LTLIBRARIES = libmod1.la mod2.la
libmod1_la_SOURCES = sub/mod1.c
libmod1_la_LDFLAGS = -module
libmod1_la_LIBADD = -dlopen mod2.la
mod2_la_SOURCES = mod2.c
mod2_la_LDFLAGS = -module
+mod2_la_LIBTOOLFLAGS =
bin_PROGRAMS = prg
prg_SOURCES = prg.c
@@ -48,7 +51,7 @@
print:
@echo 1BEG: $(prg_DEPENDENCIES) :END1
@echo 2BEG: $(libmod1_la_DEPENDENCIES) :END2
-
+ @echo 3BEG: $(LTCOMPILE) :END3
END
mkdir sub liba
@@ -83,8 +86,10 @@
$AUTOMAKE --add-missing --copy
./configure
-$MAKE print >output 2>&1
+env LIBTOOLFLAGS=--silent $MAKE print >output 2>&1
cat output
grep '1BEG: libmod1.la mod2.la :END1' output
grep '2BEG: mod2.la :END2' output
+grep '3BEG: .*silent.*silent.* :END3' output
+test 2 -le `grep mod2_la_LIBTOOLFLAGS Makefile | wc -l`
$MAKE
Index: tests/libtool8.test
===================================================================
RCS file: /cvs/automake/automake/tests/libtool8.test,v
retrieving revision 1.1
diff -u -r1.1 libtool8.test
--- tests/libtool8.test 7 Mar 2004 12:36:54 -0000 1.1
+++ tests/libtool8.test 12 Dec 2004 15:44:42 -0000
@@ -44,6 +44,7 @@
if COND1
pkglib_LTLIBRARIES = liba.la
endif
+LIBTOOLFLAGS = ouch
endif
END
@@ -54,3 +55,4 @@
grep 'Makefile.am:3:.*libc.la.*multiply defined' stderr
grep 'Makefile.am:9:.*`pkglib' stderr
grep 'Makefile.am:2:.*`lib' stderr
+grep 'Makefile.am:11:.*AM_LIBTOOLFLAGS' stderr
--
Alexandre Duret-Lutz
- Re: libtool --silent based on MAKEFLAGS?, Ralf Wildenhues, 2004/12/10
- Re: libtool --silent based on MAKEFLAGS?, Peter O'Gorman, 2004/12/10
- Re: libtool --silent based on MAKEFLAGS?, Bob Friesenhahn, 2004/12/10
- Re: libtool --silent based on MAKEFLAGS?, Alexandre Duret-Lutz, 2004/12/12
- AM_LIBTOOLFLAGS, maude_LIBTOOLFLAGS, and LIBTOOLFLAGS (Was: Re: libtool --silent based on MAKEFLAGS?),
Alexandre Duret-Lutz <=
- Re: AM_LIBTOOLFLAGS, maude_LIBTOOLFLAGS, and LIBTOOLFLAGS, Ralf Wildenhues, 2004/12/13
- Re: AM_LIBTOOLFLAGS, maude_LIBTOOLFLAGS, and LIBTOOLFLAGS, Alexandre Duret-Lutz, 2004/12/13
- Re: AM_LIBTOOLFLAGS, maude_LIBTOOLFLAGS, and LIBTOOLFLAGS, Ralf Wildenhues, 2004/12/14
- Re: AM_LIBTOOLFLAGS, maude_LIBTOOLFLAGS, and LIBTOOLFLAGS, Alexandre Duret-Lutz, 2004/12/14
- Re: libtool --silent based on MAKEFLAGS?, Peter O'Gorman, 2004/12/12
- Re: libtool --silent based on MAKEFLAGS?, Ralf Wildenhues, 2004/12/12