]> sourceware.org Git - automake.git/commitdiff
* automake.in (handle_source_transform): Handle dist and nodist
authorTom Tromey <tromey@redhat.com>
Fri, 9 Apr 1999 23:05:48 +0000 (23:05 +0000)
committerTom Tromey <tromey@redhat.com>
Fri, 9 Apr 1999 23:05:48 +0000 (23:05 +0000)
prefixes.
(initialize_per_input): Initialize dist_sources.
(check_libobjs_sources): Handle dist and nodist prefixes.
(generate_makefile): Define DIST_SOURCES.
* dist-vars.am (DISTFILES): Reference DIST_SOURCES, not SOURCES.

ChangeLog
NEWS
automake.in
dist-vars.am

index 4e20f6e03ef5a3073f3b15b3336298e2a21bff4c..e2e2e17d38a4528ebaa0c225c390c180cd7e5718 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,12 @@
 1999-04-09  Tom Tromey  <tromey@cygnus.com>
 
+       * automake.in (handle_source_transform): Handle dist and nodist
+       prefixes.
+       (initialize_per_input): Initialize dist_sources.
+       (check_libobjs_sources): Handle dist and nodist prefixes.
+       (generate_makefile): Define DIST_SOURCES.
+       * dist-vars.am (DISTFILES): Reference DIST_SOURCES, not SOURCES.
+
        * automake.texi (Macros): Mention AM_PROG_GCJ.
        (Java Support): New node.
        (Dist): Documented dist_ and nodist_ prefixes.
diff --git a/NEWS b/NEWS
index c17b2fc97e677df4e28ac5770ca7eb5f08f5f59e..2d3b5407d843d6b3af1f919dcb55de28fd375a27 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -2,9 +2,9 @@ New in 1.4a:
 * Many files (but not all) are correctly handled if they appear in subdirs
   For instance, a _DATA file can appear in a subdir
 * GNU tar is no longer required for `make dist'
-* The usual bug fixes
-* Added support for `dist_' and `nodist_' prefixes to some primaries
+* Added support for `dist_' and `nodist_' prefixes
 * Compiled Java support
+* The usual bug fixes
 \f
 New in 1.4:
 * Added support for the Fortran 77 programming language.
index 43a03d68e55d03dda00e9783ff47efd5c4c69b95..9ccf3a621e6174b5494ecffd9411c2d3979b53ee 100755 (executable)
@@ -627,6 +627,7 @@ sub generate_makefile
     # on this (but currently does).
     $contents{'SOURCES'} = join (' ', @sources);
     $contents{'OBJECTS'} = join (' ', @objects);
+    &define_pretty_variable ('DIST_SOURCES', '', @dist_sources);
 
     &handle_multilib;
     &handle_texinfo;
@@ -1023,7 +1024,8 @@ sub check_libobjs_sources
     local ($one_file, $unxformed) = @_;
 
     local ($prefix, $file, @files);
-    foreach $prefix ('', 'EXTRA_')
+    foreach $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
+                    'dist_EXTRA_', 'nodist_EXTRA_')
     {
        if (&variable_defined ($prefix . $one_file . '_SOURCES'))
        {
@@ -1196,16 +1198,29 @@ sub handle_source_transform
        return;
     }
 
-    local (@files, @result, $prefix, $temp);
-    foreach $prefix ('', 'EXTRA_')
+    local (@files, @result, $prefix, $temp, $xpfx);
+    local (%used_pfx) = ();
+    foreach $prefix ('', 'EXTRA_', 'dist_', 'nodist_',
+                    'dist_EXTRA_', 'nodist_EXTRA_')
     {
+       # We are going to define _OBJECTS variables using the prefix.
+       # Then we glom them all together.  So we can't use the null
+       # prefix here as we need it later.
+       $xpfx = ($prefix eq '') ? 'am_' : $prefix;
+
        @files = ();
        local ($var) = $prefix . $one_file . "_SOURCES";
        if (&variable_defined ($var))
        {
+           # Keep track of which prefixes we saw.
+           $used_pfx{$xpfx} = 1
+               unless $prefix =~ /EXTRA_/;
+
            push (@sources, '$(' . $prefix . $one_file . "_SOURCES)");
-           push (@objects, '$(' . $prefix . $one_file . "_OBJECTS)")
-               unless $prefix eq 'EXTRA_';
+           push (@objects, '$(' . $xpfx . $one_file . "_OBJECTS)")
+               unless $prefix =~ /EXTRA_/;
+           push (@dist_sources, '$(' . $prefix . $one_file . "_SOURCES)")
+               unless $prefix =~ /^nodist_/;
            local (@conds) = &variable_conditions ($var);
            if (! @conds)
            {
@@ -1222,26 +1237,34 @@ sub handle_source_transform
                    $linker = $temp if $linker eq '';
 
                    # Define _OBJECTS conditionally.
-                   &define_pretty_variable ($one_file . '_OBJECTS', $cond,
-                                            @result)
-                       unless $prefix eq 'EXTRA_';
+                   &define_pretty_variable ($xpfx . $one_file . '_OBJECTS',
+                                            $cond, @result)
+                       unless $prefix =~ /EXTRA_/;
                }
 
                next;
            }
        }
-       elsif ($prefix eq '')
-       {
-           &define_variable ($one_file . "_SOURCES", $unxformed . ".c");
-           push (@sources, $unxformed . '.c');
-           push (@objects, $unxformed . $obj);
-           push (@files, $unxformed . '.c');
-       }
 
        ($temp, @result) = &handle_single_transform_list ($obj, @files);
        $linker = $temp if $linker eq '';
-       &define_pretty_variable ($one_file . "_OBJECTS", '', @result)
-           unless $prefix eq 'EXTRA_';
+       &define_pretty_variable ($xpfx . $one_file . "_OBJECTS", '', @result)
+           unless $prefix =~ /EXTRA_/;
+    }
+
+    local (@keys) = sort keys %used_pfx;
+    if (scalar @keys == 0)
+    {
+       &define_variable ($one_file . "_SOURCES", $unxformed . ".c");
+       push (@sources, $unxformed . '.c');
+       push (@dist_sources, $unxformed . '.c');
+       push (@objects, $unxformed . $obj);
+       push (@files, $unxformed . '.c');
+    }
+    else
+    {
+       grep ($_ = '$(' . $_ . $one_file . '_OBJECTS)', @keys);
+       &define_pretty_variable ($one_file . '_OBJECTS', '', @keys);
     }
 
     return $linker;
@@ -6529,6 +6552,8 @@ sub initialize_per_input
     # SOURCES and OBJECTS variables.
     @sources = ();
     @objects = ();
+    # Sources which go in the distribution.
+    @dist_sources = ();
 
     # This hash maps object file names onto their corresopnding source
     # file names.  This is used to ensure that each object is created
index 3d40a79ba8ac510f124d69b22c079a1ab1f0b920..ee1c902e380df0e27f7ee6fb99e68d1d6c57abd3 100644 (file)
@@ -19,4 +19,4 @@ PACKAGE = @PACKAGE@
 VERSION = @VERSION@
 
 ## DIST_COMMON comes first so that README can be the very first file.
-DISTFILES = $(DIST_COMMON) $(SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
This page took 0.047468 seconds and 5 git commands to generate.