svn commit: trunk/busybox/scripts

vodz at busybox.net vodz at busybox.net
Thu Oct 6 14:47:19 UTC 2005


Author: vodz
Date: 2005-10-06 07:47:16 -0700 (Thu, 06 Oct 2005)
New Revision: 11789

Log:
bb_mkdep can use src outside now

Modified:
   trunk/busybox/scripts/bb_mkdep.c


Changeset:
Modified: trunk/busybox/scripts/bb_mkdep.c
===================================================================
--- trunk/busybox/scripts/bb_mkdep.c	2005-10-06 12:50:11 UTC (rev 11788)
+++ trunk/busybox/scripts/bb_mkdep.c	2005-10-06 14:47:16 UTC (rev 11789)
@@ -624,6 +624,9 @@
     return first;
 }
 
+static char *pwd;
+static char *replace;
+
 static struct stat st_kp;
 static int dontgenerate_dep;
 
@@ -670,11 +673,23 @@
 	    if(*e == 'c') {
 		/* *.c -> *.o */
 		*e = 'o';
+		if(replace) {
+			/* /src_dir/path/file.o to path/file.o */
+			e = fp + strlen(replace);
+			while(*e == '/')
+				e++;
+			/* path/file.o to pwd/path/file.o */
+			e = fp = bb_asprint("%s/%s", pwd, e);
+		}
+	    } else {
+		e = NULL;
 	    }
 	    first = show_dep(1, Ifound, fp);
 	    first = show_dep(first, key_top, fp);
 	    if(first == 0)
 		putchar('\n');
+	    if(replace && e)
+		free(e);
 	}
 	return NULL;
     } else if(S_ISDIR(st.st_mode)) {
@@ -711,6 +726,10 @@
     size_t dirlen;
 
     dirs = llist_add_to(NULL, bb_simplify_path(p));
+    if(strcmp(dirs->data, pwd))
+	replace = bb_xstrdup(dirs->data);
+    else
+	replace = NULL;
     /* emulate recursive */
     while(dirs) {
 	d_add = NULL;
@@ -736,9 +755,10 @@
 	}
 	dirs = d_add;
     }
+    free(replace);
+    replace = NULL;
 }
 
-static char *pwd;
 
 int main(int argc, char **argv)
 {




More information about the busybox-cvs mailing list