From dbe1b719f8037dda23279b8bc7d8200578415e15 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 4 Mar 2011 11:26:33 +0000 Subject: Implement eval sort warning functions (see gnu make manual for description) Solved errors in if and foreach implementations Removed message and reparse function (use info and eval instead) $n can be used to add new line define can be used to specify multi-line macros Solved error in argument expansion in call function --- tools/mhmake/src/build.cpp | 70 +++++++++++++++++++++++++++++++++++++--------- 1 file changed, 57 insertions(+), 13 deletions(-) (limited to 'tools/mhmake/src/build.cpp') diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp index 682a98410..5976a8632 100644 --- a/tools/mhmake/src/build.cpp +++ b/tools/mhmake/src/build.cpp @@ -400,14 +400,33 @@ mh_pid_t mhmakefileparser::MakeDirsCommand(const string &Params) const } /*****************************************************************************/ -mh_pid_t mhmakefileparser::EchoCommand(const string &Params) const +static string RemoveQuotes(const string &StrIn) { + char FirstChar=StrIn[0]; + string Ret=StrIn; + if (FirstChar=='"') + { + int Len=Ret.length()-1; + if (Ret[Len]=='"') + Ret=Ret.substr(1,Len-1); + } + else if (FirstChar=='\'') + { + int Len=Ret.length()-1; + if (Ret[Len]=='\'') + Ret=Ret.substr(1,Len-1); + } + return Ret; +} +mh_pid_t mhmakefileparser::EchoCommand(const string &ParamsIn) const +{ + string Params=f_strip(ParamsIn); // Find the first > character size_t Pos=Params.find_first_of('>'); if (Pos==string::npos) { // Just echo it - cout << Params << endl; + cout << RemoveQuotes(Params) << endl; } else { @@ -432,9 +451,7 @@ mh_pid_t mhmakefileparser::EchoCommand(const string &Params) const cerr << "Error opening file "<::iterator pFound=m_CommandCache.find(Command); - string OriCommand=Command; + map::iterator pFound=m_CommandCache.find(CommandIn); + string Command=CommandIn; if (pFound==m_CommandCache.end()) { bool Found=false; @@ -688,11 +723,10 @@ string mhmakefileparser::GetFullCommand(string Command) } else { - static bool s_Py2ExeInstalled=true; /* First check for special internal commands */ - if (OriCommand=="del") + if (CommandIn=="del") { - m_CommandCache[OriCommand]="del"; + m_CommandCache[CommandIn]="del"; return Command; } // Try with different extensions @@ -710,13 +744,23 @@ string mhmakefileparser::GetFullCommand(string Command) Found=true; Command=GetPythonExe()+QuoteFileName(FullCommand); } + else + { + // also search without extension, if found look inside the file if we find an executable to use + FullCommand=SearchCommand(Command); + if (!FullCommand.empty()) + { + Found=true; + Command=GetExecutableFromCommand(FullCommand)+QuoteFileName(FullCommand); + } + } } } if (!Found) { Command=GetComspec()+QuoteFileName(Command); } - m_CommandCache[OriCommand]=Command; + m_CommandCache[CommandIn]=Command; return Command; } return pFound->second; @@ -1374,7 +1418,7 @@ mh_time_t mhmakefileparser::StartBuildTarget(fileinfo* pTarget,bool bCheckTarget mh_time_t TargetDate=pTarget->GetDate(); mh_time_t YoungestDate=TargetDate; - bool MakeTarget=!TargetDate.DoesExist(); + bool MakeTarget=!TargetDate.DoesExist(); // When the target does not exist, always build when a rule is found. This also makes sure the autodepscan will be done in case the target does not exist yet if (!pRule || !pRule->GetCommands().size()) { -- cgit v1.2.3