Changeset 1989 for vendor/gnumake/current/job.c
- Timestamp:
- Oct 29, 2008, 12:02:45 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/gnumake/current/job.c
r900 r1989 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" … … 1023 1023 argv = p; 1024 1024 #else 1025 argv = construct_command_argv (p, &end, child->file, &child->sh_batch_file); 1025 argv = construct_command_argv (p, &end, child->file, 1026 child->file->cmds->lines_flags[child->command_line - 1], 1027 &child->sh_batch_file); 1026 1028 #endif 1027 1029 if (end == NULL) … … 1729 1731 1730 1732 /* The job is now primed. Start it running. 1731 (This will notice if there are in fact no commands.) */1733 (This will notice if there is in fact no recipe.) */ 1732 1734 if (cmds->fileinfo.filenm) 1733 DB (DB_BASIC, (_("Invoking commandsfrom %s:%lu to update target `%s'.\n"),1735 DB (DB_BASIC, (_("Invoking recipe from %s:%lu to update target `%s'.\n"), 1734 1736 cmds->fileinfo.filenm, cmds->fileinfo.lineno, 1735 1737 c->file->name)); 1736 1738 else 1737 DB (DB_BASIC, (_("Invoking builtin commandsto update target `%s'.\n"),1739 DB (DB_BASIC, (_("Invoking builtin recipe to update target `%s'.\n"), 1738 1740 c->file->name)); 1739 1741 … … 1908 1910 1909 1911 /* EMX: Start a child process. This function returns the new pid. */ 1910 # if defined __ MSDOS__ || defined __EMX__1912 # if defined __EMX__ 1911 1913 int 1912 1914 child_execute_job (int stdin_fd, int stdout_fd, char **argv, char **envp) … … 2211 2213 2212 2214 SHELL is the shell to use, or nil to use the default shell. 2213 IFS is the value of $IFS, or nil (meaning the default). */ 2215 IFS is the value of $IFS, or nil (meaning the default). 2216 2217 FLAGS is the value of lines_flags for this command line. It is 2218 used in the WINDOWS32 port to check whether + or $(MAKE) were found 2219 in this command line, in which case the effect of just_print_flag 2220 is overridden. */ 2214 2221 2215 2222 static char ** 2216 2223 construct_command_argv_internal (char *line, char **restp, char *shell, 2217 char *ifs, char **batch_filename_ptr) 2224 char *ifs, int flags, 2225 char **batch_filename_ptr) 2218 2226 { 2219 2227 #ifdef __MSDOS__ … … 2464 2472 *(ap++) = *p; 2465 2473 } 2466 /* If there's a command prefix char here, skip it. */2467 if (p[1] == cmd_prefix)2468 ++p;2469 2474 } 2470 2475 else if (*p == '\n' && restp != NULL) … … 2514 2519 ++p; 2515 2520 2516 /* If there is a command prefix after a backslash-newline,2517 remove it. */2518 if (p[1] == cmd_prefix)2519 ++p;2520 2521 2521 /* If there's nothing in this argument yet, skip any 2522 2522 whitespace before the start of the next word. */ … … 2746 2746 else if (*p == '\\' && p[1] == '\n') 2747 2747 { 2748 /* POSIX says we keep the backslash-newline, but throw out 2749 the next char if it's a TAB. If we don't have a POSIX 2750 shell on DOS/Windows/OS2, mimic the pre-POSIX behavior 2748 /* POSIX says we keep the backslash-newline. If we don't have a 2749 POSIX shell on DOS/Windows/OS2, mimic the pre-POSIX behavior 2751 2750 and remove the backslash/newline. */ 2752 2751 #if defined (__MSDOS__) || defined (__EMX__) || defined (WINDOWS32) … … 2758 2757 { 2759 2758 *(ap++) = '\\'; 2760 *(ap++) = '\\'; 2759 /* Only non-batch execution needs another backslash, 2760 because it will be passed through a recursive 2761 invocation of this function. */ 2762 if (!batch_mode_shell) 2763 *(ap++) = '\\'; 2761 2764 *(ap++) = '\n'; 2762 2765 } 2763 2764 2766 ++p; 2765 if (p[1] == cmd_prefix)2766 ++p;2767 2768 2767 continue; 2769 2768 } … … 2795 2794 command line (e.g. Cygnus GNUWIN32 sh.exe on WIN32 systems). In these 2796 2795 cases, run commands via a script file. */ 2797 if (just_print_flag ) {2796 if (just_print_flag && !(flags & COMMANDS_RECURSE)) { 2798 2797 /* Need to allocate new_argv, although it's unused, because 2799 2798 start_job_command will want to free it and its 0'th element. */ … … 2823 2822 fputc ('\n', batch); 2824 2823 fclose (batch); 2824 DB (DB_JOBS, (_("Batch file contents:%s\n\t%s\n"), 2825 !unixy_shell ? "\n\t@echo off" : "", command_ptr)); 2825 2826 2826 2827 /* create argv */ … … 2837 2838 #endif /* WINDOWS32 */ 2838 2839 if (unixy_shell) 2839 new_argv = construct_command_argv_internal (new_line, 0, 0, 0, 0);2840 new_argv = construct_command_argv_internal (new_line, 0, 0, 0, flags, 0); 2840 2841 #ifdef __EMX__ 2841 2842 else if (!unixy_shell) … … 2852 2853 { 2853 2854 if (q[0] == '\\' && q[1] == '\n') 2854 { 2855 q += 2; /* remove '\\' and '\n' */ 2856 /* Remove any command prefix in the next line */ 2857 if (q[0] == cmd_prefix) 2858 q++; 2859 } 2855 q += 2; /* remove '\\' and '\n' */ 2860 2856 else 2861 2857 *p++ = *q++; … … 2948 2944 char ** 2949 2945 construct_command_argv (char *line, char **restp, struct file *file, 2950 char **batch_filename_ptr)2946 int cmd_flags, char **batch_filename_ptr) 2951 2947 { 2952 2948 char *shell, *ifs; … … 3060 3056 } 3061 3057 3062 argv = construct_command_argv_internal (line, restp, shell, ifs, batch_filename_ptr); 3058 argv = construct_command_argv_internal (line, restp, shell, ifs, 3059 cmd_flags, batch_filename_ptr); 3063 3060 3064 3061 free (shell);
Note:
See TracChangeset
for help on using the changeset viewer.