automake
[Top][All Lists]
Advanced

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

63-remove-recursive-install.patch


From: Akim Demaille
Subject: 63-remove-recursive-install.patch
Date: Sat, 24 Feb 2001 19:16:11 +0100

Given that $recursive_install == &variable_defined ('SUBDIRS'), given
that the latter is always valid but the former only after
handle_subdirs was run, the latter is safer.  So I replaced each
occurrence of $recursive_install (which name was quite confusing
anyway IMHO) with it's definition.

Hence this patch augments the robustness of the whole code, which
seems more important than the performance loss it induces, and the
slight obfuscation of some places of the code.

Moreover, IMO, the obfuscated places (such as

-           $all_target = $recursive_install ? 'all-recursive' : 'all-am';
+           $all_target = (&variable_defined ('SUBDIRS')
+                          ? 'all-recursive' : 'all-am');

) will anyway disapear from automake some day, moved into the right
*.am file.

Index: ChangeLog
from  Akim Demaille  <address@hidden>
        * automake.in ($install_recursive): Remove, replaced with calls to
        `&variable_defined ('SUBDIRS')'.
        (&handle_dist, &handle_clean): Don't transform_cond SUBDIRS since...
        (&file_contents): now does.

Index: automake.in
--- automake.in Sat, 24 Feb 2001 13:36:54 +0100 akim (am/f/39_automake.i 1.70 
755)
+++ automake.in Sat, 24 Feb 2001 14:42:59 +0100 akim (am/f/39_automake.i 1.70 
755)
@@ -2568,11 +2568,10 @@ sub handle_tags
                $config .= basename ($one_hdr);
            }
        }
-       my $xform = &transform ('CONFIG' => $config,
-                               'DIRS'   => join (' ', @tag_deps));
-       $xform .= &transform_cond ('SUBDIRS' => &variable_defined ('SUBDIRS'));
-
-       $output_rules .= &file_contents ('tags', $xform);
+       $output_rules .=
+         &file_contents ('tags',
+                         &transform ('CONFIG' => $config,
+                                     'DIRS'   => join (' ', @tag_deps)));
        $output_rules .= &file_contents ('tags-clean');
        &examine_variable ('TAGS_DEPENDENCIES');
     }
@@ -2783,8 +2782,6 @@ sub handle_dist
                                    'TOP_DISTDIR'  => $top_distdir)
                      . &transform_cond ('DIST-TARGETS' =>
                                            scalar @dist_targets,
-                                        'SUBDIRS'  =>
-                                           &variable_defined ('SUBDIRS'),
                                         'DISTDIR' =>
                                            ! &variable_defined ('distdir')));
 }
@@ -2955,7 +2952,8 @@ sub handle_dependencies
 # Handle subdirectories.
 sub handle_subdirs
 {
-    return if ! &variable_defined ('SUBDIRS');
+    return
+      unless &variable_defined ('SUBDIRS');

     # Make sure each directory mentioned in SUBDIRS actually exists.
     foreach my $dir (&variable_value_as_list ('SUBDIRS', 'all'))
@@ -2980,8 +2978,6 @@ sub handle_subdirs
                      ('INSTALLINFO' => (defined $options{'no-installinfo'}
                                         ? 'install-info-recursive'
                                         : '')));
-
-    $recursive_install = 1;
 }

 # Handle aclocal.m4.
@@ -3540,7 +3536,7 @@ sub handle_footer
 sub handle_installdirs
 {
     # GNU Makefile standards recommend this.
-    if ($recursive_install)
+    if (&variable_defined ('SUBDIRS'))
     {
        # We create a separate `-am' target so that the -recursive
        # rule will work correctly.
@@ -3644,7 +3640,7 @@ sub handle_merge_targets
            $output_rules .= ("all-redirect: ${local_headers}"
                              . "\n\t"
                              . '$(MAKE) $(AM_MAKEFLAGS) '
-                             . ($recursive_install
+                             . (&variable_defined ('SUBDIRS')
                                 ? 'all-recursive' : 'all-am')
                              . "\n\n");
            $all_target = 'all-redirect';
@@ -3733,14 +3729,16 @@ sub do_one_merge_target
        # appropriate actual redirect.
        if ($all_target eq '')
        {
-           $all_target = $recursive_install ? 'all-recursive' : 'all-am';
+           $all_target = (&variable_defined ('SUBDIRS')
+                          ? 'all-recursive' : 'all-am');
        }

        $output_all = "all: $all_target\n";
     }
     else
     {
-       my $lname = $name . ($recursive_install ? '-recursive' : '-am');
+      my $lname = ($name .
+                  (&variable_defined ('SUBDIRS') ? '-recursive' : '-am'));
        &pretty_print_rule ($name . ":", "\t\t", $lname);
     }
     &depend ('.PHONY', $name . '-am', $name);
@@ -3779,7 +3777,8 @@ sub do_check_merge_target

     &depend ('.PHONY', 'check', 'check-am');
     $output_rules .= ("check: "
-                     . ($recursive_install ? 'check-recursive' : 'check-am')
+                     . (&variable_defined ('SUBDIRS')
+                        ? 'check-recursive' : 'check-am')
                      . "\n");
 }

@@ -3816,10 +3815,7 @@ sub handle_clean
                   . ',;');
     }

-    $output_rules .=
-      &file_contents ('clean',
-                     $xform
-                     . &transform_cond ('SUBDIRS' => $recursive_install));
+    $output_rules .= &file_contents ('clean', $xform);

     foreach ('clean', 'distclean', 'mostlyclean', 'maintainer-clean')
       {
@@ -6597,9 +6593,6 @@ sub initialize_per_input
     $included_knr_compile = 0;
     $included_libtool_compile = 0;

-    # TRUE if install targets should work recursively.
-    $recursive_install = 0;
-
     # All .P files.
     %dep_files = ();

@@ -6706,7 +6699,9 @@ sub file_contents

                       'INSTALL-INFO' => !$options{'no-installinfo'},
                       'INSTALL-MAN'  => !$options{'no-installman'},
-                      'CK-NEWS'      => $options{'check-news'});
+                      'CK-NEWS'      => $options{'check-news'},
+
+                      'SUBDIRS' => &variable_defined ('SUBDIRS'));

     # Swallow the file and applied the COMMAND.
     my $file = $am_dir . '/' . $basename . '.am';



reply via email to

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