Index: src/main/org/apache/tools/ant/taskdefs/DependSet.java
===================================================================
RCS file: /home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/DependSet.java,v
retrieving revision 1.7
diff -u -r1.7 DependSet.java
--- src/main/org/apache/tools/ant/taskdefs/DependSet.java	22 Nov 2001 08:40:38 -0000	1.7
+++ src/main/org/apache/tools/ant/taskdefs/DependSet.java	19 Feb 2002 14:20:05 -0000
@@ -179,6 +179,8 @@
         // Grab all the target files specified via filesets
         //
         Vector  allTargets         = new Vector();
+        long earliestTargetTime = now+100000000;
+        File earliestTarget = null;
         Enumeration enumTargetSets = targetFileSets.elements();
         while (enumTargetSets.hasMoreElements()) {
                  
@@ -195,6 +197,11 @@
                  log("Warning: "+targetFiles[i]+" modified in the future.", 
                      Project.MSG_WARN);
               }
+              if (dest.lastModified() < earliestTargetTime)
+              {
+                 earliestTargetTime = dest.lastModified();
+                 earliestTarget = dest;
+              }
            }
         }
 
@@ -223,8 +230,14 @@
                  log("Warning: "+targetFiles[i]+" modified in the future.", 
                      Project.MSG_WARN);
               }
+              if (dest.lastModified() < earliestTargetTime)
+              {
+                 earliestTargetTime = dest.lastModified();
+                 earliestTarget = dest;
+              }
            }
         }
+        if (earliestTarget != null) log(earliestTarget.getPath() + " is earliest target", Project.MSG_VERBOSE);
 
         //
         // Check targets vs source files specified via filesets
@@ -245,16 +258,11 @@
                         Project.MSG_WARN);
                  }
 
-                 Enumeration enumTargets = allTargets.elements();
-                 while (upToDate && enumTargets.hasMoreElements()) {
-                 
-                    File dest = (File)enumTargets.nextElement();
-                    if (src.lastModified() > dest.lastModified()) {
-                       log(dest.getPath() + " is out of date with respect to " +
-                                sourceFiles[i], Project.MSG_VERBOSE);
-                       upToDate = false;
-
-                    }
+                 if (src.lastModified() > earliestTargetTime)
+                 {
+                    upToDate = false;
+                    log(sourceFiles[i] + " is more recent than earliest target",
+                       Project.MSG_VERBOSE);
                  }
               }
            }
@@ -285,17 +293,11 @@
                     break;
                  }
 
-                 Enumeration enumTargets = allTargets.elements();
-                 while (upToDate && enumTargets.hasMoreElements()) {
-                 
-                    File dest = (File)enumTargets.nextElement();
-                    
-                    if (src.lastModified() > dest.lastModified()) {
-                       log(dest.getPath() + " is out of date with respect to " +
-                                sourceFiles[i], Project.MSG_VERBOSE);
-                       upToDate = false;
-
-                    }
+                 if (src.lastModified() > earliestTargetTime)
+                 {
+                    upToDate = false;
+                    log(sourceFiles[i] + " is more recent than earliest target",
+                       Project.MSG_VERBOSE);
                  }
               } while (upToDate && (++i < sourceFiles.length) );
            }
