diff -urN makedepend-1.0.2/parse.c makedepend-1.0.2-new/parse.c
--- makedepend-1.0.2/parse.c	2009-10-11 06:02:44.000000000 +0200
+++ makedepend-1.0.2-new/parse.c	2010-02-01 18:05:54.000000000 +0100
@@ -257,13 +257,26 @@
 	return(ret);
 }
 
+/******************************************************************************/
+static void CleanFlag(struct inclist *file)
+{
+	if(file->i_flags & DEFCHECKED) {
+		struct inclist	**ip = file->i_list ;
+		int				i ;
+
+		file->i_flags &= ~DEFCHECKED ;
+		for(i = 0 ; i < file->i_listlen ; i++) {
+			CleanFlag(ip[i]) ;
+		}
+	}
+}
+
 struct symtab **
 fdefined(char *symbol, struct inclist *file, struct inclist **srcfile)
 {
 	struct inclist	**ip;
 	struct symtab	**val;
 	int	i;
-	static int	recurse_lvl = 0;
 
 	if (file->i_flags & DEFCHECKED)
 		return(NULL);
@@ -282,8 +295,6 @@
 			}
 	}
 	else if (val != NULL && srcfile != NULL) *srcfile = file;
-	recurse_lvl--;
-	file->i_flags &= ~DEFCHECKED;
 
 	return(val);
 }
@@ -298,6 +309,7 @@
 		if (srcfile != NULL) *srcfile = &maininclist;
 		return(val);
 	}
+	CleanFlag(file) ;
 	if ((val = fdefined(symbol, file, srcfile)))
 		return(val);
 	debug(1,("%s not defined in %s\n", symbol, file->i_file));