From 58b69e7eb9be29c60e45d46a880b391e3809e76f Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 18 Sep 2009 14:46:17 +0000 Subject: Changes for making it possible to have spaces in the MHMAKECONF environment variable. --- tools/mhmake/src/mhmakefileparser.cpp | 42 ++++++++++++++++++++--------------- 1 file changed, 24 insertions(+), 18 deletions(-) (limited to 'tools/mhmake/src/mhmakefileparser.cpp') diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp index cbcb33648..f8304df3f 100644 --- a/tools/mhmake/src/mhmakefileparser.cpp +++ b/tools/mhmake/src/mhmakefileparser.cpp @@ -47,14 +47,14 @@ int mhmakefileparser::ParseFile(const refptr &FileInfo,bool SetMakeDir if (SetMakeDir) { m_MakeDir=curdir::GetCurDir(); - m_Variables[CURDIR]=m_MakeDir->GetFullFileName(); + m_Variables[CURDIR]=m_MakeDir->GetQuotedFullFileName(); } theLexer.m_InputFileName=FileInfo->GetFullFileName(); theLexer.m_pParser=(mhmakeparser*)this; theLexer.yyin=::fopen(FileInfo->GetFullFileName().c_str(),"r"); if (!theLexer.yyin) { - cerr << "Error opening makefile: "<GetFullFileName()<GetQuotedFullFileName()<"; } #endif - return m_RuleThatIsBuild->GetDeps()[0]->GetFullFileName(); + return m_RuleThatIsBuild->GetDeps()[0]->GetQuotedFullFileName(); case '@': // return full target file name - return m_RuleThatIsBuild->GetFullFileName(); + return m_RuleThatIsBuild->GetQuotedFullFileName(); case '*': // return stem return m_RuleThatIsBuild->GetRule()->GetStem(); case '^': // return all prerequisits @@ -359,10 +368,6 @@ void SplitToItems(const string &String,vector< refptr > &Items,refptr< pTmp=NextItem(pTmp,Item); if (!Item.empty()) { - if (Item[0]=='"') - { - Item=Item.substr(1,Item.size()-2); - } Items.push_back(GetFileInfo(Item,Dir)); } } @@ -669,14 +674,14 @@ void mhmakefileparser::LoadAutoDepsFile(refptr &DepFile) #ifdef _DEBUG if (!pIn) { - cerr << "Error opening autodep file "<GetFullFileName()<GetQuotedFullFileName()<GetFullFileName()<<": "<GetQuotedFullFileName()<<": "< &DepFile) { #ifdef _DEBUG if (!(*pPair.first)->CompareMd5_32(Md5_32) && !(*pPair.first)->CompareMd5_32(0)) - cout << "Warning: trying to set to different md5's for Target "<<(*pPair.first)->GetFullFileName()<<" Old: "<GetCommandsMd5_32()<<" New: "<GetQuotedFullFileName()<<" Old: "<GetCommandsMd5_32()<<" New: "<GetFullFileName()<<" to "<GetQuotedFullFileName()<<" to "<SetCommandsMd5_32(Md5_32); // If it was already there, just update the md5 value } @@ -753,18 +758,19 @@ void mhmakefileparser::SaveAutoDepsFile() { return; } + refptr pDepFile=GetFileInfo(DepFile); #ifdef _DEBUG if (g_PrintAdditionalInfo) cout<<"Saving automatic dependency file "<GetFullFileName().c_str(),"wb"); if (!pOut) { /* Maybe it is because the directory does not exist, so try to create this first */ - MakeDirs(GetAbsFileInfo(DepFile.substr(0,DepFile.find_last_of(OSPATHSEP)))); - pOut=fopen(DepFile.c_str(),"wb"); + MakeDirs(pDepFile->GetDir()); + pOut=fopen(pDepFile->GetFullFileName().c_str(),"wb"); if (!pOut) { @@ -964,7 +970,7 @@ uint32 mhmakefileparser::CreateEnvMd5_32() const string Val=GetFromEnv(Var,false); transform(Var.begin(),Var.end(),Var.begin(),(int(__CDECL *)(int))toupper); transform(Val.begin(),Val.end(),Val.begin(),(int(__CDECL *)(int))toupper); - DBGOUT(cout << GetMakeDir()->GetFullFileName() << " -> Setting GetFromEnv var " << Var << " to " << Val << endl); + DBGOUT(cout << GetMakeDir()->GetQuotedFullFileName() << " -> Setting GetFromEnv var " << Var << " to " << Val << endl); Variables[Var]=Val; } } @@ -978,7 +984,7 @@ uint32 mhmakefileparser::CreateEnvMd5_32() const transform(Var.begin(),Var.end(),Var.begin(),(int(__CDECL *)(int))toupper); string Val=It->second; transform(Val.begin(),Val.end(),Val.begin(),(int(__CDECL *)(int))toupper); - DBGOUT(cout << GetMakeDir()->GetFullFileName() << " -> Setting Commandline var " << Var << " to " << Val << endl); + DBGOUT(cout << GetMakeDir()->GetQuotedFullFileName() << " -> Setting Commandline var " << Var << " to " << Val << endl); Variables[Var]=Val; } It++; @@ -987,7 +993,7 @@ uint32 mhmakefileparser::CreateEnvMd5_32() const // Now create the md5 string md5_starts( &ctx ); - DBGOUT(cout << "MD5 of " << m_MakeDir->GetFullFileName() << endl); + DBGOUT(cout << "MD5 of " << m_MakeDir->GetQuotedFullFileName() << endl); map::const_iterator VarIt=Variables.begin(); map::const_iterator VarItEnd=Variables.end(); -- cgit v1.2.3