Changeset 501 for vendor/gnumake/current/remake.c
- Timestamp:
- Sep 15, 2006, 4:30:32 AM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/remake.c
r280 r501 1 1 /* Basic dependency engine for GNU Make. 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1999, 3 2002 Free Software Foundation, Inc. 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software 4 Foundation, Inc. 4 5 This file is part of GNU Make. 5 6 6 GNU Make is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2, or (at your option) 9 any later version. 10 11 GNU Make is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with GNU Make; see the file COPYING. If not, write to 18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 19 Boston, MA 02111-1307, USA. */ 7 GNU Make is free software; you can redistribute it and/or modify it under the 8 terms of the GNU General Public License as published by the Free Software 9 Foundation; either version 2, or (at your option) any later version. 10 11 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY 12 WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR 13 A PARTICULAR PURPOSE. See the GNU General Public License for more details. 14 15 You should have received a copy of the GNU General Public License along with 16 GNU Make; see the file COPYING. If not, write to the Free Software 17 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. */ 20 18 21 19 #include "make.h" … … 161 159 by calling update_file above. We check this flag below to 162 160 decide when to give an "up to date" diagnostic. */ 163 g->changed += commands_started - ocommands_started; 161 if (commands_started > ocommands_started) 162 g->changed = 1; 164 163 165 164 /* If we updated a file and STATUS was not already 1, set it to … … 267 266 job_slots = j; 268 267 } 268 269 269 return status; 270 270 } … … 309 309 status |= update_file_1 (f, depth); 310 310 check_renamed (f); 311 312 /* Clean up any alloca() used during the update. */ 313 alloca (0); 311 314 312 315 /* If we got an error, don't bother with double_colon etc. */ … … 534 537 535 538 if (!running) 536 d->changed = file_mtime (d->file) != mtime; 539 /* 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. */ 543 d->changed = ((file_mtime (d->file) != mtime) 544 /* || (mtime == NONEXISTENT_MTIME) */); 537 545 538 546 lastd = d; … … 846 854 if ((ran && !file->phony) || touched) 847 855 { 848 struct file *f;849 856 int i = 0; 850 857 … … 866 873 867 874 file->last_mtime = i == 0 ? UNKNOWN_MTIME : NEW_MTIME; 868 869 /* Propagate the change of modification time to all the double-colon 870 entries for this file. */ 871 for (f = file->double_colon; f != 0; f = f->prev) 872 f->last_mtime = file->last_mtime; 875 } 876 877 if (file->double_colon) 878 { 879 /* If this is a double colon rule and it is the last one to be 880 updated, propagate the change of modification time to all the 881 double-colon entries for this file. 882 883 We do it on the last update because it is important to handle 884 individual entries as separate rules with separate timestamps 885 while they are treated as targets and then as one rule with the 886 unified timestamp when they are considered as a prerequisite 887 of some target. */ 888 889 struct file *f; 890 FILE_TIMESTAMP max_mtime = file->last_mtime; 891 892 /* Check that all rules were updated and at the same time find 893 the max timestamp. We assume UNKNOWN_MTIME is newer then 894 any other value. */ 895 for (f = file->double_colon; f != 0 && f->updated; f = f->prev) 896 if (max_mtime != UNKNOWN_MTIME 897 && (f->last_mtime == UNKNOWN_MTIME || f->last_mtime > max_mtime)) 898 max_mtime = f->last_mtime; 899 900 if (f == 0) 901 for (f = file->double_colon; f != 0; f = f->prev) 902 f->last_mtime = max_mtime; 873 903 } 874 904 … … 974 1004 { 975 1005 file->deps = d->next; 976 free ((char *)d);1006 free_dep (d); 977 1007 d = file->deps; 978 1008 } … … 980 1010 { 981 1011 lastd->next = d->next; 982 free ((char *)d);1012 free_dep (d); 983 1013 d = lastd->next; 984 1014 } … … 1231 1261 rehash_file (file, name); 1232 1262 check_renamed (file); 1233 mtime = name_mtime (name); 1263 /* If the result of a vpath search is -o or -W, preserve it. 1264 Otherwise, find the mtime of the resulting file. */ 1265 if (mtime != OLD_MTIME && mtime != NEW_MTIME) 1266 mtime = name_mtime (name); 1234 1267 } 1235 1268 } 1236 1269 } 1237 1270 1238 { 1239 /* Files can have bogus timestamps that nothing newly made will be 1240 "newer" than. Updating their dependents could just result in loops. 1241 So notify the user of the anomaly with a warning. 1242 1243 We only need to do this once, for now. */ 1244 1245 if (!clock_skew_detected 1246 && mtime != NONEXISTENT_MTIME 1247 && !file->updated) 1248 { 1249 static FILE_TIMESTAMP adjusted_now; 1250 1251 FILE_TIMESTAMP adjusted_mtime = mtime; 1271 /* Files can have bogus timestamps that nothing newly made will be 1272 "newer" than. Updating their dependents could just result in loops. 1273 So notify the user of the anomaly with a warning. 1274 1275 We only need to do this once, for now. */ 1276 1277 if (!clock_skew_detected 1278 && mtime != NONEXISTENT_MTIME && mtime != NEW_MTIME 1279 && !file->updated) 1280 { 1281 static FILE_TIMESTAMP adjusted_now; 1282 1283 FILE_TIMESTAMP adjusted_mtime = mtime; 1252 1284 1253 1285 #if defined(WINDOWS32) || defined(__MSDOS__) 1254 1255 1286 /* Experimentation has shown that FAT filesystems can set file times 1287 up to 3 seconds into the future! Play it safe. */ 1256 1288 1257 1289 #define FAT_ADJ_OFFSET (FILE_TIMESTAMP) 3 1258 1290 1259 1260 1261 1291 FILE_TIMESTAMP adjustment = FAT_ADJ_OFFSET << FILE_TIMESTAMP_LO_BITS; 1292 if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime) 1293 adjusted_mtime -= adjustment; 1262 1294 #elif defined(__EMX__) 1263 1264 1265 1266 1267 1268 1269 1295 /* FAT filesystems round time to the nearest even second! 1296 Allow for any file (NTFS or FAT) to perhaps suffer from this 1297 brain damage. */ 1298 FILE_TIMESTAMP adjustment = (((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0 1299 && FILE_TIMESTAMP_NS (adjusted_mtime) == 0) 1300 ? (FILE_TIMESTAMP) 1 << FILE_TIMESTAMP_LO_BITS 1301 : 0); 1270 1302 #endif 1271 1303 1272 1273 1274 1275 1276 1277 1278 1279 1280 1304 /* If the file's time appears to be in the future, update our 1305 concept of the present and try once more. */ 1306 if (adjusted_now < adjusted_mtime) 1307 { 1308 int resolution; 1309 FILE_TIMESTAMP now = file_timestamp_now (&resolution); 1310 adjusted_now = now + (resolution - 1); 1311 if (adjusted_now < adjusted_mtime) 1312 { 1281 1313 #ifdef NO_FLOAT 1282 1283 1314 error (NILF, _("Warning: File `%s' has modification time in the future"), 1315 file->name); 1284 1316 #else 1285 1286 1287 1288 1289 1290 1317 double from_now = 1318 (FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now) 1319 + ((FILE_TIMESTAMP_NS (mtime) - FILE_TIMESTAMP_NS (now)) 1320 / 1e9)); 1321 error (NILF, _("Warning: File `%s' has modification time %.2g s in the future"), 1322 file->name, from_now); 1291 1323 #endif 1292 clock_skew_detected = 1; 1293 } 1294 } 1295 } 1296 } 1324 clock_skew_detected = 1; 1325 } 1326 } 1327 } 1297 1328 1298 1329 /* Store the mtime into all the entries for this file. */ … … 1337 1368 1338 1369 EINTRLOOP (e, stat (name, &st)); 1339 if (e != 0) 1340 { 1341 if (errno != ENOENT && errno != ENOTDIR) 1342 perror_with_name ("stat: ", name); 1370 if (e == 0) 1371 mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st); 1372 else if (errno == ENOENT || errno == ENOTDIR) 1373 mtime = NONEXISTENT_MTIME; 1374 else 1375 { 1376 perror_with_name ("stat: ", name); 1343 1377 return NONEXISTENT_MTIME; 1344 1378 } 1345 mtime = FILE_TIMESTAMP_STAT_MODTIME (name, st); 1379 1380 /* If we get here we either found it, or it doesn't exist. 1381 If it doesn't exist see if we can use a symlink mtime instead. */ 1346 1382 1347 1383 #ifdef MAKE_SYMLINKS … … 1370 1406 if (e) 1371 1407 { 1372 /* Eh? Just take what we have. */ 1373 perror_with_name ("lstat: ", lpath); 1408 /* Just take what we have so far. */ 1409 if (errno != ENOENT && errno != ENOTDIR) 1410 perror_with_name ("lstat: ", lpath); 1374 1411 break; 1375 1412 }
Note:
See TracChangeset
for help on using the changeset viewer.