From a14cc490c7fc7ff7b989e695d313392dcdc44919 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Mon, 9 Apr 2001 14:56:27 +0000 Subject: [PATCH] * ext-compile.am: New file. * automake.in (&finish_languages): Output it. Require a C linker if there are several registered source suffixes. (&handle_compile): No longer push the `.c', `.o', `.obj', `.lo' extensions, which are discovered in ext-compile.am. With the help from Robert Boehne. --- ChangeLog | 9 +++++++++ Makefile.am | 4 ++-- Makefile.in | 4 ++-- automake.in | 46 ++++++++++++++-------------------------------- ext-compile.am | 33 +++++++++++++++++++++++++++++++++ lib/am/Makefile.am | 4 ++-- 6 files changed, 62 insertions(+), 38 deletions(-) create mode 100644 ext-compile.am diff --git a/ChangeLog b/ChangeLog index 25721a19..bff8d79e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2001-04-09 Akim Demaille + + * ext-compile.am: New file. + * automake.in (&finish_languages): Output it. + Require a C linker if there are several registered source suffixes. + (&handle_compile): No longer push the `.c', `.o', `.obj', `.lo' + extensions, which are discovered in ext-compile.am. + With the help from Robert Boehne. + 2001-04-09 Akim Demaille * automake.in (&handle_compile): Extract from... diff --git a/Makefile.am b/Makefile.am index 33c4abfb..26ed9c11 100644 --- a/Makefile.am +++ b/Makefile.am @@ -12,8 +12,8 @@ info_TEXINFOS = automake.texi amfiles = ansi2knr.am check.am clean-hdr.am clean.am compile.am \ configure.am data.am dejagnu.am depend.am depend2.am distdir.am \ -footer.am header-vars.am header.am install.am java.am lex.am \ -library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \ +ext-compile.am footer.am header-vars.am header.am install.am java.am \ +lex.am library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \ mans-vars.am mans.am multilib.am program.am progs.am python.am \ remake-hdr.am scripts.am subdirs.am tags.am texi-vers.am texibuild.am \ texinfos.am yacc.am diff --git a/Makefile.in b/Makefile.in index df1566f4..e18e2ea3 100644 --- a/Makefile.in +++ b/Makefile.in @@ -85,8 +85,8 @@ info_TEXINFOS = automake.texi amfiles = ansi2knr.am check.am clean-hdr.am clean.am compile.am \ configure.am data.am dejagnu.am depend.am depend2.am distdir.am \ -footer.am header-vars.am header.am install.am java.am lex.am \ -library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \ +ext-compile.am footer.am header-vars.am header.am install.am java.am \ +lex.am library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \ mans-vars.am mans.am multilib.am program.am progs.am python.am \ remake-hdr.am scripts.am subdirs.am tags.am texi-vers.am texibuild.am \ texinfos.am yacc.am diff --git a/automake.in b/automake.in index 58df05e6..9f21b48e 100755 --- a/automake.in +++ b/automake.in @@ -1265,6 +1265,7 @@ sub finish_languages $comp = $language_map{"$lang-compile"}; my $outarg = $language_map{"$lang-output-arg"}; + my $ltoutarg; if ($language_map{"$lang-flags"} eq 'CFLAGS') { # C compilers don't always support -c -o. @@ -1272,32 +1273,17 @@ sub finish_languages { $outarg .= ' -o $@'; } + # We can always use -c -o with libtool. + $ltoutarg = ' -o $@'; } - my $full = ("\t\$(" - . $language_map{"$lang-compiler-name"} - . ") " - . $outarg); - $output_rules .= (".$ext.o:\n" - . $full - . " \$<\n"); - # FIXME: Using cygpath should be somehow conditional. - $output_rules .= (".$ext.obj:\n" - . $full - . " `cygpath -w \$<`\n"); - $output_rules .= (".$ext.lo:\n" - . "\t\$(LT" - . $language_map{"$lang-compiler-name"} - . ") " - . $language_map{"$lang-output-arg"} - # We can always use -c -o with libtool. - . ($language_map{"$lang-flags"} eq 'CFLAGS' - ? ' -o $@' : '') - . " \$<\n") - if $seen_libtool; - } - - push (@suffixes, '.' . $ext); + my $compiler = $language_map{"$lang-compiler-name"}; + $output_rules .= file_contents ('ext-compile', + ('EXT' => $ext, + 'COMPILER' => $compiler, + 'OUTARG' => $outarg, + 'LTOUTARG' => $ltoutarg)); + } # The rest of the loop is done once per language. next if defined $done{$lang}; @@ -1328,10 +1314,10 @@ sub finish_languages & $name (); } - # If the project is entirely C++ or entirely Fortran 77, don't - # bother with the C stuff. But if anything else creeps in, then use - # it. - if ($need_link || ! $non_c || scalar keys %suffix_rules > 0) + # If the project is entirely C++ or entirely Fortran 77 (i.e., 1 + # suffix rule was learned), don't bother with the C stuff. But if + # anything else creeps in, then use it. + if ($need_link || ! $non_c || scalar keys %suffix_rules > 1) { if (! defined $done{'c'}) { @@ -1996,14 +1982,10 @@ sub handle_compile () } } - push (@suffixes, '.c', '.o', '.obj'); - if ($seen_libtool) { # Output the libtool compilation rules. $output_rules .= &file_contents ('libtool'); - - push (@suffixes, '.lo'); } # Check for automatic de-ANSI-fication. diff --git a/ext-compile.am b/ext-compile.am new file mode 100644 index 00000000..329939f2 --- /dev/null +++ b/ext-compile.am @@ -0,0 +1,33 @@ +## automake - create Makefile.in from Makefile.am +## Copyright 2001 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, write to the Free Software +## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA +## 02111-1307, USA. + +## OUTARG is set to `', or `-c', or `-c -o $@' etc. +## LTOUTARG is set to `', or `-o $@'. + +.%EXT%.o: + $(%COMPILER%) %OUTARG% $< + +.%EXT%.obj: +## FIXME: Using cygpath should be somehow conditional. + $(%COMPILER%) %OUTARG% `cygpath -w $<` + +if %?LIBTOOL% +.%EXT%.lo: +## We don't care if there are several `-o', libtool handles it gracefully. + $(LT%COMPILER%) %OUTARG% %LTOUTARG% $< +endif %?LIBTOOL% diff --git a/lib/am/Makefile.am b/lib/am/Makefile.am index 33c4abfb..26ed9c11 100644 --- a/lib/am/Makefile.am +++ b/lib/am/Makefile.am @@ -12,8 +12,8 @@ info_TEXINFOS = automake.texi amfiles = ansi2knr.am check.am clean-hdr.am clean.am compile.am \ configure.am data.am dejagnu.am depend.am depend2.am distdir.am \ -footer.am header-vars.am header.am install.am java.am lex.am \ -library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \ +ext-compile.am footer.am header-vars.am header.am install.am java.am \ +lex.am library.am libs.am libtool.am lisp.am ltlib.am ltlibrary.am \ mans-vars.am mans.am multilib.am program.am progs.am python.am \ remake-hdr.am scripts.am subdirs.am tags.am texi-vers.am texibuild.am \ texinfos.am yacc.am -- 2.43.5