Index: ChangeLog from Akim Demaille <[EMAIL PROTECTED]> * 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. Index: Makefile.am --- Makefile.am Sun, 11 Mar 2001 21:33:37 +0100 akim (am/f/46_Makefile.a 1.21 644) +++ Makefile.am Thu, 15 Mar 2001 00:26:13 +0100 akim (am/f/46_Makefile.a 1.21 644) @@ -12,8 +12,8 @@ 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 Index: Makefile.in --- Makefile.in Wed, 14 Mar 2001 23:16:54 +0100 akim (am/h/16_Makefile.i 1.59 644) +++ Makefile.in Thu, 15 Mar 2001 00:26:39 +0100 akim (am/h/16_Makefile.i 1.59 644) @@ -86,8 +86,8 @@ 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 Index: automake.in --- automake.in Thu, 15 Mar 2001 00:10:18 +0100 akim (am/f/39_automake.i 1.193 755) +++ automake.in Thu, 15 Mar 2001 00:36:41 +0100 akim (am/f/39_automake.i 1.193 755) @@ -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,33 +1273,18 @@ 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; + my $compiler = $language_map{"$lang-compiler-name"}; + $output_rules .= file_contents ('ext-compile', + ('EXT' => $ext, + 'COMPILER' => $compiler, + 'OUTARG' => $outarg, + 'LTOUTARG' => $ltoutarg)); } - push (@suffixes, '.' . $ext); - # The rest of the loop is done once per language. next if defined $done{$lang}; $done{$lang} = 1; @@ -1314,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. Index: ext-compile.am --- ext-compile.am Thu, 15 Mar 2001 00:39:10 +0100 akim () +++ ext-compile.am Thu, 15 Mar 2001 00:36:32 +0100 akim (am/h/38_ext-compil 644) @@ -0,0 +1,31 @@ +## 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 and LTOUTARG are set to `-o $@' or `'. + +.%EXT%.o: + $(%COMPILER%) %OUTARG% $< + +.%EXT%.obj: +## FIXME: Using cygpath should be somehow conditional. + $(%COMPILER%) %OUTARG% `cygpath -w $<` + +if %?LIBTOOL% +.%EXT%.lo: + $(LT%COMPILER%) %LTOUTARG% $< +endif %?LIBTOOL%