diff --git a/Source/kwsys/System.c b/Source/kwsys/System.c index 41d6667cc..0446b79f6 100644 --- a/Source/kwsys/System.c +++ b/Source/kwsys/System.c @@ -60,7 +60,9 @@ static int kwsysSystem_Shell__CharIsWhitespace(char c) static int kwsysSystem_Shell__CharNeedsQuotesOnUnix(char c) { return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') || - (c == '&') || (c == '$') || (c == '(') || (c == ')')); + (c == '&') || (c == '$') || (c == '(') || (c == ')') || + (c == '~') || (c == '<') || (c == '>') || (c == '|') || + (c == '*') || (c == '\\')); } /*--------------------------------------------------------------------------*/ @@ -289,10 +291,12 @@ static int kwsysSystem_Shell__GetArgumentSize(const char* in, } else if(*c == '%') { - if(flags & kwsysSystem_Shell_Flag_VSIDE) + if((flags & kwsysSystem_Shell_Flag_VSIDE) || + ((flags & kwsysSystem_Shell_Flag_Make) && + (flags & kwsysSystem_Shell_Flag_MinGWMake))) { - /* In a VS IDE a percent is written %% so we need one extra - characters. */ + /* In the VS IDE or MinGW make a percent is written %% so we + need one extra characters. */ size += 1; } } @@ -443,9 +447,11 @@ static char* kwsysSystem_Shell__GetArgument(const char* in, char* out, } else if(*c == '%') { - if(flags & kwsysSystem_Shell_Flag_VSIDE) + if((flags & kwsysSystem_Shell_Flag_VSIDE) || + ((flags & kwsysSystem_Shell_Flag_Make) && + (flags & kwsysSystem_Shell_Flag_MinGWMake))) { - /* In a VS IDE a percent is written %%. */ + /* In the VS IDE or MinGW make a percent is written %%. */ *out++ = '%'; *out++ = '%'; } diff --git a/Source/kwsys/System.h.in b/Source/kwsys/System.h.in index 95a454cca..b19026211 100644 --- a/Source/kwsys/System.h.in +++ b/Source/kwsys/System.h.in @@ -33,6 +33,7 @@ #define kwsysSystem_Shell_Flag_VSIDE kwsys_ns(System_Shell_Flag_VSIDE) #define kwsysSystem_Shell_Flag_EchoWindows kwsys_ns(System_Shell_Flag_EchoWindows) #define kwsysSystem_Shell_Flag_WatcomWMake kwsys_ns(System_Shell_Flag_WatcomWMake) +#define kwsysSystem_Shell_Flag_MinGWMake kwsys_ns(System_Shell_Flag_MinGWMake) #define kwsysSystem_Shell_Flag_AllowMakeVariables kwsys_ns(System_Shell_Flag_AllowMakeVariables) #if defined(__cplusplus) @@ -86,12 +87,15 @@ enum kwsysSystem_Shell_Flag_e /** The target shell is in a Watcom WMake makefile. */ kwsysSystem_Shell_Flag_WatcomWMake = (1<<3), + /** The target shell is in a MinGW Make makefile. */ + kwsysSystem_Shell_Flag_MinGWMake = (1<<4), + /** Make variable reference syntax $(MAKEVAR) should not be escaped to allow a build tool to replace it. Replacement values containing spaces, quotes, backslashes, or other non-alphanumeric characters that have significance to some makes or shells produce undefined behavior. */ - kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<4) + kwsysSystem_Shell_Flag_AllowMakeVariables = (1<<5) }; #if defined(__cplusplus) @@ -112,6 +116,7 @@ enum kwsysSystem_Shell_Flag_e # undef kwsysSystem_Shell_Flag_VSIDE # undef kwsysSystem_Shell_Flag_EchoWindows # undef kwsysSystem_Shell_Flag_WatcomWMake +# undef kwsysSystem_Shell_Flag_MinGWMake # undef kwsysSystem_Shell_Flag_AllowMakeVariables #endif