Changeset 1993 for trunk/src/kmk/job.c
- Timestamp:
- Oct 29, 2008, 1:37:51 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kmk/job.c
r1980 r1993 1 1 /* Job execution and handling for GNU Make. 2 2 Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software3 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007 Free Software 4 4 Foundation, Inc. 5 5 This file is part of GNU Make. … … 7 7 GNU Make is free software; you can redistribute it and/or modify it under the 8 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. 9 Foundation; either version 3 of the License, or (at your option) any later 10 version. 10 11 11 12 GNU Make is distributed in the hope that it will be useful, but WITHOUT ANY … … 14 15 15 16 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. */ 17 this program. If not, see <http://www.gnu.org/licenses/>. */ 18 18 19 19 #include "make.h" … … 1091 1091 argv = p; 1092 1092 #else 1093 argv = construct_command_argv (p, &end, child->file, &child->sh_batch_file); 1093 argv = construct_command_argv (p, &end, child->file, 1094 child->file->cmds->lines_flags[child->command_line - 1], 1095 &child->sh_batch_file); 1094 1096 #endif 1095 1097 if (end == NULL) … … 1566 1568 struct file *f = c->file; 1567 1569 #ifdef DB_KMK 1568 DB (DB_KMK, (_("start_waiting_job %p (`%s') command_flags=%#x slots=%d/%d\n"), c, c->file->name, c->file->command_flags, job_slots_used, job_slots)); 1570 DB (DB_KMK, (_("start_waiting_job %p (`%s') command_flags=%#x slots=%d/%d\n"), 1571 (void *)c, c->file->name, c->file->command_flags, job_slots_used, job_slots)); 1569 1572 #endif 1570 1573 … … 1579 1582 { 1580 1583 DB (DB_KMK, (_("not_parallel %d -> %d (file=%p `%s') [start_waiting_job]\n"), 1581 not_parallel, not_parallel + 1, c->file, c->file->name));1584 not_parallel, not_parallel + 1, (void *)c->file, c->file->name)); 1582 1585 assert(not_parallel >= 0); 1583 1586 ++not_parallel; … … 1621 1624 else /* FIXME: insert after the last node with COMMANDS_NOTPARALLEL set */ 1622 1625 waiting_jobs = c; 1623 DB (DB_KMK, (_("queued child %p (`%s')\n"), c, c->file->name));1626 DB (DB_KMK, (_("queued child %p (`%s')\n"), (void *)c, c->file->name)); 1624 1627 #endif /* CONFIG_WITH_EXTENDED_NOTPARALLEL */ 1625 1628 return 0; … … 1905 1908 1906 1909 /* The job is now primed. Start it running. 1907 (This will notice if there are in fact no commands.) */1910 (This will notice if there is in fact no recipe.) */ 1908 1911 if (cmds->fileinfo.filenm) 1909 DB (DB_BASIC, (_("Invoking commandsfrom %s:%lu to update target `%s'.\n"),1912 DB (DB_BASIC, (_("Invoking recipe from %s:%lu to update target `%s'.\n"), 1910 1913 cmds->fileinfo.filenm, cmds->fileinfo.lineno, 1911 1914 c->file->name)); 1912 1915 else 1913 DB (DB_BASIC, (_("Invoking builtin commandsto update target `%s'.\n"),1916 DB (DB_BASIC, (_("Invoking builtin recipe to update target `%s'.\n"), 1914 1917 c->file->name)); 1915 1918 … … 2118 2121 2119 2122 /* EMX: Start a child process. This function returns the new pid. */ 2120 # if defined __ MSDOS__ || defined __EMX__2123 # if defined __EMX__ 2121 2124 int 2122 2125 child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp) … … 2421 2424 2422 2425 SHELL is the shell to use, or nil to use the default shell. 2423 IFS is the value of $IFS, or nil (meaning the default). */ 2426 IFS is the value of $IFS, or nil (meaning the default). 2427 2428 FLAGS is the value of lines_flags for this command line. It is 2429 used in the WINDOWS32 port to check whether + or $(MAKE) were found 2430 in this command line, in which case the effect of just_print_flag 2431 is overridden. */ 2424 2432 2425 2433 static char ** 2426 2434 construct_command_argv_internal (char *line, char **restp, char *shell, 2427 char *ifs, char **batch_filename_ptr) 2435 char *ifs, int flags, 2436 char **batch_filename_ptr) 2428 2437 { 2429 2438 #ifdef __MSDOS__ … … 2719 2728 *(ap++) = *p; 2720 2729 } 2721 /* If there's a command prefix char here, skip it. */2722 if (p[1] == cmd_prefix)2723 ++p;2724 2730 } 2725 2731 else if (*p == '\n' && restp != NULL) … … 2787 2793 ++p; 2788 2794 2789 /* If there is a command prefix after a backslash-newline,2790 remove it. */2791 if (p[1] == cmd_prefix)2792 ++p;2793 2794 2795 /* If there's nothing in this argument yet, skip any 2795 2796 whitespace before the start of the next word. */ … … 3024 3025 else if (*p == '\\' && p[1] == '\n') 3025 3026 { 3026 /* POSIX says we keep the backslash-newline, but throw out 3027 the next char if it's a TAB. If we don't have a POSIX 3028 shell on DOS/Windows/OS2, mimic the pre-POSIX behavior 3027 /* POSIX says we keep the backslash-newline. If we don't have a 3028 POSIX shell on DOS/Windows/OS2, mimic the pre-POSIX behavior 3029 3029 and remove the backslash/newline. */ 3030 3030 #if defined (__MSDOS__) || defined (__EMX__) || defined (WINDOWS32) … … 3036 3036 { 3037 3037 *(ap++) = '\\'; 3038 #ifdef KMK /* see test in Makefile.kmk, required on windows. */ 3039 if (!batch_mode_shell) 3040 #endif 3041 *(ap++) = '\\'; 3038 /* Only non-batch execution needs another backslash, 3039 because it will be passed through a recursive 3040 invocation of this function. */ 3041 if (!batch_mode_shell) 3042 *(ap++) = '\\'; 3042 3043 *(ap++) = '\n'; 3043 3044 } 3044 3045 3045 ++p; 3046 if (p[1] == cmd_prefix)3047 ++p;3048 3049 3046 continue; 3050 3047 } … … 3076 3073 command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these 3077 3074 cases, run commands via a script file. */ 3078 if (just_print_flag ) {3075 if (just_print_flag && !(flags & COMMANDS_RECURSE)) { 3079 3076 /* Need to allocate new_argv, although it's unused, because 3080 3077 start_job_command will want to free it and its 0'th element. */ … … 3109 3106 fputc ('\n', batch); 3110 3107 fclose (batch); 3108 DB (DB_JOBS, (_("Batch file contents:%s\n\t%s\n"), 3109 !unixy_shell ? "\n\t@echo off" : "", command_ptr)); 3111 3110 3112 3111 /* create argv */ … … 3123 3122 #endif /* WINDOWS32 */ 3124 3123 if (unixy_shell) 3125 new_argv = construct_command_argv_internal (new_line, 0, 0, 0, 0);3124 new_argv = construct_command_argv_internal (new_line, 0, 0, 0, flags, 0); 3126 3125 #ifdef __EMX__ 3127 3126 else if (!unixy_shell) … … 3138 3137 { 3139 3138 if (q[0] == '\\' && q[1] == '\n') 3140 { 3141 q += 2; /* remove '\\' and '\n' */ 3142 /* Remove any command prefix in the next line */ 3143 if (q[0] == cmd_prefix) 3144 q++; 3145 } 3139 q += 2; /* remove '\\' and '\n' */ 3146 3140 else 3147 3141 *p++ = *q++; … … 3234 3228 char ** 3235 3229 construct_command_argv (char *line, char **restp, struct file *file, 3236 char **batch_filename_ptr)3230 int cmd_flags, char **batch_filename_ptr) 3237 3231 { 3238 3232 char *shell, *ifs; … … 3366 3360 unixy_shell = 1; 3367 3361 batch_mode_shell = 0; 3368 argv = construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr); 3362 argv = construct_command_argv_internal (line, restp, shell, ifs, 3363 cmd_flags, batch_filename_ptr); 3369 3364 batch_mode_shell = saved_batch_mode_shell; 3370 3365 unixy_shell = saved_unixy_shell; … … 3375 3370 else 3376 3371 #endif /* CONFIG_WITH_KMK_BUILTIN */ 3377 argv = construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr); 3372 argv = construct_command_argv_internal (line, restp, shell, ifs, 3373 cmd_flags, batch_filename_ptr); 3378 3374 3379 3375 free (shell);
Note:
See TracChangeset
for help on using the changeset viewer.