aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen <andersen@codepoet.org>2003-05-24 07:30:58 +0000
committerEric Andersen <andersen@codepoet.org>2003-05-24 07:30:58 +0000
commitddfe18df75c15be4a2aadddb241c3b86b1e2968a (patch)
treea216701ad177a6f0531d46fe878eb42e5cf26e15
parent46ba568fc081fa49a757fe6f69f87cf64344d9cd (diff)
downloadbusybox-w32-ddfe18df75c15be4a2aadddb241c3b86b1e2968a.tar.gz
busybox-w32-ddfe18df75c15be4a2aadddb241c3b86b1e2968a.tar.bz2
busybox-w32-ddfe18df75c15be4a2aadddb241c3b86b1e2968a.zip
Update mkdep, per the "touchless dependencies for 2.4.x" patch
from Geert Uytterhoeven posted to the lkml. -Erik
-rw-r--r--scripts/mkdep.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/scripts/mkdep.c b/scripts/mkdep.c
index c3e94bfae..9b92b08c4 100644
--- a/scripts/mkdep.c
+++ b/scripts/mkdep.c
@@ -45,8 +45,7 @@
45 45
46 46
47 47
48char __depname[512] = "\n\t@touch "; 48char depname[512];
49#define depname (__depname+9)
50int hasdep; 49int hasdep;
51 50
52struct path_struct { 51struct path_struct {
@@ -75,9 +74,14 @@ do_depname(void)
75{ 74{
76 if (!hasdep) { 75 if (!hasdep) {
77 hasdep = 1; 76 hasdep = 1;
78 printf("%s:", depname); 77 if (g_filename) {
79 if (g_filename) 78 /* Source file (*.[cS]) */
79 printf("%s:", depname);
80 printf(" %s", g_filename); 80 printf(" %s", g_filename);
81 } else {
82 /* header file (*.h) */
83 printf("dep_%s +=", depname);
84 }
81 } 85 }
82} 86}
83 87
@@ -203,7 +207,7 @@ void handle_include(int start, const char * name, int len)
203 path->buffer[path->len+len] = '\0'; 207 path->buffer[path->len+len] = '\0';
204 if (access(path->buffer, F_OK) == 0) { 208 if (access(path->buffer, F_OK) == 0) {
205 do_depname(); 209 do_depname();
206 printf(" \\\n %s", path->buffer); 210 printf(" \\\n %s $(dep_%s)", path->buffer, path->buffer);
207 return; 211 return;
208 } 212 }
209 } 213 }
@@ -268,7 +272,7 @@ void use_config(const char * name, int len)
268 272
269 for (i = 0; i < len; i++) { 273 for (i = 0; i < len; i++) {
270 char c = name[i]; 274 char c = name[i];
271 if (isupper(c)) c = tolower(c); 275 if (isupper((int)c)) c = tolower((int)c);
272 if (c == '_') c = '/'; 276 if (c == '_') c = '/';
273 pc[i] = c; 277 pc[i] = c;
274 } 278 }
@@ -496,7 +500,7 @@ pound_define_undef_CONFIG_word:
496 500
497/* \<CONFIG_(\w*) */ 501/* \<CONFIG_(\w*) */
498cee: 502cee:
499 if (next >= map+2 && (isalnum(next[-2]) || next[-2] == '_')) 503 if (next >= map+2 && (isalnum((int)next[-2]) || next[-2] == '_'))
500 goto start; 504 goto start;
501 GETNEXT NOTCASE('O', __start); 505 GETNEXT NOTCASE('O', __start);
502 GETNEXT NOTCASE('N', __start); 506 GETNEXT NOTCASE('N', __start);
@@ -520,7 +524,7 @@ cee_CONFIG_word:
520/* 524/*
521 * Generate dependencies for one file. 525 * Generate dependencies for one file.
522 */ 526 */
523void do_depend(const char * filename, const char * command) 527void do_depend(const char * filename)
524{ 528{
525 int mapsize; 529 int mapsize;
526 int pagesizem1 = getpagesize()-1; 530 int pagesizem1 = getpagesize()-1;
@@ -559,9 +563,7 @@ void do_depend(const char * filename, const char * command)
559 clear_config(); 563 clear_config();
560 state_machine(map, map+st.st_size); 564 state_machine(map, map+st.st_size);
561 if (hasdep) { 565 if (hasdep) {
562 puts(command); 566 puts("");
563 if (*command)
564 define_precious(filename);
565 } 567 }
566 568
567 munmap(map, mapsize); 569 munmap(map, mapsize);
@@ -607,7 +609,6 @@ int main(int argc, char **argv)
607 609
608 while (--argc > 0) { 610 while (--argc > 0) {
609 const char * filename = *++argv; 611 const char * filename = *++argv;
610 const char * command = __depname;
611 g_filename = 0; 612 g_filename = 0;
612 len = strlen(filename); 613 len = strlen(filename);
613 memcpy(depname, filename, len+1); 614 memcpy(depname, filename, len+1);
@@ -615,10 +616,9 @@ int main(int argc, char **argv)
615 if (filename[len-1] == 'c' || filename[len-1] == 'S') { 616 if (filename[len-1] == 'c' || filename[len-1] == 'S') {
616 depname[len-1] = 'o'; 617 depname[len-1] = 'o';
617 g_filename = filename; 618 g_filename = filename;
618 command = "";
619 } 619 }
620 } 620 }
621 do_depend(filename, command); 621 do_depend(filename);
622 } 622 }
623 if (len_precious) { 623 if (len_precious) {
624 *(str_precious+len_precious) = '\0'; 624 *(str_precious+len_precious) = '\0';