[BusyBox-cvs] busybox/scripts mkdep.c,1.1,1.2

Erik Andersen andersen at busybox.net
Sat May 24 07:31:02 UTC 2003


Update of /var/cvs/busybox/scripts
In directory winder:/tmp/cvs-serv21312

Modified Files:
	mkdep.c 
Log Message:
Update mkdep, per the "touchless dependencies for 2.4.x" patch
from Geert Uytterhoeven posted to the lkml.
 -Erik


Index: mkdep.c
===================================================================
RCS file: /var/cvs/busybox/scripts/mkdep.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mkdep.c	24 Oct 2001 05:00:08 -0000	1.1
+++ mkdep.c	24 May 2003 07:30:58 -0000	1.2
@@ -45,8 +45,7 @@
 
 
 
-char __depname[512] = "\n\t at touch ";
-#define depname (__depname+9)
+char depname[512];
 int hasdep;
 
 struct path_struct {
@@ -75,9 +74,14 @@
 {
 	if (!hasdep) {
 		hasdep = 1;
-		printf("%s:", depname);
-		if (g_filename)
+		if (g_filename) {
+			/* Source file (*.[cS]) */
+			printf("%s:", depname);
 			printf(" %s", g_filename);
+		} else {
+			/* header file (*.h) */
+			printf("dep_%s +=", depname);
+		}
 	}
 }
 
@@ -203,7 +207,7 @@
 		path->buffer[path->len+len] = '\0';
 		if (access(path->buffer, F_OK) == 0) {
 			do_depname();
-			printf(" \\\n   %s", path->buffer);
+			printf(" \\\n %s $(dep_%s)", path->buffer, path->buffer);
 			return;
 		}
 	}
@@ -268,7 +272,7 @@
 
 	for (i = 0; i < len; i++) {
 	    char c = name[i];
-	    if (isupper(c)) c = tolower(c);
+	    if (isupper((int)c)) c = tolower((int)c);
 	    if (c == '_')   c = '/';
 	    pc[i] = c;
 	}
@@ -496,7 +500,7 @@
 
 /* \<CONFIG_(\w*) */
 cee:
-	if (next >= map+2 && (isalnum(next[-2]) || next[-2] == '_'))
+	if (next >= map+2 && (isalnum((int)next[-2]) || next[-2] == '_'))
 		goto start;
 	GETNEXT NOTCASE('O', __start);
 	GETNEXT NOTCASE('N', __start);
@@ -520,7 +524,7 @@
 /*
  * Generate dependencies for one file.
  */
-void do_depend(const char * filename, const char * command)
+void do_depend(const char * filename)
 {
 	int mapsize;
 	int pagesizem1 = getpagesize()-1;
@@ -559,9 +563,7 @@
 	clear_config();
 	state_machine(map, map+st.st_size);
 	if (hasdep) {
-		puts(command);
-		if (*command)
-			define_precious(filename);
+		puts("");
 	}
 
 	munmap(map, mapsize);
@@ -607,7 +609,6 @@
 
 	while (--argc > 0) {
 		const char * filename = *++argv;
-		const char * command  = __depname;
 		g_filename = 0;
 		len = strlen(filename);
 		memcpy(depname, filename, len+1);
@@ -615,10 +616,9 @@
 			if (filename[len-1] == 'c' || filename[len-1] == 'S') {
 			    depname[len-1] = 'o';
 			    g_filename = filename;
-			    command = "";
 			}
 		}
-		do_depend(filename, command);
+		do_depend(filename);
 	}
 	if (len_precious) {
 		*(str_precious+len_precious) = '\0';



More information about the busybox-cvs mailing list