automake
[Top][All Lists]
Advanced

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

02-define-exts.patch


From: Akim Demaille
Subject: 02-define-exts.patch
Date: Sun, 04 Mar 2001 22:12:58 +0100

There are two motivations for this patch: first it simplifies
Automake, and second, anyway this is the path for the future, since
Autoconf 2.50 defines these guys by default, so there will not even be
any reason for defaulting them.


Index: ChangeLog
from  Akim Demaille  <address@hidden>
        If OBJEXT and EXEEXT are not set, provide a default value, and use
        them unconditionally.

        * automake.in (&generate_makefile): Provide default values for
        EXEEXT and OBJEXT.
        (&get_object_extension, &finish_languages)
        (&handle_single_transform_list, &handle_programs, &add_depend2)
        (&check_cygnus, &lang_c_finish, am_install_var): Don't bother with
        them, they are defined.
        * compile.am, depend2.am, program.am, progs.am: Likewise.
        * remake-hdr.am: Fix a typo.
        * tests/cxxo.test, tests/fo.test, tests/implicit.test,
        * tests/interp.test, tests/subobj.test, tests/subobj2.test,
        * tests/suffix2.test: Adjust.

Index: automake.in
--- automake.in Sun, 04 Mar 2001 15:17:55 +0100 akim (am/f/39_automake.i 1.109 
755)
+++ automake.in Sun, 04 Mar 2001 15:49:07 +0100 akim (am/f/39_automake.i 1.109 
755)
@@ -1115,6 +1115,14 @@ sub generate_makefile
        return;
     }

+    # If OBJEXT/EXEEXT were not set in configure.in, do it, it
+    # simplifies our task, and anyway starting with Autoconf 2.50, it
+    # will always be defined, and this code will be dead.
+    $output_vars .= "EXEEXT =\n"
+      unless $seen_exeext;
+    $output_vars .= "OBJEXT = o\n"
+      unless $seen_objext;
+
     # Must do this after reading .am file.  See read_main_am_file to
     # understand weird tricks we play there with variables.
     &define_variable ('subdir', $relative_dir);
@@ -1319,8 +1327,7 @@ sub get_object_extension
     my ($out) = @_;

     # Maybe require libtool library object files.
-    my $extension = '.o';
-    $extension = '.$(OBJEXT)' if $seen_objext;
+    my $extension = '.$(OBJEXT)';
     $extension = '.lo' if ($out =~ /\.la$/);

     if (! $included_generic_compile)
@@ -1344,8 +1351,7 @@ sub get_object_extension
                          &transform ('DEFAULT_INCLUDES' => $default_include));

        $output_rules .=
-         &file_contents ('compile',
-                         &transform ('OBJEXT' => $seen_objext));
+         &file_contents ('compile');

        # If using X, include some extra variable definitions.  NOTE
        # we don't want to force these into CFLAGS or anything,
@@ -1359,8 +1365,7 @@ sub get_object_extension
            }
        }

-       push (@suffixes, '.c', '.o');
-       push (@suffixes, '.obj') if $seen_objext;
+       push (@suffixes, '.c', '.o', '.obj');

        $included_generic_compile = 1;
     }
@@ -1402,26 +1407,25 @@ sub get_object_extension
            # Generate rules to build ansi2knr.  If it is in some
            # other directory, then generate dependencies but have the
            # rule just run elsewhere.
-           my $objext = $seen_objext ? ".\$(OBJEXT)" : ".o";
            $output_rules .= ($options{'ansi2knr'} . ': '
-                             . $options{'ansi2knr'} . $objext . "\n");
+                             . $options{'ansi2knr'} . '.$(OBJEXT)' . "\n");
            if ($options{'ansi2knr'} eq 'ansi2knr')
            {
-               $output_rules .= ("\t\$(LINK) ansi2knr" . $objext
+               $output_rules .= ("\t\$(LINK) ansi2knr.\$(OBJEXT)"
                                  . " \$(LIBS)\n"
-                                 . "ansi2knr" . $objext
+                                 . 'ansi2knr.$(OBJEXT)'
                                  . ": \$(CONFIG_HEADER)\n\n");
            }
            else
            {
                $output_rules .= ("\tcd " . dirname ($options{'ansi2knr'})
-                                 . " && \$(MAKE) \$(AM_MAKEFLAGS) "
+                                 . ' && $(MAKE) $(AM_MAKEFLAGS) '
                                  . "ansi2knr\n\n");
                # This is required for non-GNU makes.
-               $output_rules .= ($options{'ansi2knr'} . $objext . ":\n");
+               $output_rules .= ($options{'ansi2knr'} . '.$(OBJEXT)' . ":\n");
                $output_rules .= ("\tcd " . dirname ($options{'ansi2knr'})
-                                 . " && \$(MAKE) \$(AM_MAKEFLAGS)"
-                                 . " ansi2knr" . $objext . "\n\n");
+                                 . ' && $(MAKE) $(AM_MAKEFLAGS)'
+                                 . ' ansi2knr.$(OBJEXT)' . "\n\n");
            }

            # Make sure ansi2knr can be found: if no path specified,
@@ -1497,8 +1501,7 @@ sub finish_languages
            # FIXME: Using cygpath should be somehow conditional.
            $output_rules .= (".$ext.obj:\n"
                              . $full
-                             . " \`cygpath -w \$<\`\n")
-               if $seen_objext;
+                             . " \`cygpath -w \$<\`\n");
            $output_rules .= (".$ext.lo:\n"
                              . "\t\$(LT"
                              . $language_map{$lang . '-compiler-name'}
@@ -1908,7 +1911,7 @@ sub handle_single_transform_list
         {
             my $depfile = $object;
             $depfile =~ s/\.([^.]*)$/.P$1/;
-            $depfile =~ s/\$\(OBJEXT\)$/o/ if $seen_objext;
+            $depfile =~ s/\$\(OBJEXT\)$/o/;
             $dep_files{'$(DEPDIR)/' . $depfile} = 1;
         }
     }
@@ -2299,15 +2302,8 @@ sub handle_programs
            $xlink = $linker ? $linker : 'LINK';
        }

-       my $exeext = '';
-       if ($seen_exeext && $one_file !~ /\./)
-       {
-           $exeext = '$(EXEEXT)';
-       }
-
        $output_rules .= &file_contents ('program',
-                                        &transform ('EXEEXT'   => $exeext,
-                                                    'PROGRAM'  => $one_file,
+                                        &transform ('PROGRAM'  => $one_file,
                                                     'XPROGRAM' => $xname,
                                                     'XLINK'    => $xlink));
     }
@@ -3220,7 +3216,6 @@ sub add_depend2
     # First include code for ordinary objects.
     my $xform = &transform ('PFX'  => $pfx,
                            'FPFX' => $fpfx,
-                           'OBJEXT'  => $seen_objext,
                            'LIBTOOL' => $seen_libtool,
                            'AMDEP'   => $use_dependencies);

@@ -4822,11 +4817,6 @@ sub check_cygnus
     {
        &am_conf_error ("\`AM_MAINTAINER_MODE' required when --cygnus 
specified");
     }
-
-    if (! $seen_exeext)
-    {
-       &am_conf_error ("\`AC_EXEEXT' required when --cygnus specified");
-    }
 }

 # Do any extra checking for GNU standards.
@@ -5082,9 +5072,9 @@ sub lang_c_finish
                              . '; else echo ' . $base . '.c; fi` '
                              . "| sed 's/^# \\([0-9]\\)/#line \\1/' "
                              . '| $(ANSI2KNR) > ' . $base . "_.c\n");
-           push (@objects, $base . '_'
-                 . ($seen_objext ? '.$(OBJEXT)' : '.o'));
-           push (@objects, $base . '_.lo') if $seen_libtool;
+           push (@objects, $base . '_.$(OBJEXT)');
+           push (@objects, $base . '_.lo')
+             if $seen_libtool;
        }

        # Make all _.o (and _.lo) files depend on ansi2knr.
@@ -7039,7 +7029,7 @@ sub am_install_var

            # A blatant hack: we rewrite each _PROGRAMS primary to
            # include EXEEXT when in Cygwin32 mode.
-           if ($seen_exeext && $primary eq 'PROGRAMS')
+           if ($primary eq 'PROGRAMS')
            {
                my @conds = &variable_conditions ($one_name);

Index: compile.am
--- compile.am Fri, 09 Feb 2001 04:37:00 +0100 akim (am/g/48_compile.am 1.3 644)
+++ compile.am Sun, 04 Mar 2001 15:35:53 +0100 akim (am/g/48_compile.am 1.3 644)
@@ -20,8 +20,7 @@
 mostlyclean-compile:
 ## Don't remove 'core.*' because some distributions have eg "core.c".
 ## 4.4BSD systems use `PROG.core'.
-       -rm -f *.o core *.core
-?OBJEXT?       -rm -f *.$(OBJEXT)
+       -rm -f *.$(OBJEXT) core *.core

 distclean-am: distclean-compile
 distclean-compile:
Index: depend2.am
--- depend2.am Tue, 27 Feb 2001 22:23:36 +0100 akim (am/g/43_depend2.am 1.7 644)
+++ depend2.am Sun, 04 Mar 2001 15:37:06 +0100 akim (am/g/43_depend2.am 1.7 644)
@@ -30,16 +30,16 @@
 address@hidden@        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
        %COMPILE% -c -o %OBJ% `test -f %SOURCE% || echo '$(srcdir)/'`%SOURCE%

-?GENERIC??LIBTOOL?%EXT%.lo:
-?!GENERIC??LIBTOOL?LTOBJ%: %SOURCE%
+?LIBTOOL??GENERIC?%EXT%.lo:
+?LIBTOOL??!GENERIC?%LTOBJ%: %SOURCE%
 address@hidden@        source='%SOURCE%' object='%LTOBJ%' libtool=yes 
@AMDEPBACKSLASH@
 address@hidden@        depfile='$(DEPDIR)/%BASE%.Plo' 
tmpdepfile='$(DEPDIR)/%BASE%.TPlo' @AMDEPBACKSLASH@
 address@hidden@        $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
 ?LIBTOOL?      %LTCOMPILE% -c -o %LTOBJ% `test -f %SOURCE% || echo 
'$(srcdir)/'`%SOURCE%

-?GENERIC??OBJEXT?%EXT%.obj:
-?!GENERIC??OBJEXT?%OBJOBJ%: %SOURCE%
address@hidden@ source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
address@hidden@ depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' 
@AMDEPBACKSLASH@
address@hidden@ $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
-?OBJEXT?       %COMPILE% -c -o %OBJOBJ% `cygpath -w %SOURCE%`
+?GENERIC?%EXT%.obj:
+?!GENERIC?%OBJOBJ%: %SOURCE%
address@hidden@ source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
address@hidden@ depfile='$(DEPDIR)/%BASE%.Po' tmpdepfile='$(DEPDIR)/%BASE%.TPo' 
@AMDEPBACKSLASH@
address@hidden@ $(%FPFX%DEPMODE) $(depcomp) @AMDEPBACKSLASH@
+       %COMPILE% -c -o %OBJOBJ% `cygpath -w %SOURCE%`
Index: program.am
--- program.am Mon, 26 Feb 2001 23:44:40 +0100 akim (am/g/22_program.am 1.4 644)
+++ program.am Sun, 04 Mar 2001 15:39:51 +0100 akim (am/g/22_program.am 1.4 644)
@@ -15,11 +15,11 @@
 ## along with this program; if not, write to the Free Software
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.
-%PROGRAM%%EXEEXT%: $(%XPROGRAM%_OBJECTS) $(%XPROGRAM%_DEPENDENCIES)
+%PROGRAM%: $(%XPROGRAM%_OBJECTS) $(%XPROGRAM%_DEPENDENCIES)
 ## Remove program before linking.  Otherwise the link will fail if the
 ## program is running somewhere.  FIXME: this could be a loss if
 ## you're using an incremental linker.  Maybe we should think twice?
 ## Or maybe not... sadly, incremental linkers are rarer than losing
 ## systems.
-       @rm -f %PROGRAM%%EXEEXT%
+       @rm -f %PROGRAM%
        $(%XLINK%) $(%XPROGRAM%_LDFLAGS) $(%XPROGRAM%_OBJECTS) 
$(%XPROGRAM%_LDADD) $(LIBS)
Index: progs.am
--- progs.am Thu, 01 Mar 2001 22:55:36 +0100 akim (am/g/20_progs.am 1.5 644)
+++ progs.am Sun, 04 Mar 2001 15:42:02 +0100 akim (am/g/20_progs.am 1.5 644)
@@ -1,5 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright 1994, 1995, 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
+## Copyright 1994, 1995, 1996, 1997, 1998, 1999, 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
@@ -16,6 +17,11 @@
 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
 ## 02111-1307, USA.

+
+## ------------ ##
+## Installing.  ##
+## ------------ ##
+
 _am_installdirs += $(DESTDIR)$(%NDIR%dir)
 ?EXEC?.PHONY install-exec-am: install-%DIR%PROGRAMS
 ?!EXEC?.PHONY install-data-am: install-%DIR%PROGRAMS
@@ -29,7 +35,7 @@
 ## Note that we explicitly set the libtool mode.  This avoids any
 ## lossage if the install program doesn't have a name that libtool
 ## expects.
-           f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 
's/$$/$(EXEEXT)/'`"; \
+           f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
 ?LIBTOOL?          echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install 
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(%NDIR%dir)/$$f"; \
 ?LIBTOOL?          $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install 
$(INSTALL_PROGRAM) $$p $(DESTDIR)$(%NDIR%dir)/$$f; \
 ?!LIBTOOL?         echo " $(INSTALL_PROGRAM_ENV) $(INSTALL_PROGRAM) $$p 
$(DESTDIR)$(%NDIR%dir)/$$f"; \
@@ -37,11 +43,16 @@
          else :; fi; \
        done

+
+## -------------- ##
+## uninstalling.  ##
+## -------------- ##
+
 .PHONY uninstall-am: uninstall-%DIR%PROGRAMS
 uninstall-%DIR%PROGRAMS:
        @$(NORMAL_UNINSTALL)
        @list='$(%DIR%_PROGRAMS)'; for p in $$list; do \
-         f="`echo $$p|sed -e 's/$(EXEEXT)$$//' -e '$(transform)' -e 
's/$$/$(EXEEXT)/'`"; \
+         f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
          echo " rm -f $(DESTDIR)$(%NDIR%dir)/$$f"; \
          rm -f $(DESTDIR)$(%NDIR%dir)/$$f; \
        done
Index: remake-hdr.am
--- remake-hdr.am Sun, 04 Mar 2001 15:17:55 +0100 akim (am/g/17_remake-hdr 1.6 
644)
+++ remake-hdr.am Sun, 04 Mar 2001 15:50:22 +0100 akim (am/g/17_remake-hdr 1.6 
644)
@@ -48,7 +48,7 @@
                rm -f $(srcdir)/%SRC_STAMP%.in; \
                $(MAKE) $(srcdir)/%SRC_STAMP%.in; \
        else :; fi
-$(srcdir)/%SRC_STAMP%.in: $(top_srcdir)/%CONFIGURE_AC% $(ACLOCAL_M4) %FILES%
+$(srcdir)/%SRC_STAMP%.in: $(top_srcdir)/%CONFIGURE-AC% $(ACLOCAL_M4) %FILES%
        @rm -f $(srcdir)/%SRC_STAMP%.in $(srcdir)/%SRC_STAMP%.inT
 ## We used to try to get a real timestamp here.  But the fear is that
 ## that will cause unnecessary cvs conflicts
Index: tests/cxxo.test
--- tests/cxxo.test Sat, 13 Jan 2001 18:11:09 +0100 akim (am/d/33_cxxo.test 1.1 
775)
+++ tests/cxxo.test Sun, 04 Mar 2001 18:09:21 +0100 akim (am/d/33_cxxo.test 1.1 
775)
@@ -16,4 +16,4 @@

 $AUTOMAKE || exit 1

-fgrep doe.o Makefile.in
+fgrep 'doe.$(OBJEXT)' Makefile.in
Index: tests/fo.test
--- tests/fo.test Sat, 13 Jan 2001 18:11:09 +0100 akim (am/d/3_fo.test 1.1 775)
+++ tests/fo.test Sun, 04 Mar 2001 18:09:33 +0100 akim (am/d/3_fo.test 1.1 775)
@@ -18,4 +18,4 @@

 $AUTOMAKE || exit 1

-fgrep doe.o Makefile.in
+fgrep 'doe.$(OBJEXT)' Makefile.in
Index: tests/implicit.test
--- tests/implicit.test Sat, 13 Jan 2001 18:11:09 +0100 akim 
(am/c/46_implicit.t 1.1 775)
+++ tests/implicit.test Sun, 04 Mar 2001 18:09:51 +0100 akim 
(am/c/46_implicit.t 1.1 775)
@@ -15,4 +15,4 @@

 $AUTOMAKE || exit 1

-grep '^libapp_1_OBJECTS' Makefile.in | grep '\.o'
+grep '^libapp_1_OBJECTS' Makefile.in | fgrep '.$(OBJEXT)'
Index: tests/interp.test
--- tests/interp.test Sat, 13 Jan 2001 18:11:09 +0100 akim (am/c/33_interp.tes 
1.1 775)
+++ tests/interp.test Sun, 04 Mar 2001 18:10:08 +0100 akim (am/c/33_interp.tes 
1.1 775)
@@ -16,4 +16,4 @@

 $AUTOMAKE || exit 1

-grep 'z\.o' Makefile.in
+fgrep 'z.$(OBJEXT)' Makefile.in
Index: tests/subobj.test
--- tests/subobj.test Sat, 13 Jan 2001 18:11:09 +0100 akim (am/39_subobj.tes 
1.1 775)
+++ tests/subobj.test Sun, 04 Mar 2001 19:50:13 +0100 akim (am/39_subobj.tes 
1.1 775)
@@ -19,8 +19,8 @@

 $AUTOMAKE || exit 1

-fgrep 'generic/a.o' Makefile.in || exit 1
-grep '[^/]a\.o' Makefile.in && exit 1
+fgrep 'generic/a.$(OBJEXT)' Makefile.in || exit 1
+grep '[^/]a\.\$(OBJEXT)' Makefile.in && exit 1

 # Opportunistically test for a different bug.
-grep '^generic/b.o:.*dirstamp' Makefile.in
+grep '^generic/b.\$(OBJEXT):.*dirstamp' Makefile.in
Index: tests/subobj2.test
--- tests/subobj2.test Sat, 13 Jan 2001 18:11:09 +0100 akim (am/38_subobj2.te 
1.1 775)
+++ tests/subobj2.test Sun, 04 Mar 2001 18:10:35 +0100 akim (am/38_subobj2.te 
1.1 775)
@@ -18,6 +18,6 @@

 $AUTOMAKE || exit 1

-fgrep 'generic/a.o' Makefile.in || exit 1
-grep '[^/]a\.o' Makefile.in && exit 1
+fgrep 'generic/a.$(OBJEXT)' Makefile.in || exit 1
+grep '[^/]a\.\$(OBJEXT)' Makefile.in && exit 1
 fgrep -e '-c -o' Makefile.in
Index: tests/suffix2.test
--- tests/suffix2.test Sat, 13 Jan 2001 18:11:09 +0100 akim (am/34_suffix2.te 
1.1 775)
+++ tests/suffix2.test Sun, 04 Mar 2001 18:12:59 +0100 akim (am/34_suffix2.te 
1.1 775)
@@ -27,4 +27,5 @@

 $AUTOMAKE -a || exit 1

-test "`fgrep '.c.o' Makefile.in | wc -l`" -eq 1
+grep '^\.c\.o:' Makefile.in
+grep '^\.c\.obj:' Makefile.in



reply via email to

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