From cab558b4bd0cad658dd14ec53fda076851a5e16b Mon Sep 17 00:00:00 2001 From: Alexandre Julliard Date: Thu, 26 Dec 2013 19:26:37 +0100 Subject: [PATCH] makedep: Allow overriding makefile variables through the MAKEFLAGS environment variable. --- tools/makedep.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/tools/makedep.c b/tools/makedep.c index f347d90edc6..2cb32b95b53 100644 --- a/tools/makedep.c +++ b/tools/makedep.c @@ -1837,6 +1837,29 @@ static void update_makefile( const char *path ) } +/******************************************************************* + * parse_makeflags + */ +static void parse_makeflags( const char *flags ) +{ + const char *p = flags; + char *var, *buffer = xmalloc( strlen(flags) + 1 ); + + while (*p) + { + while (isspace(*p)) p++; + var = buffer; + while (*p && !isspace(*p)) + { + if (*p == '\\' && p[1]) p++; + *var++ = *p++; + } + *var = 0; + if (var > buffer) set_make_variable( &cmdline_vars, buffer ); + } +} + + /******************************************************************* * parse_option */ @@ -1893,9 +1916,12 @@ static int parse_option( const char *opt ) */ int main( int argc, char *argv[] ) { + const char *makeflags = getenv( "MAKEFLAGS" ); struct incl_file *pFile; int i, j; + if (makeflags) parse_makeflags( makeflags ); + i = 1; while (i < argc) {