]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[multiple changes]
authorMark Mitchell <mark@codesourcery.com>
Tue, 4 Jun 2002 16:46:07 +0000 (16:46 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Tue, 4 Jun 2002 16:46:07 +0000 (16:46 +0000)
2002-05-18  Mark Mitchell  <mark@codesourcery.com>
* java-tree.h (CLASS_BEING_LAIDOUT): Remove duplicate definition.
* jcf-io.c (dirent.h): Include it.
(fnmatch.h): Likewise.
(compare_path): New function.
(java_or_class_file): Likewise.
(memoized_dirlist_entry): New type.
(memoized_dirlist_lookup_eq): New function.
(memoized_dirlists): New variable.
(caching_stat): New function.
(memoized_class_lookup_eq): New function.
(memoized_class_lookups): Likewise.
(find_class): Use memoized_class_lookups and caching_stat.
* jcf.h (JCF_USE_SCANDIR): Define.
* parse.y (java_expand_classes): Write the class files in reverse
order.

2002-05-13  Mark Mitchell  <mark@codesourcery.com>
* jcf-write.c (write_classfile): Unlink the temporary file if it
cannot be renamed.  Use concat to build up the name of the
temporary file.

2002-05-13  Mark Mitchell  <mark@codesourcery.com>
* jcf-write.c (write_classfile): Unlink the temporary file if it
cannot be renamed.  Use concat to build up the name of the
temporary file.

2002-05-23  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
* Makefile.am (all-recursive): Depend on $all_java_class_files so that
they build first.
* Makefile.in: Rebuilt.

2002-05-08  Mark Mitchell  <mark@codesourcery.com>
* Makefile.am (all_java_source_files): New variable.
(all_java_class_files): Likewise.
.java.class: New rule.
(CLEANFILES): Remove tmp-list.
* Makefile.in: Regenerated.

From-SVN: r54249

gcc/java/ChangeLog
gcc/java/java-tree.h
gcc/java/jcf-io.c
gcc/java/jcf-write.c
gcc/java/jcf.h
gcc/java/parse.y
libjava/ChangeLog
libjava/Makefile.am
libjava/Makefile.in

index 5e4cfb7d5763464205044dbe504f8ae8aaccaaa3..5553139643d31601cc9cc42d9e5386ac4e78929b 100644 (file)
@@ -1,3 +1,32 @@
+2002-06-03  Mark Mitchell  <mark@codesourcery.com>
+
+       2002-05-18  Mark Mitchell  <mark@codesourcery.com>
+       * java-tree.h (CLASS_BEING_LAIDOUT): Remove duplicate definition.
+       * jcf-io.c (dirent.h): Include it.
+       (fnmatch.h): Likewise.
+       (compare_path): New function.
+       (java_or_class_file): Likewise.
+       (memoized_dirlist_entry): New type.
+       (memoized_dirlist_lookup_eq): New function.
+       (memoized_dirlists): New variable.
+       (caching_stat): New function.
+       (memoized_class_lookup_eq): New function.
+       (memoized_class_lookups): Likewise.
+       (find_class): Use memoized_class_lookups and caching_stat.
+       * jcf.h (JCF_USE_SCANDIR): Define.
+       * parse.y (java_expand_classes): Write the class files in reverse
+       order.
+
+       2002-05-13  Mark Mitchell  <mark@codesourcery.com>
+       * jcf-write.c (write_classfile): Unlink the temporary file if it
+       cannot be renamed.  Use concat to build up the name of the
+       temporary file.
+
+       2002-05-13  Mark Mitchell  <mark@codesourcery.com>
+       * jcf-write.c (write_classfile): Unlink the temporary file if it
+       cannot be renamed.  Use concat to build up the name of the
+       temporary file.
+
 2002-05-14  Release Manager
 
        * GCC 3.1 Released.
index f53ae84b3272d8c169075e3689d68b94a1cdcfe6..65949c4dd25d58fa3ae7a738a2e41fd9989421fc 100644 (file)
@@ -1424,11 +1424,6 @@ extern tree *type_map;
    layout of a class.  */
 #define CLASS_BEING_LAIDOUT(TYPE) TYPE_LANG_FLAG_6 (TYPE)
 
-/* True if class TYPE is currently being laid out. Helps in detection
-   of inheritance cycle occurring as a side effect of performing the
-   layout of a class.  */
-#define CLASS_BEING_LAIDOUT(TYPE) TYPE_LANG_FLAG_6 (TYPE)
-
 /* True if class TYPE has a field initializer finit$ function */
 #define CLASS_HAS_FINIT_P(TYPE) TYPE_FINIT_STMT_LIST (TYPE)
 
index 21197700fbf3df3c8862d60a29f867cf9f9e222a..b228bf576c5e8afbe6a6d62f4375dd776373ca2b 100644 (file)
@@ -1,5 +1,5 @@
 /* Utility routines for finding and reading Java(TM) .class files.
-   Copyright (C) 1996, 1997, 1998, 1999, 2000  Free Software Foundation, Inc.
+   Copyright (C) 1996, 1997, 1998, 1999, 2000, 2002  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
@@ -29,6 +29,11 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #include "tree.h"
 #include "toplev.h"
 #include "java-tree.h"
+#include "hashtab.h"
+#if JCF_USE_SCANDIR
+#include <dirent.h>
+#include <fnmatch.h>
+#endif
 
 #include "zlib.h"
 
@@ -304,10 +309,152 @@ DEFUN(find_classfile, (filename, jcf, dep_name),
 #endif
 }
 
+#if JCF_USE_SCANDIR
+
+/* A comparison function (as for qsort) that compares KEY (a char *
+   giving the basename of a file) with the name stored in ENTRY (a
+   dirent **).  */
+
+static int
+DEFUN(compare_path, (key, entry),
+      const void *key AND const void *entry)
+{
+  return strcmp ((const char *) key, 
+                (*((const struct dirent **) entry))->d_name);
+}
+
+/* Returns nonzero if ENTRY names a .java or .class file.  */
+
+static int
+DEFUN(java_or_class_file, (entry),
+      const struct dirent *entry)
+{
+  const char *base = basename (entry->d_name);
+  return (fnmatch ("*.java", base, 0) == 0 || 
+         fnmatch ("*.class", base, 0) == 0);
+}
+
+/* Information about the files present in a particular directory.  */
+typedef struct memoized_dirlist_entry 
+{
+  /* The name of the directory.  */
+  const char *dir;
+  /* The number of .java and .class files present, or -1 if we could
+     not, for some reason, obtain the list.  */
+  int num_files;
+  /* The .java and .class files in the directory, in alphabetical
+     order.  */
+  struct dirent **files;
+} memoized_dirlist_entry;
+
+/* Returns true if ENTRY (a memoized_dirlist_entry *) correponds to
+   the directory given by KEY (a char *) giving the directory 
+   name.  */
+
+static int
+DEFUN(memoized_dirlist_lookup_eq, (entry, key),
+      const void *entry AND const void *key)
+{
+  return strcmp ((const char *) key,
+                ((const memoized_dirlist_entry *) entry)->dir) == 0;
+}
+
+/* A hash table mapping directory names to the lists of .java and
+   .class files in that directory.  */
+
+static htab_t memoized_dirlists;
+
+#endif
+
+/* Like stat, but avoids actually making the stat system call if we
+   know that it cannot succeed.  FILENAME and BUF are as for stat.  */
+
+static int
+DEFUN(caching_stat, (filename, buf),
+      char *filename AND struct stat *buf)
+{
+#if JCF_USE_SCANDIR
+  char *sep;
+  char *base;
+  memoized_dirlist_entry *dent;
+  void **slot;
+  
+  /* If the hashtable has not already been created, create it now.  */
+  if (!memoized_dirlists)
+    memoized_dirlists = htab_create (37,
+                                    htab_hash_string,
+                                    memoized_dirlist_lookup_eq,
+                                    NULL);
+
+  /* Get the name of the directory.  */
+  sep = strrchr (filename, DIR_SEPARATOR);
+  if (sep)
+    {
+      *sep = '\0';
+      base = sep + 1;
+    }
+  else
+    base = filename;
+
+  /* Obtain the entry for this directory form the hash table.  */
+  slot = htab_find_slot (memoized_dirlists, filename, INSERT);
+  if (!*slot)
+    {
+      /* We have not already scanned this directory; scan it now.  */
+      dent = ((memoized_dirlist_entry *) 
+             ALLOC (sizeof (memoized_dirlist_entry)));
+      dent->dir = xstrdup (filename);
+      /* Unfortunately, scandir is not fully standardized.  In
+        particular, the type of the function pointer passed as the
+        third argument sometimes takes a "const struct dirent *"
+        parameter, and sometimes just a "struct dirent *".  We rely
+        on the ability to interchange these two types of function
+        pointers.  */
+      dent->num_files = scandir (filename, &dent->files, 
+                                java_or_class_file, 
+                                alphasort);
+      *slot = dent;
+    }
+  else
+    dent = *((memoized_dirlist_entry **) slot);
+
+  /* Put the spearator back.  */
+  if (sep)
+    *sep = DIR_SEPARATOR;
+
+  /* If the file is not in the list, there is no need to stat it; it
+     does not exist.  */
+  if (dent->num_files != -1
+      && !bsearch (base, dent->files, dent->num_files,
+                  sizeof (struct dirent *), compare_path))
+    return -1;
+#endif
+  
+  return stat (filename, buf);
+}
+
+/* Returns 1 if the CLASSNAME (really a char *) matches the name
+   stored in TABLE_ENTRY (also a char *).  */
+
+static int
+DEFUN(memoized_class_lookup_eq, (table_entry, classname),
+      const void *table_entry AND const void *classname)
+{
+  return strcmp ((const char *)classname, (const char *)table_entry) == 0;
+}
+
+/* A hash table keeping track of class names that were not found
+   during class lookup.  (There is no need to cache the values
+   associated with names that were found; they are saved in
+   IDENTIFIER_CLASS_VALUE.)  */
+static htab_t memoized_class_lookups;
+
 /* Returns a freshly malloc'd string with the fully qualified pathname
-   of the .class file for the class CLASSNAME.  Returns NULL on
-   failure.  If JCF != NULL, it is suitably initialized.
-   SOURCE_OK is true if we should also look for .java file. */
+   of the .class file for the class CLASSNAME.  CLASSNAME must be
+   allocated in permanent storage; this function may retain a pointer
+   to it.  Returns NULL on failure.  If JCF != NULL, it is suitably
+   initialized.  SOURCE_OK is true if we should also look for .java
+   file. */
 
 const char *
 DEFUN(find_class, (classname, classname_length, jcf, source_ok),
@@ -324,11 +471,27 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
   char *dep_file;
   void *entry;
   char *java_buffer;
+  int buflen;
+  char *buffer;
+  hashval_t hash;
+
+  /* Create the hash table, if it does not already exist.  */
+  if (!memoized_class_lookups)
+    memoized_class_lookups = htab_create (37, 
+                                         htab_hash_string, 
+                                         memoized_class_lookup_eq,
+                                         NULL);
+
+  /* Loop for this class in the hashtable.  If it is present, we've
+     already looked for this class and failed to find it.  */
+  hash = htab_hash_string (classname);
+  if (htab_find_with_hash (memoized_class_lookups, classname, hash))
+    return NULL;
 
   /* Allocate and zero out the buffer, since we don't explicitly put a
      null pointer when we're copying it below.  */
-  int buflen = jcf_path_max_len () + classname_length + 10;
-  char *buffer = (char *) ALLOC (buflen);
+  buflen = jcf_path_max_len () + classname_length + 10;
+  buffer = (char *) ALLOC (buflen);
   memset (buffer, 0, buflen);
 
   java_buffer = (char *) alloca (buflen);
@@ -381,7 +544,7 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
              else
                continue;
            }
-         class = stat (buffer, &class_buf);
+         class = caching_stat(buffer, &class_buf);
        }
 
       if (source_ok)
@@ -393,7 +556,7 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
          for (m = 0; m < classname_length; ++m)
            java_buffer[m + l] = (classname[m] == '.' ? '/' : classname[m]);
          strcpy (java_buffer + m + l, ".java");
-         java = stat (java_buffer, &java_buf);
+         java = caching_stat (java_buffer, &java_buf);
          if (java == 0)
            break;
        }
@@ -464,6 +627,12 @@ DEFUN(find_class, (classname, classname_length, jcf, source_ok),
 #endif
 
   free (buffer);
+
+  /* Remember that this class could not be found so that we do not
+     have to look again.  */
+  *htab_find_slot_with_hash (memoized_class_lookups, classname, hash, INSERT) 
+    = (void *) classname;
+
   return NULL;
  found:
 #if JCF_USE_STDIO
index 2988c4726b890dbc4cf5fd6210705e2c73f63b87..491b561ed050c1b6370587c3e5acffd10634e0e5 100644 (file)
@@ -3374,16 +3374,29 @@ write_classfile (clas)
 
   if (class_file_name != NULL)
     {
-      FILE *stream = fopen (class_file_name, "wb");
+      FILE *stream;
+      char *temporary_file_name;
+
+      /* The .class file is initially written to a ".tmp" file so that
+        if multiple instances of the compiler are running at once
+        they do not see partially formed class files. */
+      temporary_file_name = concat (class_file_name, ".tmp", NULL);
+      stream = fopen (temporary_file_name, "wb");
       if (stream == NULL)
-       fatal_io_error ("can't open %s for writing", class_file_name);
+       fatal_io_error ("can't open %s for writing", temporary_file_name);
 
       jcf_dependency_add_target (class_file_name);
       init_jcf_state (state, work);
       chunks = generate_classfile (clas, state);
       write_chunks (stream, chunks);
       if (fclose (stream))
-       fatal_io_error ("error closing %s", class_file_name);
+       fatal_io_error ("error closing %s", temporary_file_name);
+      if (rename (temporary_file_name, class_file_name) == -1)
+       {
+         remove (temporary_file_name);
+         fatal_io_error ("can't create %s", class_file_name);
+       }
+      free (temporary_file_name);
       free (class_file_name);
     }
   release_jcf_state (state);
index c683e2b7de9a4e95eec5afc39a2955d702fcd9e5..e674bdb702218137c2be7b921f623e234ba98390 100644 (file)
@@ -63,6 +63,14 @@ The Free Software Foundation is independent of Sun Microsystems, Inc.  */
 #define JCF_word JCF_u4
 #endif
 
+/* If we have both "scandir" and "alphasort", we can cache directory
+   listings to reduce the time taken to search the classpath.  */
+#if defined(HAVE_SCANDIR) && defined(HAVE_ALPHASORT)
+#define JCF_USE_SCANDIR 1
+#else
+#define JCF_USE_SCANDIR 0
+#endif 
+
 struct JCF;
 typedef int (*jcf_filbuf_t) PARAMS ((struct JCF*, int needed));
 
index 2f9b1a24aa0a4ae1a1f335c576e17c75ad0f8ee2..fd3f967557ed32cba32a6e23b64da6854c231af1 100644 (file)
@@ -9046,10 +9046,30 @@ java_expand_classes ()
   for (cur_ctxp = ctxp_for_generation; cur_ctxp; cur_ctxp = cur_ctxp->next)
     {
       tree current;
+      tree reversed_class_list = NULL;
+
       ctxp = cur_ctxp;
-      for (current = ctxp->class_list; current; current = TREE_CHAIN (current))
+
+      /* We write out the classes in reverse order.  This ensures that
+        inner classes are written before their containing classes,
+        which is important for parallel builds.  Otherwise, the
+        class file for the outer class may be found, but the class
+        file for the inner class may not be present.  In that
+        situation, the compiler cannot fall back to the original
+        source, having already read the outer class, so we must
+        prevent that situation.  */
+      for (current = ctxp->class_list; 
+          current; 
+          current = TREE_CHAIN (current))
+       reversed_class_list
+         = tree_cons (NULL_TREE, current, reversed_class_list);
+      ggc_add_tree_root (&reversed_class_list, 1);
+
+      for (current = reversed_class_list; 
+          current; 
+          current = TREE_CHAIN (current))
        {
-         current_class = TREE_TYPE (current);
+         current_class = TREE_TYPE (TREE_VALUE (current));
          outgoing_cpool = TYPE_CPOOL (current_class);
          if (flag_emit_class_files)
            write_classfile (current_class);
@@ -9061,6 +9081,8 @@ java_expand_classes ()
              finish_class ();
            }
        }
+
+      ggc_del_root (&reversed_class_list);
     }
 }
 
index c05018890c35866da06416d79c9a8df5a597d913..26840d3bb6a6f3a12622cb6f3cb245b48411c9ec 100644 (file)
@@ -1,3 +1,17 @@
+2002-06-03  Mark Mitchell  <mark@codesourcery.com>
+       
+       2002-05-23  Bryce McKinlay  <bryce@waitaki.otago.ac.nz>
+       * Makefile.am (all-recursive): Depend on $all_java_class_files so that
+       they build first.
+       * Makefile.in: Rebuilt.
+
+       2002-05-08  Mark Mitchell  <mark@codesourcery.com>
+       * Makefile.am (all_java_source_files): New variable.
+       (all_java_class_files): Likewise.
+       .java.class: New rule.
+       (CLEANFILES): Remove tmp-list.
+       * Makefile.in: Regenerated.
+       
 2002-05-14  Release Manager
 
        * GCC 3.1 Released.
index 52e9a82d850359c53125c8e210ae036894a0febe..a7818dc4489bc0de9176191f3a57ef2e30c8c4c1 100644 (file)
@@ -163,45 +163,26 @@ install-exec-hook:
          $(LN_S) libgcjx.la gnu-awt-xlib.la; \
        fi
 
-## Make the .class files depend on the .zip file.  This seems
-## backwards, but is right.  This doesn't catch all the .class files,
-## but that is ok, because the ones it fails to pick up are defined in
-## a .java file with some other class which is caught.  Note that we
-## only want to create headers for those files which do not have
-## hand-maintained headers.
-$(built_java_source_files:.java=.class): libgcj-@gcc_version@.jar
-$(java_source_files:.java=.class): libgcj-@gcc_version@.jar
-
-## The .class files for X will not be included in libgcj.jar, but the
-## rule for libgcj.jar will cause all out-of-date .class files to be
-## built. We need this to generate headers for the nat-files.
-$(x_java_source_files:.java=.class): libgcj-@gcc_version@.jar
-
-## We have the zip file depend on the java sources and not the class
-## files, because we don't know the names of all the class files.
-## FIXME: this method fails in a peculiar case: if libgcj.jar is
-## up-to-date, and foo.class is removed, and bar.java is touched, then
-## `make libgcj.jar' will not rebuilt foo.class.  That's because
-## libgcj.jar is not out-of-date with respect to foo.java.
-libgcj-@gcc_version@.jar: $(built_java_source_files) $(java_source_files) $(x_java_source_files)
-## Create a list of all Java sources, without exceeding any shell limits.
-       @: $(shell echo Creating list of files to compile...) $(shell rm -f tmp-list || :) $(shell touch tmp-list) $(foreach source,$?,$(shell echo $(source) >> tmp-list))
-       @set fnord $(MAKEFLAGS); amf=$$2; fail=no; \
-       javac="$(JAVAC)"; \
-       cat tmp-list | (while read f; do \
-         echo $$javac $(JCFLAGS) -classpath \'\' -bootclasspath $(here):$(srcdir) -d $(here) $$f; \
-         $$javac $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) -d $(here) $$f \
-           || case "$$amf" in *=*) exit 1;; *k*) fail=yes ;; *) exit 1;; esac; \
-       done; \
-       test "$$fail" = no)
-       -@rm -f tmp-list libgcj-@gcc_version@.jar
+all_java_source_files = \
+    $(java_source_files) \
+    $(built_java_source_files) \
+    $(x_java_source_files)
+
+all_java_class_files = $(all_java_source_files:.java=.class)
+
+.java.class:
+       $(JAVAC) $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) \
+             -d $(here) $<
+
+libgcj-@gcc_version@.jar: $(all_java_class_files)
+       -@rm -f libgcj-@gcc_version@.jar
 ## Note that we explicitly want to include directory information.
        find java gnu javax org -type d -o -type f -name '*.class' | \
          sed -e '/\/\./d' -e '/\/xlib/d' | \
          $(ZIP) cfM0E@ $@
 
 MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files) $(x_javao_files) $(x_nat_files) $(x_nat_headers)
-CLEANFILES = tmp-list libgcj-@gcc_version@.jar
+CLEANFILES = libgcj-@gcc_version@.jar
 
 clean-local:
 ## We just remove every .class file that was created.
@@ -1910,7 +1891,9 @@ texinfo: TexinfoDoclet.class
 ## internally by libgcj. We can't make the .o files depend on nat_headers, 
 ## because in that case we'll force a complete rebuild of
 ## the C++ code whenever any .java file is touched.
-all-recursive: $(nat_headers) $(x_nat_headers)
+## Also force all the class files to build first. This makes them build in
+## the right order to improve performance.
+all-recursive: $(all_java_class_files) $(nat_headers) $(x_nat_headers)
 
 ## ################################################################
 
index 07a23714c0fa5b65b2aac6c3179ecc9ce3cc9c26..585887a65076ed26bb7419c64a63f1f754da14ac 100644 (file)
@@ -1,6 +1,6 @@
-# Makefile.in generated automatically by automake 1.4 from Makefile.am
+# Makefile.in generated automatically by automake 1.4-p5 from Makefile.am
 
-# Copyright (C) 1994, 1995-8, 1999 Free Software Foundation, Inc.
+# Copyright (C) 1994, 1995-8, 1999, 2001 Free Software Foundation, Inc.
 # This Makefile.in is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
@@ -227,8 +227,16 @@ libgcjx_la_LDFLAGS = @X_PRE_LIBS@ @X_LIBS@ -lX11 @X_EXTRA_LIBS@ \
 
 libgcjx_la_LINK = $(LIBLINK)
 
+all_java_source_files = \
+    $(java_source_files) \
+    $(built_java_source_files) \
+    $(x_java_source_files)
+
+
+all_java_class_files = $(all_java_source_files:.java=.class)
+
 MOSTLYCLEANFILES = $(javao_files) $(nat_files) $(nat_headers) $(c_files) $(x_javao_files) $(x_nat_files) $(x_nat_headers)
-CLEANFILES = tmp-list libgcj-@gcc_version@.jar
+CLEANFILES = libgcj-@gcc_version@.jar
 
 SUFFIXES = .class .java .h
 
@@ -1724,9 +1732,8 @@ LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(LDFLAGS) -o $@
 DATA =  $(jar_DATA) $(toolexeclib_DATA)
 
 DIST_COMMON =  README COPYING ChangeLog Makefile.am Makefile.in NEWS \
-THANKS acconfig.h acinclude.m4 aclocal.m4 configure configure.in \
-gcj/libgcj-config.h.in gcj/stamp-h2.in include/config.h.in \
-include/stamp-h1.in libgcj-test.spec.in libgcj.spec.in
+THANKS acinclude.m4 aclocal.m4 configure configure.in \
+libgcj-test.spec.in libgcj.spec.in
 
 
 DISTFILES = $(DIST_COMMON) $(SOURCES) $(HEADERS) $(TEXINFOS) $(EXTRA_DIST)
@@ -2712,53 +2719,6 @@ config.status: $(srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
        $(SHELL) ./config.status --recheck
 $(srcdir)/configure: @MAINTAINER_MODE_TRUE@$(srcdir)/configure.in $(ACLOCAL_M4) $(CONFIGURE_DEPENDENCIES)
        cd $(srcdir) && $(AUTOCONF)
-
-include/config.h: include/stamp-h1
-       @if test ! -f $@; then \
-               rm -f include/stamp-h1; \
-               $(MAKE) include/stamp-h1; \
-       else :; fi
-include/stamp-h1: $(srcdir)/include/config.h.in $(top_builddir)/config.status
-       cd $(top_builddir) \
-         && CONFIG_FILES= CONFIG_HEADERS=include/config.h \
-            $(SHELL) ./config.status
-       @echo timestamp > include/stamp-h1 2> /dev/null
-$(srcdir)/include/config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/include/stamp-h1.in
-       @if test ! -f $@; then \
-               rm -f $(srcdir)/include/stamp-h1.in; \
-               $(MAKE) $(srcdir)/include/stamp-h1.in; \
-       else :; fi
-$(srcdir)/include/stamp-h1.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
-       cd $(top_srcdir) && $(AUTOHEADER)
-       @echo timestamp > $(srcdir)/include/stamp-h1.in 2> /dev/null
-
-gcj/libgcj-config.h: gcj/stamp-h2
-       @if test ! -f $@; then \
-               rm -f gcj/stamp-h2; \
-               $(MAKE) gcj/stamp-h2; \
-       else :; fi
-gcj/stamp-h2: $(srcdir)/gcj/libgcj-config.h.in $(top_builddir)/config.status
-       cd $(top_builddir) \
-         && CONFIG_FILES= CONFIG_HEADERS=gcj/libgcj-config.h \
-            $(SHELL) ./config.status
-       @echo timestamp > gcj/stamp-h2 2> /dev/null
-$(srcdir)/gcj/libgcj-config.h.in: @MAINTAINER_MODE_TRUE@$(srcdir)/gcj/stamp-h2.in
-       @if test ! -f $@; then \
-               rm -f $(srcdir)/gcj/stamp-h2.in; \
-               $(MAKE) $(srcdir)/gcj/stamp-h2.in; \
-       else :; fi
-$(srcdir)/gcj/stamp-h2.in: $(top_srcdir)/configure.in $(ACLOCAL_M4) acconfig.h
-       cd $(top_srcdir) && $(AUTOHEADER)
-       @echo timestamp > $(srcdir)/gcj/stamp-h2.in 2> /dev/null
-
-mostlyclean-hdr:
-
-clean-hdr:
-
-distclean-hdr:
-       -rm -f include/config.h gcj/libgcj-config.h
-
-maintainer-clean-hdr:
 libgcj.spec: $(top_builddir)/config.status libgcj.spec.in
        cd $(top_builddir) && CONFIG_FILES=$@ CONFIG_HEADERS= $(SHELL) ./config.status
 libgcj-test.spec: $(top_builddir)/config.status libgcj-test.spec.in
@@ -2980,7 +2940,7 @@ maintainer-clean-recursive:
        dot_seen=no; \
        rev=''; list='$(SUBDIRS)'; for subdir in $$list; do \
          rev="$$subdir $$rev"; \
-         test "$$subdir" = "." && dot_seen=yes; \
+         test "$$subdir" != "." || dot_seen=yes; \
        done; \
        test "$$dot_seen" = "no" && rev=". $$rev"; \
        target=`echo $@ | sed s/-recursive//`; \
@@ -3193,32 +3153,29 @@ distclean-generic:
        -rm -f config.cache config.log stamp-h stamp-h[0-9]*
 
 maintainer-clean-generic:
-mostlyclean-am:  mostlyclean-hdr mostlyclean-toolexeclibLTLIBRARIES \
-               mostlyclean-compile mostlyclean-libtool \
-               mostlyclean-binPROGRAMS mostlyclean-noinstPROGRAMS \
-               mostlyclean-tags mostlyclean-depend mostlyclean-generic
+mostlyclean-am:  mostlyclean-toolexeclibLTLIBRARIES mostlyclean-compile \
+               mostlyclean-libtool mostlyclean-binPROGRAMS \
+               mostlyclean-noinstPROGRAMS mostlyclean-tags \
+               mostlyclean-depend mostlyclean-generic
 
 mostlyclean: mostlyclean-recursive
 
-clean-am:  clean-hdr clean-toolexeclibLTLIBRARIES clean-compile \
-               clean-libtool clean-binPROGRAMS clean-noinstPROGRAMS \
-               clean-tags clean-depend clean-generic mostlyclean-am \
-               clean-local
+clean-am:  clean-toolexeclibLTLIBRARIES clean-compile clean-libtool \
+               clean-binPROGRAMS clean-noinstPROGRAMS clean-tags \
+               clean-depend clean-generic mostlyclean-am clean-local
 
 clean: clean-recursive
 
-distclean-am:  distclean-hdr distclean-toolexeclibLTLIBRARIES \
-               distclean-compile distclean-libtool \
-               distclean-binPROGRAMS distclean-noinstPROGRAMS \
-               distclean-tags distclean-depend distclean-generic \
-               clean-am
+distclean-am:  distclean-toolexeclibLTLIBRARIES distclean-compile \
+               distclean-libtool distclean-binPROGRAMS \
+               distclean-noinstPROGRAMS distclean-tags \
+               distclean-depend distclean-generic clean-am
        -rm -f libtool
 
 distclean: distclean-recursive
        -rm -f config.status
 
-maintainer-clean-am:  maintainer-clean-hdr \
-               maintainer-clean-toolexeclibLTLIBRARIES \
+maintainer-clean-am:  maintainer-clean-toolexeclibLTLIBRARIES \
                maintainer-clean-compile maintainer-clean-libtool \
                maintainer-clean-binPROGRAMS \
                maintainer-clean-noinstPROGRAMS maintainer-clean-tags \
@@ -3230,9 +3187,9 @@ maintainer-clean-am:  maintainer-clean-hdr \
 maintainer-clean: maintainer-clean-recursive
        -rm -f config.status
 
-.PHONY: mostlyclean-hdr distclean-hdr clean-hdr maintainer-clean-hdr \
-mostlyclean-toolexeclibLTLIBRARIES distclean-toolexeclibLTLIBRARIES \
-clean-toolexeclibLTLIBRARIES maintainer-clean-toolexeclibLTLIBRARIES \
+.PHONY: mostlyclean-toolexeclibLTLIBRARIES \
+distclean-toolexeclibLTLIBRARIES clean-toolexeclibLTLIBRARIES \
+maintainer-clean-toolexeclibLTLIBRARIES \
 uninstall-toolexeclibLTLIBRARIES install-toolexeclibLTLIBRARIES \
 mostlyclean-compile distclean-compile clean-compile \
 maintainer-clean-compile mostlyclean-libtool distclean-libtool \
@@ -3265,22 +3222,12 @@ install-exec-hook:
          $(LN_S) libgcjx.la gnu-awt-xlib.la; \
        fi
 
-$(built_java_source_files:.java=.class): libgcj-@gcc_version@.jar
-$(java_source_files:.java=.class): libgcj-@gcc_version@.jar
+.java.class:
+       $(JAVAC) $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) \
+             -d $(here) $<
 
-$(x_java_source_files:.java=.class): libgcj-@gcc_version@.jar
-
-libgcj-@gcc_version@.jar: $(built_java_source_files) $(java_source_files) $(x_java_source_files)
-       @: $(shell echo Creating list of files to compile...) $(shell rm -f tmp-list || :) $(shell touch tmp-list) $(foreach source,$?,$(shell echo $(source) >> tmp-list))
-       @set fnord $(MAKEFLAGS); amf=$$2; fail=no; \
-       javac="$(JAVAC)"; \
-       cat tmp-list | (while read f; do \
-         echo $$javac $(JCFLAGS) -classpath \'\' -bootclasspath $(here):$(srcdir) -d $(here) $$f; \
-         $$javac $(JCFLAGS) -classpath '' -bootclasspath $(here):$(srcdir) -d $(here) $$f \
-           || case "$$amf" in *=*) exit 1;; *k*) fail=yes ;; *) exit 1;; esac; \
-       done; \
-       test "$$fail" = no)
-       -@rm -f tmp-list libgcj-@gcc_version@.jar
+libgcj-@gcc_version@.jar: $(all_java_class_files)
+       -@rm -f libgcj-@gcc_version@.jar
        find java gnu javax org -type d -o -type f -name '*.class' | \
          sed -e '/\/\./d' -e '/\/xlib/d' | \
          $(ZIP) cfM0E@ $@
@@ -3516,7 +3463,7 @@ texinfo: TexinfoDoclet.class
 
 -include deps.mk
 
-all-recursive: $(nat_headers) $(x_nat_headers)
+all-recursive: $(all_java_class_files) $(nat_headers) $(x_nat_headers)
 
 # Multilib support.
 .PHONY: all-multi mostlyclean-multi clean-multi distclean-multi \