Ignore:
Timestamp:
Sep 15, 2006, 4:30:32 AM (19 years ago)
Author:
bird
Message:

Load make-3.81/ into vendor/gnumake/current.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • vendor/gnumake/current/remake.c

    r280 r501  
    11/* 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.
     2Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
     31998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
     4Foundation, Inc.
    45This file is part of GNU Make.
    56
    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.  */
     7GNU Make is free software; you can redistribute it and/or modify it under the
     8terms of the GNU General Public License as published by the Free Software
     9Foundation; either version 2, or (at your option) any later version.
     10
     11GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY
     12WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
     13A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
     14
     15You should have received a copy of the GNU General Public License along with
     16GNU Make; see the file COPYING.  If not, write to the Free Software
     17Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.  */
    2018
    2119#include "make.h"
     
    161159                 by calling update_file above.  We check this flag below to
    162160                 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;
    164163
    165164              /* If we updated a file and STATUS was not already 1, set it to
     
    267266      job_slots = j;
    268267    }
     268
    269269  return status;
    270270}
     
    309309      status |= update_file_1 (f, depth);
    310310      check_renamed (f);
     311
     312      /* Clean up any alloca() used during the update.  */
     313      alloca (0);
    311314
    312315      /* If we got an error, don't bother with double_colon etc.  */
     
    534537
    535538      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) */);
    537545
    538546      lastd = d;
     
    846854  if ((ran && !file->phony) || touched)
    847855    {
    848       struct file *f;
    849856      int i = 0;
    850857
     
    866873
    867874      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;
    873903    }
    874904
     
    9741004                    {
    9751005                      file->deps = d->next;
    976                       free ((char *) d);
     1006                      free_dep (d);
    9771007                      d = file->deps;
    9781008                    }
     
    9801010                    {
    9811011                      lastd->next = d->next;
    982                       free ((char *) d);
     1012                      free_dep (d);
    9831013                      d = lastd->next;
    9841014                    }
     
    12311261              rehash_file (file, name);
    12321262              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);
    12341267            }
    12351268        }
    12361269    }
    12371270
    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;
    12521284
    12531285#if defined(WINDOWS32) || defined(__MSDOS__)
    1254         /* Experimentation has shown that FAT filesystems can set file times
    1255            up to 3 seconds into the future!  Play it safe.  */
     1286      /* Experimentation has shown that FAT filesystems can set file times
     1287         up to 3 seconds into the future!  Play it safe.  */
    12561288
    12571289#define FAT_ADJ_OFFSET  (FILE_TIMESTAMP) 3
    12581290
    1259         FILE_TIMESTAMP adjustment = FAT_ADJ_OFFSET << FILE_TIMESTAMP_LO_BITS;
    1260         if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime)
    1261           adjusted_mtime -= adjustment;
     1291      FILE_TIMESTAMP adjustment = FAT_ADJ_OFFSET << FILE_TIMESTAMP_LO_BITS;
     1292      if (ORDINARY_MTIME_MIN + adjustment <= adjusted_mtime)
     1293        adjusted_mtime -= adjustment;
    12621294#elif defined(__EMX__)
    1263         /* FAT filesystems round time to the nearest even second!
    1264            Allow for any file (NTFS or FAT) to perhaps suffer from this
    1265            brain damage.  */
    1266         FILE_TIMESTAMP adjustment = (((FILE_TIMESTAMP_S (adjusted_mtime) & 1) == 0
    1267                        && FILE_TIMESTAMP_NS (adjusted_mtime) == 0)
    1268                       ? (FILE_TIMESTAMP) 1 << FILE_TIMESTAMP_LO_BITS
    1269                       : 0);
     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);
    12701302#endif
    12711303
    1272         /* If the file's time appears to be in the future, update our
    1273            concept of the present and try once more.  */
    1274         if (adjusted_now < adjusted_mtime)
    1275           {
    1276             int resolution;
    1277             FILE_TIMESTAMP now = file_timestamp_now (&resolution);
    1278             adjusted_now = now + (resolution - 1);
    1279             if (adjusted_now < adjusted_mtime)
    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            {
    12811313#ifdef NO_FLOAT
    1282                 error (NILF, _("Warning: File `%s' has modification time in the future"),
    1283                        file->name);
     1314              error (NILF, _("Warning: File `%s' has modification time in the future"),
     1315                     file->name);
    12841316#else
    1285                 double from_now =
    1286                   (FILE_TIMESTAMP_S (mtime) - FILE_TIMESTAMP_S (now)
    1287                    + ((FILE_TIMESTAMP_NS (mtime) - FILE_TIMESTAMP_NS (now))
    1288                       / 1e9));
    1289                 error (NILF, _("Warning: File `%s' has modification time %.2g s in the future"),
    1290                        file->name, from_now);
     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);
    12911323#endif
    1292                 clock_skew_detected = 1;
    1293               }
    1294           }
    1295       }
    1296   }
     1324              clock_skew_detected = 1;
     1325            }
     1326        }
     1327    }
    12971328
    12981329  /* Store the mtime into all the entries for this file.  */
     
    13371368
    13381369  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);
    13431377      return NONEXISTENT_MTIME;
    13441378    }
    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.  */
    13461382
    13471383#ifdef MAKE_SYMLINKS
     
    13701406          if (e)
    13711407            {
    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);
    13741411              break;
    13751412            }
Note: See TracChangeset for help on using the changeset viewer.