VirtualBox

Changeset 2028 in kBuild for trunk/src


Ignore:
Timestamp:
Nov 3, 2008 1:54:19 AM (17 years ago)
Author:
bird
Message:

remake.c: moved call_must_make_target_var out of the dep eval loop and added a DB_BASIC printf for hits. Some sketchy .IS_CHANGED target variable to complement the .MUST_MAKE one, the concept needds more work though.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/remake.c

    r2024 r2028  
    6666                      FILE_TIMESTAMP this_mtime, int *must_make_ptr);
    6767#ifdef CONFIG_WITH_DOT_MUST_MAKE
    68 static int call_must_make_target_var (struct file *file);
     68static int call_must_make_target_var (struct file *file, unsigned int depth);
     69#endif
     70#ifdef CONFIG_WITH_DOT_IS_CHANGED
     71static int call_is_changed_target_var (struct file *file);
    6972#endif
    7073static int touch_file (struct file *file);
     
    622625        }
    623626
    624 #ifdef CONFIG_WITH_DOT_MUST_MAKE
    625       /* Check with the .MUST_MAKE target variable if it's
    626          not already decided to make the file.  */
    627       if (!must_make)
    628 # ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
    629         must_make = call_must_make_target_var (f2);
    630 # else
    631         must_make = call_must_make_target_var (file);
    632 # endif
    633 #endif
    634 
    635627#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
    636628      if (dep_status != 0 && !keep_going_flag)
     
    638630    }
    639631#endif
     632
     633#ifdef CONFIG_WITH_DOT_MUST_MAKE
     634  /* Check with the .MUST_MAKE target variable if it's
     635     not already decided to make the file.  */
     636
     637# ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
     638  if (!must_make)
     639    for (f2 = file; f2 && !must_make; f2 = f2->multi_next)
     640      must_make = call_must_make_target_var (f2, depth);
     641# else
     642  if (!must_make)
     643    must_make = call_must_make_target_var (file, depth);
     644# endif
     645#endif /* CONFIG_WITH_DOT_MUST_MAKE */
    640646
    641647  /* Now we know whether this target needs updating.
     
    917923   undefined in this call.  */
    918924static int
    919 call_must_make_target_var (struct file *file)
     925call_must_make_target_var (struct file *file, unsigned int depth)
    920926{
    921927  struct variable *var;
     
    941947          while (isspace (ch));
    942948
    943           return (ch != '\0');
     949          if (ch != '\0')
     950            {
     951              if (ISDB (DB_BASIC))
     952                {
     953                  print_spaces (depth);
     954                  printf (_(".MUST_MAKE returned `%s' for target `%s'.\n"),
     955                          str, file->name);
     956                }
     957              return 1;
     958            }
    944959        }
    945960    }
     
    947962}
    948963#endif /* CONFIG_WITH_DOT_MUST_MAKE */
     964#ifdef CONFIG_WITH_DOT_IS_CHANGED
     965
     966
     967/* Consider the .IS_CHANGED target variable if present.
     968
     969   Returns 1 if the file should be considered modified, 0 if not.
     970
     971   The calling context and restrictions are the same as for .MUST_MAKE.
     972   Make uses the information from this 'function' for determining whether to
     973   make a file which lists this as a prerequisite.  So, this is the feature you
     974   use to check MD5 sums, file sizes, time stamps and the like with data from
     975   a previous run.
     976
     977   FIXME: Would be nice to know which file is currently being considered.
     978   FIXME: Is currently not invoked for intermediate files.  */
     979static int
     980call_is_changed_target_var (struct file *file)
     981{
     982  struct variable *var;
     983  unsigned char ch;
     984  const char *str;
     985
     986  if (file->variables)
     987    {
     988      var = lookup_variable_in_set (".IS_CHANGED", sizeof (".IS_CHANGED") - 1,
     989                                    file->variables->set);
     990      if (var)
     991        {
     992          initialize_file_variables (file, 0);
     993          set_file_variables (file, 1 /* called early, no dep lists please */);
     994
     995          str = variable_expand_for_file_2 (NULL,
     996                                            var->value, var->value_length,
     997                                            file, NULL);
     998
     999          /* stripped string should be non-zero.  */
     1000          do
     1001            ch = *str++;
     1002          while (isspace (ch));
     1003
     1004          return (ch != '\0');
     1005        }
     1006    }
     1007  return 0;
     1008}
     1009#endif /* CONFIG_WITH_DOT_IS_CHANGED */
    9491010
    9501011
     
    11941255      if (mtime == NONEXISTENT_MTIME || mtime > this_mtime)
    11951256        *must_make_ptr = 1;
     1257#ifdef CONFIG_WITH_DOT_IS_CHANGED
     1258      else if (   *must_make_ptr == 0
     1259               && call_is_changed_target_var (file))
     1260        *must_make_ptr = 1;
     1261#endif /* CONFIG_WITH_DOT_IS_CHANGED */
    11961262    }
    11971263  else
Note: See TracChangeset for help on using the changeset viewer.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette