From f7b6403a13075049d9577e6f061b6d7f718d3ca9 Mon Sep 17 00:00:00 2001
From: marha <marha@users.sourceforge.net>
Date: Mon, 18 Oct 2010 06:31:05 +0000
Subject: Also rebuild everything if one of the exported variables is changed

---
 tools/mhmake/src/mhmakefileparser.cpp | 15 +++++++++++++++
 tools/mhmake/src/mhmakefileparser.h   |  1 +
 tools/mhmake/src/mhmakeparser.y       |  2 +-
 tools/mhmake/src/util.h               |  2 +-
 4 files changed, 18 insertions(+), 2 deletions(-)

(limited to 'tools/mhmake/src')

diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp
index 5236d58ee..8c75f78f7 100644
--- a/tools/mhmake/src/mhmakefileparser.cpp
+++ b/tools/mhmake/src/mhmakefileparser.cpp
@@ -918,6 +918,7 @@ bool mhmakefileparser::SkipHeaderFile(const string &FileName)
 ///////////////////////////////////////////////////////////////////////////////
 void mhmakefileparser::SetExport(const string &Var, const string &Val)
 {
+  m_Exports.insert(Var);
 #ifdef WIN32
   if (!m_pEnv)
   {
@@ -1170,6 +1171,20 @@ void mhmakefileparser::CreateUSED_ENVVARS()
     It++;
   }
 
+  It=m_Exports.begin();
+  ItEnd=m_Exports.end();
+
+  while (It!=ItEnd)
+  {
+    string Var=*It;
+    if (!SkipVar(Var))
+    {
+      transform(Var.begin(),Var.end(),Var.begin(),(int(__CDECL *)(int))toupper);
+      Variables.insert(Var);
+    }
+    It++;
+  }
+
   map<string,string>::const_iterator CLItEnd=loadedmakefile::sm_Statics.m_GlobalCommandLineVars.end();
   map<string,string>::const_iterator CLIt=loadedmakefile::sm_Statics.m_GlobalCommandLineVars.begin();
   while (CLIt!=CLItEnd)
diff --git a/tools/mhmake/src/mhmakefileparser.h b/tools/mhmake/src/mhmakefileparser.h
index 19bb403e3..6ae19bf62 100644
--- a/tools/mhmake/src/mhmakefileparser.h
+++ b/tools/mhmake/src/mhmakefileparser.h
@@ -95,6 +95,7 @@ protected:
   bool                  m_RebuildAll; /* true when to rebuild all targets of this makefile */
 
   set<string>           m_UsedEnvVars;     // Array containing a list of variables that are taken from the environment (This is used for rebuild checking)
+  set<string>           m_Exports;         // Array containing a list of exported variables in the makefile (This is used for rebuild checking)
 #ifdef WIN32
   char                 *m_pEnv;            // New environment in case the makefile exports variables
 #else
diff --git a/tools/mhmake/src/mhmakeparser.y b/tools/mhmake/src/mhmakeparser.y
index c11c84319..107194d70 100644
--- a/tools/mhmake/src/mhmakeparser.y
+++ b/tools/mhmake/src/mhmakeparser.y
@@ -190,7 +190,7 @@ imvarassignment: STRING IMEQUAL maybeemptyexpression
 pvarassignment: STRING PEQUAL maybeemptyexpression
                {
                  m_Variables[$1]=m_Variables[$1]+g_SpaceString+$3;
-                 PRINTF(("Setting variable %s to %s\n",$1.c_str(), $3.c_str()));
+                 PRINTF(("Adding to variable %s: %s\n",$1.c_str(), $3.c_str()));
                }
 ;
 
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index 6e8e7c9eb..9b49cf489 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
 #define PLATFORM     "linux"
 #endif
 
-#define MHMAKEVER    "2.2.4"
+#define MHMAKEVER    "2.2.5"
 
 class makecommand
 {
-- 
cgit v1.2.3