Changeset 903 for trunk/src/gmakenew/remake.c
- Timestamp:
- May 23, 2007, 7:31:19 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gmakenew/remake.c
r520 r903 40 40 #endif 41 41 42 extern int try_implicit_rule PARAMS ((struct file *file, unsigned int depth));42 extern int try_implicit_rule (struct file *file, unsigned int depth); 43 43 44 44 … … 61 61 static unsigned int considered; 62 62 63 static int update_file PARAMS ((struct file *file, unsigned int depth)); 64 static int update_file_1 PARAMS ((struct file *file, unsigned int depth)); 65 static int check_dep PARAMS ((struct file *file, unsigned int depth, FILE_TIMESTAMP this_mtime, int *must_make_ptr)); 66 static int touch_file PARAMS ((struct file *file)); 67 static void remake_file PARAMS ((struct file *file)); 68 static FILE_TIMESTAMP name_mtime PARAMS ((char *name)); 69 static int library_search PARAMS ((char **lib, FILE_TIMESTAMP *mtime_ptr)); 63 static int update_file (struct file *file, unsigned int depth); 64 static int update_file_1 (struct file *file, unsigned int depth); 65 static int check_dep (struct file *file, unsigned int depth, 66 FILE_TIMESTAMP this_mtime, int *must_make_ptr); 67 static int touch_file (struct file *file); 68 static void remake_file (struct file *file); 69 static FILE_TIMESTAMP name_mtime (const char *name); 70 static const char *library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr); 70 71 71 72 … … 239 240 240 241 /* Free the storage. */ 241 free ( (char *)g);242 free (g); 242 243 243 244 g = lastgoal == 0 ? goals : lastgoal->next; … … 538 539 if (!running) 539 540 /* The prereq is considered changed if the timestamp has changed while 540 it was built, OR it doesn't exist. 541 This causes the Linux kernel build to break. We'll defer this 542 fix until GNU make 3.82 to give them time to update. */ 541 it was built, OR it doesn't exist. */ 543 542 d->changed = ((file_mtime (d->file) != mtime) 544 /* || (mtime == NONEXISTENT_MTIME) */);543 || (mtime == NONEXISTENT_MTIME)); 545 544 546 545 lastd = d; … … 823 822 if (touch_flag 824 823 /* The update status will be: 825 824 -1 if this target was not remade; 826 825 0 if 0 or more commands (+ or ${MAKE}) were run and won; 827 826 1 if some commands were run and lost. … … 933 932 so that a vpath_search can happen. Otherwise, it would 934 933 never be done because the target is already updated. */ 935 (void)f_mtime (d->file, 0);934 f_mtime (d->file, 0); 936 935 } 937 936 else if (file->update_status == -1) … … 942 941 943 942 944 /* Check whether another file (whose mtime is THIS_MTIME) 945 needs updating on account of a dependency which is file FILE. 946 If it does, store 1 in *MUST_MAKE_PTR. 947 In the process, update any non-intermediate files 948 that FILE depends on (including FILE itself). 949 Return nonzero if any updating failed. */ 943 /* Check whether another file (whose mtime is THIS_MTIME) needs updating on 944 account of a dependency which is file FILE. If it does, store 1 in 945 *MUST_MAKE_PTR. In the process, update any non-intermediate files that 946 FILE depends on (including FILE itself). Return nonzero if any updating 947 failed. */ 950 948 951 949 static int … … 961 959 if (file->phony || !file->intermediate) 962 960 { 963 /* If this is a non-intermediate file, update it and record 964 whether itis newer than THIS_MTIME. */961 /* If this is a non-intermediate file, update it and record whether it 962 is newer than THIS_MTIME. */ 965 963 FILE_TIMESTAMP mtime; 966 964 dep_status = update_file (file, depth); … … 991 989 } 992 990 993 /* If the intermediate file actually exists994 and is newer, then we should remake from it. */995 991 check_renamed (file); 996 992 mtime = file_mtime (file); 997 993 check_renamed (file); 998 994 if (mtime != NONEXISTENT_MTIME && mtime > this_mtime) 995 /* If the intermediate file actually exists and is newer, then we 996 should remake from it. */ 999 997 *must_make_ptr = 1; 1000 /* Otherwise, update all non-intermediate files we depend on,1001 if necessary, and see whether any of them is more1002 recent than the file on whose behalf we are checking. */1003 998 else 1004 999 { 1000 /* Otherwise, update all non-intermediate files we depend on, if 1001 necessary, and see whether any of them is more recent than the 1002 file on whose behalf we are checking. */ 1005 1003 struct dep *lastd; 1006 1004 … … 1081 1079 { 1082 1080 struct stat statbuf; 1083 char buf ;1081 char buf = 'x'; 1084 1082 int e; 1085 1083 … … 1177 1175 char *arname, *memname; 1178 1176 struct file *arfile; 1179 int arname_used = 0;1180 1177 time_t member_date; 1181 1178 … … 1187 1184 arfile = lookup_file (arname); 1188 1185 if (arfile == 0) 1189 { 1190 arfile = enter_file (arname); 1191 arname_used = 1; 1192 } 1186 arfile = enter_file (strcache_add (arname)); 1193 1187 mtime = f_mtime (arfile, search); 1194 1188 check_renamed (arfile); … … 1201 1195 unsigned int arlen, memlen; 1202 1196 1203 if (!arname_used) 1204 { 1205 free (arname); 1206 arname_used = 1; 1207 } 1208 1209 arname = arfile->hname; 1210 arlen = strlen (arname); 1197 arlen = strlen (arfile->hname); 1211 1198 memlen = strlen (memname); 1212 1199 1213 /* free (file->name); */ 1214 1215 name = (char *) xmalloc (arlen + 1 + memlen + 2); 1216 bcopy (arname, name, arlen); 1200 name = xmalloc (arlen + 1 + memlen + 2); 1201 memcpy (name, arfile->hname, arlen); 1217 1202 name[arlen] = '('; 1218 bcopy (memname, name + arlen + 1, memlen);1203 memcpy (name + arlen + 1, memname, memlen); 1219 1204 name[arlen + 1 + memlen] = ')'; 1220 1205 name[arlen + 1 + memlen + 1] = '\0'; … … 1229 1214 } 1230 1215 1231 if (!arname_used) 1232 free (arname); 1233 free (memname); 1216 free (arname); 1234 1217 1235 1218 file->low_resolution_time = 1; … … 1252 1235 { 1253 1236 /* If name_mtime failed, search VPATH. */ 1254 c har *name = file->name;1255 if ( vpath_search (&name, &mtime)1237 const char *name = vpath_search (file->name, &mtime); 1238 if (name 1256 1239 /* Last resort, is it a library (-lxxx)? */ 1257 || ( name[0] == '-' &&name[1] == 'l'1258 && library_search (&name, &mtime)))1240 || (file->name[0] == '-' && file->name[1] == 'l' 1241 && (name = library_search (file->name, &mtime)) != 0)) 1259 1242 { 1260 1243 if (mtime != UNKNOWN_MTIME) … … 1375 1358 1376 1359 static FILE_TIMESTAMP 1377 name_mtime (c har *name)1360 name_mtime (const char *name) 1378 1361 { 1379 1362 FILE_TIMESTAMP mtime; … … 1469 1452 directories. */ 1470 1453 1471 static int1472 library_search (c har **lib, FILE_TIMESTAMP *mtime_ptr)1454 static const char * 1455 library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr) 1473 1456 { 1474 1457 static char *dirs[] = … … 1491 1474 static char *libpatterns = NULL; 1492 1475 1493 c har *libname = &(*lib)[2]; /* Name without the `-l'. */1476 const char *libname = lib+2; /* Name without the '-l'. */ 1494 1477 FILE_TIMESTAMP mtime; 1495 1478 1496 1479 /* Loop variables for the libpatterns value. */ 1497 char *p, *p2; 1480 char *p; 1481 const char *p2; 1498 1482 unsigned int len; 1499 1483 1500 char * file, **dp;1484 char **dp; 1501 1485 1502 1486 /* If we don't have libpatterns, get it. */ … … 1547 1531 if (mtime != NONEXISTENT_MTIME) 1548 1532 { 1549 *lib = xstrdup (libbuf);1550 1533 if (mtime_ptr != 0) 1551 1534 *mtime_ptr = mtime; 1552 return 1;1535 return strcache_add (libbuf); 1553 1536 } 1554 1537 1555 1538 /* Now try VPATH search on that. */ 1556 1539 1557 file = libbuf; 1558 if (vpath_search (&file, mtime_ptr)) 1559 { 1560 *lib = file; 1561 return 1; 1562 } 1540 { 1541 const char *file = vpath_search (libbuf, mtime_ptr); 1542 if (file) 1543 return file; 1544 } 1563 1545 1564 1546 /* Now try the standard set of directories. */ … … 1587 1569 if (mtime != NONEXISTENT_MTIME) 1588 1570 { 1589 *lib = xstrdup (buf);1590 1571 if (mtime_ptr != 0) 1591 1572 *mtime_ptr = mtime; 1592 return 1;1573 return strcache_add (buf); 1593 1574 } 1594 1575 }
Note:
See TracChangeset
for help on using the changeset viewer.