From 75ef19188d021a5e965198bde774c1c33bedc1f3 Mon Sep 17 00:00:00 2001 From: marha Date: Sat, 30 Oct 2010 18:34:27 +0000 Subject: Increased gnu make compatibility. --- tools/mhmake/src/rule.h | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) (limited to 'tools/mhmake/src/rule.h') diff --git a/tools/mhmake/src/rule.h b/tools/mhmake/src/rule.h index 1ec944f96..3b288e3d2 100644 --- a/tools/mhmake/src/rule.h +++ b/tools/mhmake/src/rule.h @@ -23,17 +23,17 @@ #include "refptr.h" #include "md5.h" -class mhmakeparser; +class mhmakefileparser; class fileinfo; class rule: public refbase { vector m_Commands; string m_Stem; // Contains the stem in case the rule is part of an implicit rule (filled in in the implicit search) - mhmakeparser* m_pMakefile; + mhmakefileparser* m_pMakefile; vector< fileinfo* > m_Targets; /* Targets that are build with this rule, do not use refptr here because otherwise we get circular references */ public: - rule(mhmakeparser *pMakefile): m_pMakefile(pMakefile) + rule(mhmakefileparser *pMakefile): m_pMakefile(pMakefile) { } @@ -56,11 +56,11 @@ public: { return m_Stem; } - void SetMakefile(mhmakeparser *pMakefile) + void SetMakefile(mhmakefileparser *pMakefile) { m_pMakefile=pMakefile; } - mhmakeparser *GetMakefile() + mhmakefileparser *GetMakefile() { return m_pMakefile; } @@ -76,11 +76,29 @@ public: class IMPLICITRULE { + static set m_ImplicitRuleRecurseDetStack; static vector > > > > m_ImplicitRules; // Use a vector and not a map because the order of the implicit rules is important public: static void AddImplicitRule(fileinfo *pTarget,const vector &Deps,refptr pRule); static void SearchImplicitRule(const fileinfo *pTarget,vector< pair > >&Result); static void PrintImplicitRules(); + static bool PushRule(rule *pRule) + { + set::iterator pFound=m_ImplicitRuleRecurseDetStack.find(pRule); + if (pFound==m_ImplicitRuleRecurseDetStack.end()) + { + m_ImplicitRuleRecurseDetStack.insert(pRule); + return false; + } + else + { + return true; + } + } + static void PopRule(rule *pRule) + { + m_ImplicitRuleRecurseDetStack.erase(pRule); + } }; extern refptr NullRule; -- cgit v1.2.3