From 0ca9f8bf78340991e99d8f020c5f04d2029a4177 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 | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tools/makedep.c b/tools/makedep.c
index 54aab45..d68bc03 100644
--- a/tools/makedep.c
+++ b/tools/makedep.c
@@ -162,4 +162,5 @@ struct makefile
     const char     *top_obj_dir;
     const char     *parent_dir;
+    const char     *parent_spec;
     const char     *module;
     const char     *testdll;
@@ -2081,7 +2082,13 @@ static struct strarray output_sources( struct makefile *make, struct strarray *t
         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 );
+        }
+
         for (i = 0; i < make->delayimports.count; i++)
             strarray_add( &all_libs, strmake( "-l%s", make->delayimports.str[i] ));
         for (i = 0; i < make->imports.count; i++)
@@ -2598,4 +2605,5 @@ static void update_makefile( const char *path )
 
     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" );
-- 
2.1.3

