From 8d7b3fda16e6f652e079433ef7653537cdcbe6d1 Mon Sep 17 00:00:00 2001
From: Sebastian Lackner <sebastian@fds-team.de>
Date: Wed, 17 Dec 2014 04:11:58 +0100
Subject: makedep: Add support for PARENTSPEC Makefile variable.

---
 tools/makedep.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index e1897bc..5540b91 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -169,6 +169,7 @@ struct makefile
     const char     *top_src_dir;
     const char     *top_obj_dir;
     const char     *parent_dir;
+    const char     *parent_spec;
     const char     *module;
     const char     *testdll;
     const char     *sharedlib;
@@ -2541,7 +2542,12 @@ static struct strarray output_sources( const struct makefile *make )
         char *spec_file = NULL;
 
         if (!make->appmode.count)
-            spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" ));
+        {
+            if (!make->parent_spec)
+                spec_file = src_dir_path( make, replace_extension( make->module, ".dll", ".spec" ));
+            else
+                spec_file = src_dir_path( make, make->parent_spec );
+        }
         strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->delayimports, 0 ));
         strarray_addall( &all_libs, add_import_libs( make, &dep_libs, make->imports, 0 ));
         add_import_libs( make, &dep_libs, get_default_imports( make ), 0 );  /* dependencies only */
@@ -3252,6 +3258,7 @@ static void load_sources( struct makefile *make )
     strarray_set_value( &make->vars, "srcdir", src_dir_path( make, "" ));
 
     make->parent_dir    = get_expanded_make_variable( make, "PARENTSRC" );
+    make->parent_spec   = get_expanded_make_variable( make, "PARENTSPEC" );
     make->module        = get_expanded_make_variable( make, "MODULE" );
     make->testdll       = get_expanded_make_variable( make, "TESTDLL" );
     make->sharedlib     = get_expanded_make_variable( make, "SHAREDLIB" );
-- 
2.7.1

