Changeset 1615 in kBuild
- Timestamp:
- May 12, 2008 5:05:52 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/function.c
r1519 r1615 1538 1538 } 1539 1539 1540 /* A mix of func_eval and func_value, saves memory for the expansion. 1540 /* A mix of func_eval and func_value, saves memory for the expansion. 1541 1541 This implements both evalval and evalvalctx, the latter has its own 1542 1542 variable context just like evalctx. */ … … 2280 2280 2281 2281 #ifdef CONFIG_WITH_ABSPATHEX 2282 /* Same as abspath except that the current path may be given as the 2282 /* Same as abspath except that the current path may be given as the 2283 2283 2nd argument. */ 2284 2284 static char * … … 2287 2287 char *cwd = argv[1]; 2288 2288 2289 /* cwd needs leading spaces chopped and may be optional, 2289 /* cwd needs leading spaces chopped and may be optional, 2290 2290 in which case we're exactly like $(abspath ). */ 2291 2291 while (isblank(*cwd)) … … 2303 2303 PATH_VAR (in); 2304 2304 PATH_VAR (out); 2305 2305 2306 2306 while ((path = find_next_token (&p, &len)) != 0) 2307 2307 { … … 2330 2330 in[len] = '\0'; 2331 2331 } 2332 2332 2333 2333 if (abspath (in, out)) 2334 2334 { … … 2339 2339 } 2340 2340 } 2341 2341 2342 2342 /* Kill last space. */ 2343 2343 if (doneany) 2344 2344 --o; 2345 2345 } 2346 2346 2347 2347 return o; 2348 2348 } … … 2668 2668 2669 2669 comp-cmds will compare command by command, ignoring not only leading 2670 and trailing spaces on each line but also leading one leading '@', 2670 and trailing spaces on each line but also leading one leading '@', 2671 2671 '-', '+' and '%' 2672 2672 */ … … 2795 2795 $(comp-cmds-ex cmds1,cmds2,not-equal-return) 2796 2796 2797 Compares the two strings and return the string in the third argument 2797 Compares the two strings and return the string in the third argument 2798 2798 if not equal. If equal, nothing is returned. 2799 2799 2800 The comparision will be performed command by command, ignoring not 2801 only leading and trailing spaces on each line but also leading one 2800 The comparision will be performed command by command, ignoring not 2801 only leading and trailing spaces on each line but also leading one 2802 2802 leading '@', '-', '+' and '%'. 2803 2803 */ … … 3000 3000 struct variable *path_var; 3001 3001 unsigned i; 3002 int first = 1; 3002 3003 PATH_VAR (buf); 3003 3004 … … 3055 3056 if (func_which_test_x (buf)) 3056 3057 { 3058 if (!first) 3059 o = variable_buffer_output (o, " ", 1); 3057 3060 o = variable_buffer_output (o, buf, strlen (buf)); 3061 first = 0; 3058 3062 break; 3059 3063 } … … 3581 3585 if (!argv[0] || (!argv[0][0] && !argv[1])) 3582 3586 { 3583 len = sprintf (buf, "alloc-cur: %5lu %6luKB (/%3luMB) hash: %5lu %2lu%%", 3584 make_stats_allocations, 3585 make_stats_allocated / 1024, 3586 make_stats_allocated_sum / (1024*1024), 3587 len = sprintf (buf, "alloc-cur: %5lu %6luKB (/%3luMB) hash: %5lu %2lu%%", 3588 make_stats_allocations, 3589 make_stats_allocated / 1024, 3590 make_stats_allocated_sum / (1024*1024), 3587 3591 make_stats_ht_lookups, 3588 3592 (make_stats_ht_collisions * 100) / make_stats_ht_lookups); … … 3590 3594 } 3591 3595 else 3592 { 3596 { 3593 3597 /* selective */ 3594 3598 int i; … … 3611 3615 val = (make_stats_ht_collisions * 100) / make_stats_ht_lookups; 3612 3616 else 3613 { 3617 { 3614 3618 o = variable_buffer_output (o, argv[i], strlen (argv[i])); 3615 3619 continue; … … 3626 3630 #ifdef CONFIG_WITH_COMMANDS_FUNC 3627 3631 /* Gets all the commands for a target, separated by newlines. 3628 3632 3629 3633 This is useful when creating and checking target dependencies since 3630 3634 it reduces the amount of work and the memory consuption. A new prefix 3631 character '%' has been introduced for skipping certain lines, like 3635 character '%' has been introduced for skipping certain lines, like 3632 3636 for instance the one calling this function and pushing to a dep file. 3633 3637 Blank lines are also skipped. 3634 3638 3635 The commands function takes exactly one argument, which is the name of 3636 the target which commands should be returned. 3637 3638 The commands-sc is identical to commands except that it uses a ';' to 3639 The commands function takes exactly one argument, which is the name of 3640 the target which commands should be returned. 3641 3642 The commands-sc is identical to commands except that it uses a ';' to 3639 3643 separate the commands. 3640 3644 … … 3678 3682 chop_commands (cmds); 3679 3683 3680 for (i = 0; i < cmds->ncommand_lines; i++) 3684 for (i = 0; i < cmds->ncommand_lines; i++) 3681 3685 { 3682 3686 char *p; … … 3689 3693 while (isblank ((unsigned char)*p)) 3690 3694 p++; 3691 if (*p == '\0') 3695 if (*p == '\0') 3692 3696 continue; 3693 3697 … … 3794 3798 /* Skip it if it has a '%' prefix or is blank. */ 3795 3799 p = o; 3796 while (isblank ((unsigned char)*o) 3800 while (isblank ((unsigned char)*o) 3797 3801 || *o == '@' 3798 3802 || *o == '-' … … 4204 4208 /* Expand the body in the context of the arguments, adding the result to 4205 4209 the variable buffer. */ 4206 4210 4207 4211 v->exp_count = EXP_COUNT_MAX; 4208 4212 o = variable_expand_string (o, body, flen+3); … … 4218 4222 if (!strcmp (funcname, "evalcall")) 4219 4223 { 4220 /* Evaluate the variable value without expanding it. We 4224 /* Evaluate the variable value without expanding it. We 4221 4225 need a copy since eval_buffer is destructive. */ 4222 4226
Note:
See TracChangeset
for help on using the changeset viewer.