bug-automake
[Top][All Lists]
Advanced

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

Re: make dist vs. conditional installdirs


From: Alexandre Duret-Lutz
Subject: Re: make dist vs. conditional installdirs
Date: Sat, 10 Jan 2004 01:24:06 +0100
User-agent: Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux)

>>> "Ralf" == Ralf Corsepius <address@hidden> writes:

 Ralf> Another issue with conditional installdirs:
 Ralf> Given this Makefile.am:
 Ralf> if HAVE_FOO
 Ralf> include_HEADERS = foo.h
 Ralf> lib_LIBRARIES = libfoo.a
 Ralf> libfoo_a_SOURCES = foo.c
 Ralf> endif

 Ralf> If condition HAVE_FOO is false, foo.h isn't distributed (isn't put into
 Ralf> the tarball during make dist), but foo.c is.

 Ralf> # tar tzvf autobug-0.0.tar.gz | grep foo
 Ralf> autobug-0.0/foo.c

 Ralf> I thought *_HEADERS were always distributed, similar to *_SOURCES.

Wow, thanks!  I'm surprised nobody ever complained about this.

I'm installing the following on HEAD.

Two primaries are missing from the list below: _TEXINFOS and
_MANS.  Right now it does not work to define them conditionally
(not only for dist, but also for install).

2004-01-10  Alexandre Duret-Lutz  <address@hidden>

        * automake.in (shadow_unconditionally): New function...
        (handle_source_transform): ... extracted from here.
        (am_install_var): Use shadow_unconditionally to define %DISTVAR%.
        * lib/am/data.am, lib/am/java.am, lib/am/lisp.am, lib/am/python.am,
        lib/am/script.am: Add %DISTVAR% to DIST_COMMON.
        * tests/cond33.test: Make sure all conditional files are distributed.
        Report from Ralf Corsepius.

Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.261
diff -u -r1.261 NEWS
--- NEWS        7 Jan 2004 21:56:49 -0000       1.261
+++ NEWS        10 Jan 2004 00:13:38 -0000
@@ -17,6 +17,14 @@
     the two .o and .obj rules for usual objects, or the .lo rule for
     libtool objects.
 
+* Bug fixes.
+
+  - Distribute all files, even those which are built and installed
+    conditionally.  This change affects files listed in conditionally
+    defined *_HEADERS and *_PYTHON variable (unless they are nodist_*)
+    as well as those listed in conditionally defined dist_*_DATA,
+    dist_*_JAVA, dist_*_LISP, and dist_*_SCRIPTS variables.
+
 
 New in 1.8:
 
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1539
diff -u -r1.1539 automake.in
--- automake.in 8 Jan 2004 20:22:23 -0000       1.1539
+++ automake.in 10 Jan 2004 00:13:42 -0000
@@ -982,6 +982,25 @@
   return 0;
 }
 
+# shadow_unconditionally ($varname, $where)
+# -----------------------------------------
+# Return a $(variable) that contains all possible values
+# $varname can take.
+# If the VAR wasn't defined conditionally, return $(VAR).
+# Otherwise we create a am__VAR_DIST variable which contains
+# all possible values, and return $(am__VAR_DIST).
+sub shadow_unconditionally ($$)
+{
+  my ($varname, $where) = @_;
+  my $var = var $varname;
+  if ($var->has_conditional_contents)
+    {
+      $varname = "am__${varname}_DIST";
+      my @files = uniq ($var->value_as_list_recursive);
+      define_pretty_variable ($varname, TRUE, $where, @files);
+    }
+  return "\$($varname)"
+}
 
 # get_object_extension ($OUT)
 # ---------------------------
@@ -1845,21 +1864,8 @@
          unless $prefix =~ /EXTRA_/;
 
        push @sources, "\$($varname)";
-       if (! option 'no-dist' && $prefix !~ /^nodist_/)
-         {
-           # If the VAR wasn't defined conditionally, we add
-           # it to DIST_SOURCES as is.  Otherwise we create a
-           # am__VAR_DIST variable which contains all possible values,
-           # and add this variable to DIST_SOURCES.
-           my $distvar = $varname;
-           if ($var->has_conditional_contents)
-             {
-               $distvar = "am__${varname}_DIST";
-               my @files = uniq ($var->value_as_list_recursive);
-               define_pretty_variable ($distvar, TRUE, $where, @files);
-             }
-           push @dist_sources, "\$($distvar)"
-         }
+       push @dist_sources, shadow_unconditionally ($varname, $where)
+         unless (option ('no-dist') || $prefix =~ /^nodist_/);
 
        $needlinker |=
            define_objects_from_sources ($varname,
@@ -6458,6 +6464,11 @@
       # Use the location of the currently processed variable as context.
       $where->push_context ("while processing `$one_name'");
 
+      # The variable containing all file to distribute.
+      my $distvar = "\$($one_name)";
+      $distvar = shadow_unconditionally ($one_name, $where)
+       if ($dist_p && $one_var->has_conditional_contents);
+
       # Singular form of $PRIMARY.
       (my $one_primary = $primary) =~ s/S$//;
       $output_rules .= &file_contents ($file, $where,
@@ -6470,6 +6481,7 @@
                                       EXEC      => $exec_p,
                                       INSTALL   => $install_p,
                                       DIST      => $dist_p,
+                                      DISTVAR   => $distvar,
                                       'CK-OPTS' => $check_options_p);
     }
 
Index: lib/am/data.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/data.am,v
retrieving revision 1.42
diff -u -r1.42 data.am
--- lib/am/data.am      5 Jan 2004 21:49:13 -0000       1.42
+++ lib/am/data.am      10 Jan 2004 00:13:43 -0000
@@ -83,5 +83,5 @@
 ## -------------- ##
 
 if %?DIST%
-DIST_COMMON += $(%DIR%_%PRIMARY%)
+DIST_COMMON += %DISTVAR%
 endif %?DIST%
Index: lib/am/java.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/java.am,v
retrieving revision 1.20
diff -u -r1.20 java.am
--- lib/am/java.am      10 Nov 2003 20:55:32 -0000      1.20
+++ lib/am/java.am      10 Jan 2004 00:13:43 -0000
@@ -1,5 +1,5 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1998, 1999, 2001, 2003 Free Software Foundation, Inc.
+## Copyright (C) 1998, 1999, 2001, 2003, 2004 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
@@ -84,5 +84,5 @@
 ## -------------- ##
 
 if %?DIST%
-DIST_COMMON += $(%DIR%_JAVA)
+DIST_COMMON += %DISTVAR%
 endif %?DIST%
Index: lib/am/lisp.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/lisp.am,v
retrieving revision 1.40
diff -u -r1.40 lisp.am
--- lib/am/lisp.am      5 Jan 2004 21:49:13 -0000       1.40
+++ lib/am/lisp.am      10 Jan 2004 00:13:43 -0000
@@ -119,5 +119,5 @@
 ## -------------- ##
 
 if %?DIST%
-DIST_COMMON += $(%DIR%_LISP)
+DIST_COMMON += %DISTVAR%
 endif %?DIST%
Index: lib/am/python.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/python.am,v
retrieving revision 1.19
diff -u -r1.19 python.am
--- lib/am/python.am    5 Jan 2004 21:49:13 -0000       1.19
+++ lib/am/python.am    10 Jan 2004 00:13:43 -0000
@@ -90,5 +90,5 @@
 ## -------------- ##
 
 if %?DIST%
-DIST_COMMON += $(%DIR%_PYTHON)
+DIST_COMMON += %DISTVAR%
 endif %?DIST%
Index: lib/am/scripts.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/scripts.am,v
retrieving revision 1.52
diff -u -r1.52 scripts.am
--- lib/am/scripts.am   5 Jan 2004 21:49:13 -0000       1.52
+++ lib/am/scripts.am   10 Jan 2004 00:13:43 -0000
@@ -88,7 +88,7 @@
 ## -------------- ##
 
 if %?DIST%
-DIST_COMMON += $(%DIR%_SCRIPTS)
+DIST_COMMON += %DISTVAR%
 endif %?DIST%
 
 
Index: tests/cond33.test
===================================================================
RCS file: /cvs/automake/automake/tests/cond33.test,v
retrieving revision 1.1
diff -u -r1.1 cond33.test
--- tests/cond33.test   8 Jan 2004 23:32:11 -0000       1.1
+++ tests/cond33.test   10 Jan 2004 00:13:43 -0000
@@ -41,6 +41,9 @@
 
 foo.h x.sh:
        :>$@
+distdircheck: distdir
+       test -f $(distdir)/foo.h
+       test -f $(distdir)/x.sh
 EOF
 
 $ACLOCAL
@@ -67,3 +70,4 @@
 $MAKE installdirs
 test ! -d inc
 test -d bin
+$MAKE distdircheck


-- 
Alexandre Duret-Lutz





reply via email to

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