Changeset 900 for vendor/gnumake/current/remake.c
- Timestamp:
- May 23, 2007, 5:13:11 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/remake.c
r501 r900 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; … … 809 808 if (touch_flag 810 809 /* The update status will be: 811 810 -1 if this target was not remade; 812 811 0 if 0 or more commands (+ or ${MAKE}) were run and won; 813 812 1 if some commands were run and lost. … … 919 918 so that a vpath_search can happen. Otherwise, it would 920 919 never be done because the target is already updated. */ 921 (void)f_mtime (d->file, 0);920 f_mtime (d->file, 0); 922 921 } 923 922 else if (file->update_status == -1) … … 928 927 929 928 930 /* Check whether another file (whose mtime is THIS_MTIME) 931 needs updating on account of a dependency which is file FILE. 932 If it does, store 1 in *MUST_MAKE_PTR. 933 In the process, update any non-intermediate files 934 that FILE depends on (including FILE itself). 935 Return nonzero if any updating failed. */ 929 /* Check whether another file (whose mtime is THIS_MTIME) needs updating on 930 account of a dependency which is file FILE. If it does, store 1 in 931 *MUST_MAKE_PTR. In the process, update any non-intermediate files that 932 FILE depends on (including FILE itself). Return nonzero if any updating 933 failed. */ 936 934 937 935 static int … … 947 945 if (file->phony || !file->intermediate) 948 946 { 949 /* If this is a non-intermediate file, update it and record 950 whether itis newer than THIS_MTIME. */947 /* If this is a non-intermediate file, update it and record whether it 948 is newer than THIS_MTIME. */ 951 949 FILE_TIMESTAMP mtime; 952 950 dep_status = update_file (file, depth); … … 977 975 } 978 976 979 /* If the intermediate file actually exists980 and is newer, then we should remake from it. */981 977 check_renamed (file); 982 978 mtime = file_mtime (file); 983 979 check_renamed (file); 984 980 if (mtime != NONEXISTENT_MTIME && mtime > this_mtime) 981 /* If the intermediate file actually exists and is newer, then we 982 should remake from it. */ 985 983 *must_make_ptr = 1; 986 /* Otherwise, update all non-intermediate files we depend on,987 if necessary, and see whether any of them is more988 recent than the file on whose behalf we are checking. */989 984 else 990 985 { 986 /* Otherwise, update all non-intermediate files we depend on, if 987 necessary, and see whether any of them is more recent than the 988 file on whose behalf we are checking. */ 991 989 struct dep *lastd; 992 990 … … 1067 1065 { 1068 1066 struct stat statbuf; 1069 char buf ;1067 char buf = 'x'; 1070 1068 int e; 1071 1069 … … 1163 1161 char *arname, *memname; 1164 1162 struct file *arfile; 1165 int arname_used = 0;1166 1163 time_t member_date; 1167 1164 … … 1173 1170 arfile = lookup_file (arname); 1174 1171 if (arfile == 0) 1175 { 1176 arfile = enter_file (arname); 1177 arname_used = 1; 1178 } 1172 arfile = enter_file (strcache_add (arname)); 1179 1173 mtime = f_mtime (arfile, search); 1180 1174 check_renamed (arfile); … … 1187 1181 unsigned int arlen, memlen; 1188 1182 1189 if (!arname_used) 1190 { 1191 free (arname); 1192 arname_used = 1; 1193 } 1194 1195 arname = arfile->hname; 1196 arlen = strlen (arname); 1183 arlen = strlen (arfile->hname); 1197 1184 memlen = strlen (memname); 1198 1185 1199 /* free (file->name); */ 1200 1201 name = (char *) xmalloc (arlen + 1 + memlen + 2); 1202 bcopy (arname, name, arlen); 1186 name = xmalloc (arlen + 1 + memlen + 2); 1187 memcpy (name, arfile->hname, arlen); 1203 1188 name[arlen] = '('; 1204 bcopy (memname, name + arlen + 1, memlen);1189 memcpy (name + arlen + 1, memname, memlen); 1205 1190 name[arlen + 1 + memlen] = ')'; 1206 1191 name[arlen + 1 + memlen + 1] = '\0'; … … 1215 1200 } 1216 1201 1217 if (!arname_used) 1218 free (arname); 1219 free (memname); 1202 free (arname); 1220 1203 1221 1204 file->low_resolution_time = 1; … … 1238 1221 { 1239 1222 /* If name_mtime failed, search VPATH. */ 1240 c har *name = file->name;1241 if ( vpath_search (&name, &mtime)1223 const char *name = vpath_search (file->name, &mtime); 1224 if (name 1242 1225 /* Last resort, is it a library (-lxxx)? */ 1243 || ( name[0] == '-' &&name[1] == 'l'1244 && library_search (&name, &mtime)))1226 || (file->name[0] == '-' && file->name[1] == 'l' 1227 && (name = library_search (file->name, &mtime)) != 0)) 1245 1228 { 1246 1229 if (mtime != UNKNOWN_MTIME) … … 1361 1344 1362 1345 static FILE_TIMESTAMP 1363 name_mtime (c har *name)1346 name_mtime (const char *name) 1364 1347 { 1365 1348 FILE_TIMESTAMP mtime; … … 1455 1438 directories. */ 1456 1439 1457 static int1458 library_search (c har **lib, FILE_TIMESTAMP *mtime_ptr)1440 static const char * 1441 library_search (const char *lib, FILE_TIMESTAMP *mtime_ptr) 1459 1442 { 1460 1443 static char *dirs[] = … … 1477 1460 static char *libpatterns = NULL; 1478 1461 1479 c har *libname = &(*lib)[2]; /* Name without the `-l'. */1462 const char *libname = lib+2; /* Name without the '-l'. */ 1480 1463 FILE_TIMESTAMP mtime; 1481 1464 1482 1465 /* Loop variables for the libpatterns value. */ 1483 char *p, *p2; 1466 char *p; 1467 const char *p2; 1484 1468 unsigned int len; 1485 1469 1486 char * file, **dp;1470 char **dp; 1487 1471 1488 1472 /* If we don't have libpatterns, get it. */ … … 1533 1517 if (mtime != NONEXISTENT_MTIME) 1534 1518 { 1535 *lib = xstrdup (libbuf);1536 1519 if (mtime_ptr != 0) 1537 1520 *mtime_ptr = mtime; 1538 return 1;1521 return strcache_add (libbuf); 1539 1522 } 1540 1523 1541 1524 /* Now try VPATH search on that. */ 1542 1525 1543 file = libbuf; 1544 if (vpath_search (&file, mtime_ptr)) 1545 { 1546 *lib = file; 1547 return 1; 1548 } 1526 { 1527 const char *file = vpath_search (libbuf, mtime_ptr); 1528 if (file) 1529 return file; 1530 } 1549 1531 1550 1532 /* Now try the standard set of directories. */ … … 1573 1555 if (mtime != NONEXISTENT_MTIME) 1574 1556 { 1575 *lib = xstrdup (buf);1576 1557 if (mtime_ptr != 0) 1577 1558 *mtime_ptr = mtime; 1578 return 1;1559 return strcache_add (buf); 1579 1560 } 1580 1561 }
Note:
See TracChangeset
for help on using the changeset viewer.