From 26cdc4c8be3a1377439b5fe937d38dc16cbb4e90 Mon Sep 17 00:00:00 2001
From: Zebediah Figura <z.figura12@gmail.com>
Date: Wed, 18 Sep 2019 19:16:08 -0500
Subject: [PATCH 2/2] makefiles: Only apply non-include-path EXTRAINCL flags to
 C sources.

On my system pkg-config generates '-pthread' for gtk-3, which trips up wrc otherwise.
---
 tools/makedep.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index e37bd8d63..ad8de5590 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -172,6 +172,7 @@ struct makefile
     struct strarray include_paths;
     struct strarray include_args;
     struct strarray define_args;
+    struct strarray extraincl_args;
     struct strarray programs;
     struct strarray scripts;
     struct strarray imports;
@@ -3036,6 +3037,7 @@ static void output_source_default( struct makefile *make, struct incl_file *sour
             if (source->use_msvcrt) output_filenames( msvcrt_flags );
         }
         output_filenames( extra_cflags );
+        output_filenames( make->extraincl_args );
         output_filenames( cpp_flags );
         output_filename( "$(CFLAGS)" );
         output( "\n" );
@@ -4181,6 +4183,7 @@ static void load_sources( struct makefile *make )
     make->include_paths = empty_strarray;
     make->include_args = empty_strarray;
     make->define_args = empty_strarray;
+    make->extraincl_args = empty_strarray;
     strarray_add( &make->define_args, "-D__WINESRC__" );
 
     value = get_expanded_make_var_array( make, "EXTRAINCL" );
@@ -4188,7 +4191,7 @@ static void load_sources( struct makefile *make )
         if (!strncmp( value.str[i], "-I", 2 ))
             strarray_add_uniq( &make->include_paths, value.str[i] + 2 );
         else
-            strarray_add_uniq( &make->define_args, value.str[i] );
+            strarray_add_uniq( &make->extraincl_args, value.str[i] );
     strarray_addall( &make->define_args, get_expanded_make_var_array( make, "EXTRADEFS" ));
 
     strarray_add( &make->include_args, strmake( "-I%s", obj_dir_path( make, "" )));
-- 
2.23.0

