automake-patches
[Top][All Lists]
Advanced

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

[BUGFIX] nodist_noinst_ targets are installed


From: Bonzini
Subject: [BUGFIX] nodist_noinst_ targets are installed
Date: Tue, 20 Nov 2001 20:38:11 +0100

Automake 1.5 fails in handling nodist_noinst_* targets, because it tries
to install them into a noinstdir.

The culprit lies in am_install_var that removes "nobase_" from the %DIR%
($X) and %NDIR% ($nodir_name), but "nodist_" only from the %NDIR%.  Then
it does the tests on noinst, check, EXTRA on the %DIR%, which is
"nodist_noinst" rather than "noinst".  Actually both should be removed
from the %NDIR% and the tests must be done on it as well.

The patch does exactly this.  Also, since $nodir_name was a bad name
(%NDIR% looks more like a "naked dir"), I renamed it to $ndir.

I feel that the incoherency between "nobase_" and the other two causes
two bugs though I only experienced one.  The fact that $X loses
"nobase_" could cause trouble if you do weird things like this

    include_HEADERS=subdir/inmaindir.h
    nobase_include_HEADERS=subdir/insubdir.h

(are they allowed?!?)


Possibly the simplest (yet realistic) Makefile.am that demonstrates
the bug:

    nodist_noinst_HEADERS = config.h



Here is a ChangeLog entry:

2001-11-20  Paolo Bonzini  <address@hidden>

        * automake.in (am_install_var): renamed $nodir_name to $ndir
        ("naked directory" is probably more similar to real meaning).
        Use it instead of $X to find noinst, EXTRA or check targets.



Attached is a context diff from 1.5 (passes test suite).

Paolo

ps: did anybody consider my patch to the manual?!?
*** automake.old        Tue Nov 20 18:58:46 2001
--- automake    Tue Nov 20 19:46:56 2001
***************
*** 7225,7246 ****
        next
          unless (&variable_defined ($one_name));
  
!       my $strip_subdir = 1;
        # If subdir prefix should be preserved, do so.
        if ($X =~ /^nobase_/)
          {
            $strip_subdir = 0;
!           $X =~ s/^nobase_//;
          }
  
-       my $nodir_name = $X;
        # If files should be distributed, do so.
        my $dist_p = 0;
        if ($can_dist)
          {
            $dist_p = (($default_dist && $one_name !~ /^nodist_/)
                       || (! $default_dist && $one_name =~ /^dist_/));
!           $nodir_name =~ s/^(dist|nodist)_//;
          }
  
        # Append actual contents of where_PRIMARY variable to
--- 7225,7247 ----
        next
          unless (&variable_defined ($one_name));
  
!       my $ndir = $X;
! 
        # If subdir prefix should be preserved, do so.
+       my $strip_subdir = 1;
        if ($X =~ /^nobase_/)
          {
            $strip_subdir = 0;
!           $ndir =~ s/^nobase_//;
          }
  
        # If files should be distributed, do so.
        my $dist_p = 0;
        if ($can_dist)
          {
            $dist_p = (($default_dist && $one_name !~ /^nodist_/)
                       || (! $default_dist && $one_name =~ /^dist_/));
!           $ndir =~ s/^(dist|nodist)_//;
          }
  
        # Append actual contents of where_PRIMARY variable to
***************
*** 7250,7256 ****
            # Skip configure substitutions.  Possibly bogus.
            if ($rcurs =~ /address@hidden@$/)
              {
!               if ($X eq 'EXTRA')
                  {
                    if (! $warned_about_extra)
                      {
--- 7251,7257 ----
            # Skip configure substitutions.  Possibly bogus.
            if ($rcurs =~ /address@hidden@$/)
              {
!               if ($ndir eq 'EXTRA')
                  {
                    if (! $warned_about_extra)
                      {
***************
*** 7315,7328 ****
  
        # "EXTRA" shouldn't be used when generating clean targets,
        # all, or install targets.
!       if ($X eq 'EXTRA')
          {
            # We used to warn if EXTRA_FOO was defined uselessly,
            # but this was annoying.
            next;
          }
  
!       if ($X eq 'check')
          {
            push (@check, '$(' . $one_name . ')');
          }
--- 7316,7329 ----
  
        # "EXTRA" shouldn't be used when generating clean targets,
        # all, or install targets.
!       if ($ndir eq 'EXTRA')
          {
            # We used to warn if EXTRA_FOO was defined uselessly,
            # but this was annoying.
            next;
          }
  
!       if ($ndir eq 'check')
          {
            push (@check, '$(' . $one_name . ')');
          }
***************
*** 7332,7343 ****
          }
  
        # Is this to be installed?
!       my $install_p = $X ne 'noinst' && $X ne 'check';
  
        # If so, with install-exec? (or install-data?).
!       my $exec_p = (defined $exec_dir_p {$X}
!                     ? $exec_dir_p {$X}
!                     : ($X =~ /exec/));
  
        # Singular form of $PRIMARY.
        (my $one_primary = $primary) =~ s/S$//;
--- 7333,7344 ----
          }
  
        # Is this to be installed?
!       my $install_p = $ndir ne 'noinst' && $ndir ne 'check';
  
        # If so, with install-exec? (or install-data?).
!       my $exec_p = (defined $exec_dir_p {$ndir}
!                     ? $exec_dir_p {$ndir}
!                     : ($ndir =~ /exec/));
  
        # Singular form of $PRIMARY.
        (my $one_primary = $primary) =~ s/S$//;
***************
*** 7347,7355 ****
                                          'PRIMARY'     => $primary,
                                          'ONE_PRIMARY' => $one_primary,
                                          'DIR'         => $X,
!                                         'NDIR'        => $nodir_name,
                                          'BASE'        => $strip_subdir,
- 
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
                                          'DIST'    => $dist_p));
--- 7348,7355 ----
                                          'PRIMARY'     => $primary,
                                          'ONE_PRIMARY' => $one_primary,
                                          'DIR'         => $X,
!                                         'NDIR'        => $ndir,
                                          'BASE'        => $strip_subdir,
                                          'EXEC'    => $exec_p,
                                          'INSTALL' => $install_p,
                                          'DIST'    => $dist_p));



reply via email to

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