VirtualBox

Changeset 2024 in kBuild for trunk


Ignore:
Timestamp:
Nov 2, 2008 5:43:17 AM (16 years ago)
Author:
bird
Message:

kmk: Created a custom hook into the update_file process for checking additional file dependencies like changes in the commands and such. It's call .MUST_MAKE.

Location:
trunk/src/kmk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kmk/Makefile.am

    r2010 r2024  
    108108        -DCONFIG_WITH_DEFINED \
    109109        -DCONFIG_WITH_EXPLICIT_MULTITARGET \
     110        -DCONFIG_WITH_DOT_MUST_MAKE \
    110111        -DCONFIG_WITH_PREPEND_ASSIGNMENT \
    111112        -DCONFIG_WITH_LOCAL_VARIABLES \
  • trunk/src/kmk/Makefile.kmk

    r2019 r2024  
    136136        CONFIG_WITH_DEFINED \
    137137        CONFIG_WITH_EXPLICIT_MULTITARGET \
     138        CONFIG_WITH_DOT_MUST_MAKE \
    138139        CONFIG_WITH_PREPEND_ASSIGNMENT \
    139140        CONFIG_WITH_LOCAL_VARIABLES \
  • trunk/src/kmk/commands.c

    r1993 r2024  
    4747
    4848void
     49#if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE)
     50set_file_variables (struct file *file, int called_early)
     51#else
    4952set_file_variables (struct file *file)
     53#endif
    5054{
    5155  const struct dep *d;
     
    182186    DEFINE_VARIABLE ("%", 1, percent);
    183187#endif /* CONFIG_WITH_RDONLY_VARIABLE_VALUE */
     188
     189#if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE)
     190  /* The $^, $+, $? and $| variables should not be set if we're called
     191     early by a .MUST_MAKE invocation or $(commands ).  */
     192  if (called_early)
     193    return;
     194#endif
    184195
    185196  /* Compute the values for $^, $+, $?, and $|.  */
     
    500511  initialize_file_variables (file, 0);
    501512
     513#if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE)
     514  set_file_variables (file, 0 /* final call */);
     515#else
    502516  set_file_variables (file);
     517#endif
    503518
    504519  /* Start the commands running.  */
  • trunk/src/kmk/commands.h

    r1993 r2024  
    4242# define COMMANDS_NOTPARALLEL   32  /* kmk: The commands must be executed alone. */
    4343# define COMMANDS_NO_COMMANDS   64  /* kmk: No commands. */
    44 #endif 
     44#endif
    4545#ifdef CONFIG_WITH_KMK_BUILTIN
    4646# define COMMANDS_KMK_BUILTIN   128 /* kmk: kmk builtin command. */
     
    5454void delete_child_targets (struct child *child);
    5555void chop_commands (struct commands *cmds);
     56#if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE)
     57void set_file_variables (struct file *file, int called_early);
     58#else
    5659void set_file_variables (struct file *file);
     60#endif
  • trunk/src/kmk/file.c

    r1993 r2024  
    666666            f->stem = d->stem;
    667667
     668#if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE)
     669          set_file_variables (f, 0 /* real call, f->deps == 0 so we're ok. */);
     670#else
    668671          set_file_variables (f);
     672#endif
    669673
    670674#if !defined (CONFIG_WITH_VALUE_LENGTH) || !defined (CONFIG_WITH_STRCACHE2)
  • trunk/src/kmk/function.c

    r2021 r2024  
    43654365        }
    43664366
    4367       initialize_file_variables (file, 1 /* reading - FIXME: we don't know? */);
    4368       set_file_variables (file); /* FIXME: this must *NOT* be done twice! */
     4367      initialize_file_variables (file, 1 /* don't search for pattern vars */);
     4368      set_file_variables (file, 1 /* early call */);
    43694369      chop_commands (cmds);
    43704370
  • trunk/src/kmk/implicit.c

    r2001 r2024  
    561561                      if (!file_variables_set)
    562562                        {
     563#if defined(CONFIG_WITH_COMMANDS_FUNC) || defined (CONFIG_WITH_DOT_MUST_MAKE)
     564                          set_file_variables (file, 0 /* real call */);
     565#else
    563566                          set_file_variables (file);
     567#endif
    564568                          file_variables_set = 1;
    565569                        }
  • trunk/src/kmk/remake.c

    r2001 r2024  
    6565static int check_dep (struct file *file, unsigned int depth,
    6666                      FILE_TIMESTAMP this_mtime, int *must_make_ptr);
     67#ifdef CONFIG_WITH_DOT_MUST_MAKE
     68static int call_must_make_target_var (struct file *file);
     69#endif
    6770static int touch_file (struct file *file);
    6871static void remake_file (struct file *file);
     
    511514     and see whether any of them is more recent than this file.
    512515     For explicit multitarget rules we must iterate all the output
    513      files to get the correct picture. */
     516     files to get the correct picture.  The special .MUST_MAKE
     517     target variable call is also done from this context.  */
    514518
    515519#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
     
    617621          d = d->next;
    618622        }
     623
     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
    619635#ifdef CONFIG_WITH_EXPLICIT_MULTITARGET
    620636      if (dep_status != 0 && !keep_going_flag)
     
    884900  return file->update_status;
    885901}
     902#ifdef CONFIG_WITH_DOT_MUST_MAKE
     903
     904
     905/* Consider the .MUST_MAKE target variable if present.
     906
     907   Returns 1 if must remake, 0 if not.
     908
     909   The deal is that .MUST_MAKE returns non-zero if it thinks the target needs
     910   updating.  We have to initialize file variables (for the sake of pattern
     911   vars) and set the most important file variables before calling (expanding)
     912   the .MUST_MAKE variable.
     913
     914   The file variables keeping the dependency lists, $+, $^, $? and $| are not
     915   available at this point because $? depends on things happening after we've
     916   decided to make the file.  So, to keep things simple all 4 of them are
     917   undefined in this call.  */
     918static int
     919call_must_make_target_var (struct file *file)
     920{
     921  struct variable *var;
     922  unsigned char ch;
     923  const char *str;
     924
     925  if (file->variables)
     926    {
     927      var = lookup_variable_in_set (".MUST_MAKE", sizeof (".MUST_MAKE") - 1,
     928                                    file->variables->set);
     929      if (var)
     930        {
     931          initialize_file_variables (file, 0);
     932          set_file_variables (file, 1 /* called early, no dep lists please */);
     933
     934          str = variable_expand_for_file_2 (NULL,
     935                                            var->value, var->value_length,
     936                                            file, NULL);
     937
     938          /* stripped string should be non-zero.  */
     939          do
     940            ch = *str++;
     941          while (isspace (ch));
     942
     943          return (ch != '\0');
     944        }
     945    }
     946  return 0;
     947}
     948#endif /* CONFIG_WITH_DOT_MUST_MAKE */
    886949
    887950
  • trunk/src/kmk/variable.c

    r2021 r2024  
    11961196  && defined (CONFIG_WITH_XARGS) \
    11971197  && defined (CONFIG_WITH_EXPLICIT_MULTITARGET) \
     1198  && defined (CONFIG_WITH_DOT_MUST_MAKE) \
    11981199  && defined (CONFIG_WITH_PREPEND_ASSIGNMENT) \
    11991200  && defined (CONFIG_WITH_SET_CONDITIONALS) \
     
    12161217                          " xargs"
    12171218                          " explicit-multitarget"
     1219                          " dot-must-make"
    12181220                          " prepend-assignment"
    12191221                          " set-conditionals intersects"
     
    12561258#  if defined (CONFIG_WITH_EXPLICIT_MULTITARGET)
    12571259  strcat (buf, " explicit-multitarget");
     1260#  endif
     1261#  if defined (CONFIG_WITH_DOT_MUST_MAKE)
     1262  strcat (buf, " dot-must-make");
    12581263#  endif
    12591264#  if defined (CONFIG_WITH_PREPEND_ASSIGNMENT)
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