aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2013-09-12 11:38:41 +0200
committermarha <marha@users.sourceforge.net>2013-09-12 11:40:36 +0200
commit5a54fa6e45ee10cf58ee1b6d2eb5522a24bb8745 (patch)
tree02781984e9417bc04a726fcb7ac6cf17f8169920
parentaf858aeb7348909e334cfd0db0070e1661df00fc (diff)
downloadvcxsrv-5a54fa6e45ee10cf58ee1b6d2eb5522a24bb8745.tar.gz
vcxsrv-5a54fa6e45ee10cf58ee1b6d2eb5522a24bb8745.tar.bz2
vcxsrv-5a54fa6e45ee10cf58ee1b6d2eb5522a24bb8745.zip
Some minor modifications
Ignore pipe symbols when in dependency list Solved some linking problems in linux Solved problem calling svn info when using svn version from cygwin
-rw-r--r--tools/mhmake/.gitignore2
-rw-r--r--tools/mhmake/mhmake.vcxproj13
-rw-r--r--tools/mhmake/src/curdir.cpp3
-rw-r--r--tools/mhmake/src/mhmakefileparser.cpp2
-rw-r--r--tools/mhmake/src/mhmakelexer.l28
-rw-r--r--tools/mhmake/src/mhmakeparser.y7
-rw-r--r--tools/mhmake/src/rule.cpp1
-rw-r--r--tools/mhmake/src/util.cpp150
-rw-r--r--tools/mhmake/src/util.h39
9 files changed, 147 insertions, 98 deletions
diff --git a/tools/mhmake/.gitignore b/tools/mhmake/.gitignore
new file mode 100644
index 000000000..d24abb6c4
--- /dev/null
+++ b/tools/mhmake/.gitignore
@@ -0,0 +1,2 @@
+Debug64
+Release64
diff --git a/tools/mhmake/mhmake.vcxproj b/tools/mhmake/mhmake.vcxproj
index 2b395f11f..e50224eba 100644
--- a/tools/mhmake/mhmake.vcxproj
+++ b/tools/mhmake/mhmake.vcxproj
@@ -153,8 +153,6 @@
</ResourceCompile>
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
- <ProgramDatabaseFile>
- </ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
@@ -194,6 +192,7 @@
<CallingConvention>FastCall</CallingConvention>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4267;4996;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <ProgramDataBaseFileName>$(TargetDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -268,6 +267,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4267;4996;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <ProgramDataBaseFileName>$(TargetDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -277,7 +277,6 @@
<OutputFile>$(OutDir)\mhmake_dbg.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>.\Debug/mhmake.pdb</ProgramDatabaseFile>
<SubSystem>Console</SubSystem>
<RandomizedBaseAddress>false</RandomizedBaseAddress>
<DataExecutionPrevention>
@@ -307,7 +306,6 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(Configuration)/mhmake.pch</PrecompiledHeaderOutputFile>
- <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
@@ -322,7 +320,6 @@
<Link>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
<GenerateMapFile>true</GenerateMapFile>
<MapExports>true</MapExports>
<SubSystem>Console</SubSystem>
@@ -360,13 +357,13 @@
<PrecompiledHeader>Use</PrecompiledHeader>
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>$(Configuration)/mhmake.pch</PrecompiledHeaderOutputFile>
- <ProgramDataBaseFileName>$(IntDir)</ProgramDataBaseFileName>
<WarningLevel>Level3</WarningLevel>
<SuppressStartupBanner>true</SuppressStartupBanner>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<CallingConvention>FastCall</CallingConvention>
<CompileAs>Default</CompileAs>
<DisableSpecificWarnings>4267;4996;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
+ <ProgramDataBaseFileName>$(TargetDir)$(TargetName).pdb</ProgramDataBaseFileName>
</ClCompile>
<ResourceCompile>
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -376,7 +373,6 @@
<OutputFile>$(Configuration)/mhmake.exe</OutputFile>
<SuppressStartupBanner>true</SuppressStartupBanner>
<GenerateDebugInformation>true</GenerateDebugInformation>
- <ProgramDatabaseFile>$(OutDir)\$(ProjectName).pdb</ProgramDatabaseFile>
<GenerateMapFile>true</GenerateMapFile>
<MapExports>true</MapExports>
<SubSystem>Console</SubSystem>
@@ -455,21 +451,18 @@
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(IntDir)%(Filename).cpp;$(IntDir)%(Filename).hpp;$(IntDir)location.hh;$(IntDir)position.hh;$(IntDir)stack.hh</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">cmd.exe /c makebison.bat Debug64
</Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\src\bison.cc;.\src\bison.h;%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">$(OutDir)%(Filename).cpp;$(OutDir)%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">cmd.exe /c makebison.bat Profile
</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">%(RelativeDir)bisondata/bison.m4;%(RelativeDir)bisondata/lalr1.cc;%(RelativeDir)bisondata/c++.m4;%(RelativeDir)bisondata/c.m4;%(RelativeDir)bisondata/location.cc</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Profile|Win32'">$(IntDir)%(Filename).cpp;$(IntDir)%(Filename).hpp;$(IntDir)location.hh;$(IntDir)position.hh;$(IntDir)stack.hh</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">cmd.exe /c makebison.bat Profile64</Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">.\src\bison.cc;.\src\bison.h;%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Profile|x64'">$(OutDir)%(Filename).cpp;$(OutDir)%(Filename).h;%(Outputs)</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">cmd.exe /c makebison.bat Release
</Command>
<AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(RelativeDir)bisondata/bison.m4;%(RelativeDir)bisondata/lalr1.cc;%(RelativeDir)bisondata/c++.m4;%(RelativeDir)bisondata/c.m4;%(RelativeDir)bisondata/location.cc</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">$(IntDir)%(Filename).cpp;$(IntDir)%(Filename).hpp;$(IntDir)location.hh;$(IntDir)position.hh;$(IntDir)stack.hh</Outputs>
<Command Condition="'$(Configuration)|$(Platform)'=='Release|x64'">cmd.exe /c makebison.bat Release64</Command>
- <AdditionalInputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\src\bison.cc;.\src\bison.h;%(AdditionalInputs)</AdditionalInputs>
<Outputs Condition="'$(Configuration)|$(Platform)'=='Release|x64'">$(OutDir)%(Filename).cpp;$(OutDir)%(Filename).h;%(Outputs)</Outputs>
</CustomBuild>
</ItemGroup>
diff --git a/tools/mhmake/src/curdir.cpp b/tools/mhmake/src/curdir.cpp
index b87dc4f6f..d2b43ab52 100644
--- a/tools/mhmake/src/curdir.cpp
+++ b/tools/mhmake/src/curdir.cpp
@@ -23,9 +23,12 @@
#include "fileinfo.h"
#include "curdir.h"
#include "util.h"
+#include "mhmakeparser.hpp"
fileinfos g_FileInfos; // declare here since it is important that it is constructed before m_pcurrentdir
curdir::initcurdir curdir::m_pCurrentDir;
+loadedmakefile::loadedmakefile_statics loadedmakefile::sm_Statics; // Declare this here because this constructor is using g_FileInfos and m_pCurrentDir
+LOADEDMAKEFILES g_LoadedMakefiles; // Declare it here otherwize problems in the destructor (still using items from g_FileInfos)
///////////////////////////////////////////////////////////////////////////////
curdir::initcurdir::initcurdir()
diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp
index 4a50d6edd..0731d1ce9 100644
--- a/tools/mhmake/src/mhmakefileparser.cpp
+++ b/tools/mhmake/src/mhmakefileparser.cpp
@@ -379,7 +379,7 @@ void mhmakefileparser::SplitToItems(const string &String,vector<fileinfo*> &Item
{
string Item;
pTmp=NextItem(pTmp,Item);
- if (!Item.empty())
+ if (!Item.empty() && Item!="|")
{
Items.push_back(GetFileInfo(Item,m_MakeDir));
}
diff --git a/tools/mhmake/src/mhmakelexer.l b/tools/mhmake/src/mhmakelexer.l
index 9b933c305..e336fefbf 100644
--- a/tools/mhmake/src/mhmakelexer.l
+++ b/tools/mhmake/src/mhmakelexer.l
@@ -255,6 +255,20 @@ load_makefile {
}
/*---------------------------------------------------------------------------*/
+[ \t]*\|[ \t]*\\[ \t\r]*\n[ \t]* {
+ PRINTF(("%s %d: EQUAL: %s\n",m_InputFileName.c_str(),lineno(),yytext));
+ inclineno();
+ yylval->theString=" | ";
+ return yy::mhmakeparser::token::PIPE;
+}
+
+[ \t]*\|[ \t]* {
+ PRINTF(("%s %d: EQUAL: %s\n",m_InputFileName.c_str(),lineno(),yytext));
+ yylval->theString=" | ";
+ return yy::mhmakeparser::token::PIPE;
+}
+
+ /*---------------------------------------------------------------------------*/
[ \t]*=[ \t]*\\[ \t\r]*\n[ \t]* {
PRINTF(("%s %d: EQUAL: %s\n",m_InputFileName.c_str(),lineno(),yytext));
inclineno();
@@ -680,7 +694,7 @@ export {
}
/*---------------------------------------------------------------------------*/
-([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*\|]|\\\ |\\#|\\\")+\\[ \t\r]*\n {
+([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*]|\\\ |\\#|\\\"|\|)+\\[ \t\r]*\n {
size_t EndIndex=yyleng;
while (strchr(" \t\r\n\\",yytext[--EndIndex]));
yyless(EndIndex+1);
@@ -690,14 +704,14 @@ export {
return yy::mhmakeparser::token::STRING;
}
-([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*\|]|\\\ |\\#|\\\")+\+= {
+([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*]|\\\ |\\#|\\\"|\|)+\+= {
PRINTF(("%s %d: STRING: %s\n",m_InputFileName.c_str(),lineno(),yytext));
yyless(yyleng-2);
yylval->theString=(const char *)yytext;
return yy::mhmakeparser::token::STRING;
}
-([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*\|\[\]]|\\\ |\\#|\\\")+ {
+([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*\[\]]|\\\ |\\#|\\\"|\|)+ {
PRINTF(("%s %d: STRING: %s\n",m_InputFileName.c_str(),lineno(),yytext));
yylval->theString=(const char *)yytext;
return yy::mhmakeparser::token::STRING;
@@ -841,8 +855,8 @@ export {
/*---------------------------------------------------------------------------*/
<QUOTE>\r /* skip */
-<QUOTE>[^\\\"\r\n$]+ |
-<QUOTE>[\\\$] |
+<QUOTE>[^\\\"\r\n$]+ |
+<QUOTE>[\\\$] |
<QUOTE>\\\" |
<QUOTE>\\# {
yymore();
@@ -860,8 +874,8 @@ export {
<SINGLEQUOTE>\r /* skip */
<SINGLEQUOTE>[^\\\'\r\n$]+ |
-<SINGLEQUOTE>[\\\$] |
-<SINGLEQUOTE>\\\' |
+<SINGLEQUOTE>[\\\$] |
+<SINGLEQUOTE>\\\' |
<SINGLEQUOTE>\\# {
yymore();
}
diff --git a/tools/mhmake/src/mhmakeparser.y b/tools/mhmake/src/mhmakeparser.y
index d8edb1d51..f9042f780 100644
--- a/tools/mhmake/src/mhmakeparser.y
+++ b/tools/mhmake/src/mhmakeparser.y
@@ -52,7 +52,7 @@ const char Test[]="dit is een test";
%token END 0 "end of file"
%token <theString> COMMAND
%token <theString> COMMA
-%token <theString> STRING DOLLAREXPR EQUAL COLON DOUBLECOLON VARDEF VARVAL
+%token <theString> STRING DOLLAREXPR PIPE EQUAL COLON DOUBLECOLON VARDEF VARVAL
%token IMEQUAL PEQUAL OPTEQUAL PHONY AUTODEPS EXPORT NEWLINE INCLUDEMAK SPACE VPATH ENVVARS_TOIGNORE
%type <theString> expression nonspaceexpression simpleexpression
@@ -136,8 +136,8 @@ ruledef: expression_nocolorequal rulecolon maybeemptyexpression
throw string("Empty left hand side in rule: ") + $1 + " : " + $3;
}
#endif
- m_pMakefile->SplitToItems(m_pMakefile->ExpandExpression($1),*m_pMakefile->m_pCurrentItems);
- m_pMakefile->SplitToItems(m_pMakefile->ExpandExpression($3),*m_pMakefile->m_pCurrentDeps);
+ m_pMakefile->SplitToItems(m_pMakefile->ExpandExpression($1), *m_pMakefile->m_pCurrentItems);
+ m_pMakefile->SplitToItems(m_pMakefile->ExpandExpression($3), *m_pMakefile->m_pCurrentDeps);
m_pMakefile->m_DoubleColonRule= ($2==1) ;
PRINTF(("Defining rule %s : %s\n",$1.c_str(),$3.c_str()));
PRINTF((" Expanded to %s : %s\n",m_pMakefile->ExpandExpression($1).c_str(),m_pMakefile->ExpandExpression($3).c_str()));
@@ -286,6 +286,7 @@ nonspaceexpression_nocolorequal: simpleexpression_nocolorequal |
;
simpleexpression: simpleexpression_nocolorequal |
+ PIPE |
EQUAL |
COLON |
DOUBLECOLON |
diff --git a/tools/mhmake/src/rule.cpp b/tools/mhmake/src/rule.cpp
index 35884e2f0..b3f682e95 100644
--- a/tools/mhmake/src/rule.cpp
+++ b/tools/mhmake/src/rule.cpp
@@ -32,7 +32,6 @@ vector<implicitrule_t> IMPLICITRULE::m_ImplicitRules;
makecommand g_MakeCommand; // Order is important since sm_Statics is using g_MakeCommand
const string g_QuoteString("\""); // Order is important since sm_Statics is using g_QuoteString
-loadedmakefile::loadedmakefile_statics loadedmakefile::sm_Statics;
///////////////////////////////////////////////////////////////////////////////
static bool FindDep(fileinfo *pTarget, implicitruledep_t *pImplicitRule,refptr<rule> &Rule)
diff --git a/tools/mhmake/src/util.cpp b/tools/mhmake/src/util.cpp
index 9fe006e95..e1fcf0d27 100644
--- a/tools/mhmake/src/util.cpp
+++ b/tools/mhmake/src/util.cpp
@@ -335,92 +335,92 @@ refptr<loadedmakefile> LOADEDMAKEFILES::find(const loadedmakefile &ToSearch)
return refptr<loadedmakefile>();
}
-LOADEDMAKEFILES g_LoadedMakefiles;
-
///////////////////////////////////////////////////////////////////////////////
-loadedmakefile::loadedmakefile_statics::loadedmakefile_statics()
+bool loadedmakefile::loadedmakefile_statics::GetSvnRevision(void)
{
- m_GlobalCommandLineVars[MAKE]=g_MakeCommand;
- const char *pEnv=getenv(MHMAKECONF);
- if (pEnv)
- {
- m_MhMakeConf=GetAbsFileInfo(pEnv);
- m_GlobalCommandLineVars[MHMAKECONF]=QuoteFileName(m_MhMakeConf->GetFullFileName());
+ // Get the revision of the working copy
+ // We do it with the svn info command (do it without path arguments, only current directory, to avoid problems with path names and junctions/links
- // Get the revision of the working copy
- // We do it with the svn info command
+ string Output;
+ try
+ {
+ mhmakefileparser Dummy(m_MhMakeConf);
+ string SvnCommand=Dummy.SearchCommand("svn",EXEEXT);
+ Dummy.OsExeCommand(SvnCommand,string(" info"),false,&Output);
+ }
+ catch (string Message)
+ {
+ #ifdef _DEBUG
+ cerr << "Exception: " << Message << endl;
+ #endif
+ }
- string Output;
- try
+ char *pTok=strtok((char*)Output.c_str(),"\n"); // doing this is changing string, so this is very dangerous !!!
+ while (pTok)
+ {
+ if (!strncmp(pTok,"URL: ",5))
{
- mhmakefileparser Dummy(curdir::GetCurDir());
- string SvnCommand=Dummy.SearchCommand("svn",EXEEXT);
- #ifdef WIN32
- if (GetFileAttributes(m_MhMakeConf->GetFullFileName().c_str())&FILE_ATTRIBUTE_REPARSE_POINT)
- {
- WIN32_FIND_DATA FindData;
- HANDLE hFind=FindFirstFile(m_MhMakeConf->GetFullFileName().c_str(),&FindData);
- if (hFind!=INVALID_HANDLE_VALUE)
- {
- if (FindData.dwReserved0==IO_REPARSE_TAG_MOUNT_POINT)
- {
- HANDLE hDir = ::CreateFile(m_MhMakeConf->GetFullFileName().c_str(), GENERIC_READ, 0, NULL, OPEN_EXISTING, FILE_FLAG_OPEN_REPARSE_POINT | FILE_FLAG_BACKUP_SEMANTICS, NULL);
-
- BYTE buf[MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; // We need a large buffer
- REPARSE_MOUNTPOINT_DATA_BUFFER& ReparseBuffer = (REPARSE_MOUNTPOINT_DATA_BUFFER&)buf;
- DWORD dwRet;
-
- if (::DeviceIoControl(hDir, FSCTL_GET_REPARSE_POINT, NULL, 0, &ReparseBuffer, MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &dwRet, NULL))
- {
- // Success
- ::CloseHandle(hDir);
-
- LPCWSTR pPath = ReparseBuffer.ReparseTarget;
- if (wcsncmp(pPath, L"\\??\\", 4) == 0) pPath += 4; // Skip 'non-parsed' prefix
- char szPath[MAX_PATH];
- ::WideCharToMultiByte(CP_ACP, 0, pPath, -1, szPath, MAX_PATH, NULL, NULL);
- Dummy.OsExeCommand(SvnCommand,string(" info ")+GetFileInfo(szPath,m_MhMakeConf->GetDir())->GetQuotedFullFileName(),false,&Output);
- }
- else
- { // Error
- ::CloseHandle(hDir);
- }
- }
- FindClose(hFind);
- }
- }
- #else
- struct stat Stat;
- lstat(m_MhMakeConf->GetFullFileName().c_str(),&Stat);
- if (S_ISLNK(Stat.st_mode))
- {
- char FileName[1024];
- int len=readlink(m_MhMakeConf->GetFullFileName().c_str(),FileName,sizeof(FileName));
- FileName[len]=0;
- Dummy.OsExeCommand(SvnCommand,string(" info ")+GetFileInfo(FileName,m_MhMakeConf->GetDir())->GetQuotedFullFileName(),false,&Output);
- }
- #endif
- else
- Dummy.OsExeCommand(SvnCommand,string(" info ")+m_MhMakeConf->GetQuotedFullFileName(),false,&Output);
+ m_GlobalCommandLineVars[WC_URL]=pTok+5+7;
}
- catch (string Message)
+ else if (!strncmp(pTok,"Revision: ",10))
{
+ m_GlobalCommandLineVars[WC_REVISION]=pTok+10;
+ return true;
}
+ pTok=strtok(NULL,"\n");
+ }
+ return false;
+}
- char *pTok=strtok((char*)Output.c_str(),"\n"); // doing this is changing string, so this is very dangerous !!!
- while (pTok)
+///////////////////////////////////////////////////////////////////////////////
+bool loadedmakefile::loadedmakefile_statics::GetGitSvnRevision(void)
+{
+ // Get the revision of the working copy
+ // We do it with the svn info command
+
+ string Output;
+ try
+ {
+ mhmakefileparser Dummy(m_MhMakeConf);
+ string GitCommand=Dummy.SearchCommand("git",EXEEXT);
+ Dummy.OsExeCommand(GitCommand,string(" svn info ."), false, &Output);
+ }
+ catch (string Message)
+ {
+ #ifdef _DEBUG
+ cerr << "Exception: " << Message << endl;
+ #endif
+ }
+
+ char *pTok=strtok((char*)Output.c_str(),"\n"); // doing this is changing string, so this is very dangerous !!!
+ while (pTok)
+ {
+ if (!strncmp(pTok,"URL: ",5))
{
- if (!strncmp(pTok,"URL: ",5))
- {
- m_GlobalCommandLineVars[WC_URL]=pTok+5+7;
- }
- else if (!strncmp(pTok,"Revision: ",10))
- {
- m_GlobalCommandLineVars[WC_REVISION]=pTok+10;
- break;
- }
- pTok=strtok(NULL,"\n");
+ m_GlobalCommandLineVars[WC_URL]=pTok+5+7;
+ }
+ else if (!strncmp(pTok,"Revision: ",10))
+ {
+ m_GlobalCommandLineVars[WC_REVISION]=pTok+10;
+ return true;
}
+ pTok=strtok(NULL,"\n");
+ }
+ return false;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+loadedmakefile::loadedmakefile_statics::loadedmakefile_statics()
+{
+ m_GlobalCommandLineVars[MAKE]=g_MakeCommand;
+ const char *pEnv=getenv(MHMAKECONF);
+ if (pEnv)
+ {
+ m_MhMakeConf=GetAbsFileInfo(pEnv);
+ m_GlobalCommandLineVars[MHMAKECONF]=QuoteFileName(m_MhMakeConf->GetFullFileName());
+
+ if (!GetSvnRevision())
+ GetGitSvnRevision();
}
}
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index b1a18c3ed..01e766520 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "3.0.21"
+#define MHMAKEVER "3.0.25"
class makecommand
{
@@ -66,6 +66,24 @@ public:
extern makecommand g_MakeCommand;
///////////////////////////////////////////////////////////////////////////////
+inline string unescapeString(const string &InStr)
+{
+ string OutStr;
+ string::const_iterator It=InStr.cbegin();
+ string::const_iterator ItEnd=InStr.cend();
+ while (It!=ItEnd)
+ {
+ char Ch=*It++;
+ if (Ch=='\\' && It!=ItEnd)
+ {
+ Ch=*It++;
+ }
+ OutStr+=Ch;
+ }
+ return OutStr;
+}
+
+///////////////////////////////////////////////////////////////////////////////
inline const char *NextItem(const char *pTmp,string &Output, const char *pToks=" \t")
{
const char *pStart;
@@ -202,6 +220,9 @@ struct loadedmakefile : public refbase
fileinfo *m_MhMakeConf;
loadedmakefile_statics();
+
+ bool GetSvnRevision(void);
+ bool GetGitSvnRevision(void);
};
static loadedmakefile_statics sm_Statics;
@@ -212,6 +233,11 @@ struct loadedmakefile : public refbase
vector<string> m_CommandLineTargets;
refptr<mhmakefileparser> m_pMakefileParser;
+ loadedmakefile()
+ {
+ // Dummy, only used below
+ }
+
loadedmakefile(const fileinfo *pDir, vector<string> &Args,const string &Makefile=g_EmptyString);
void LoadMakefile();
@@ -261,11 +287,22 @@ struct loadedmakefile : public refbase
}
return 1;
}
+public:
+ fileinfo *GetMhMakeConf()
+ {
+ return sm_Statics.m_MhMakeConf;
+ }
+
};
class LOADEDMAKEFILES : public vector<refptr<loadedmakefile> >
{
public:
+ LOADEDMAKEFILES()
+ {
+ loadedmakefile temp;
+ temp.GetMhMakeConf(); // Just to be here to control the order of destruction (sm_Statics may not be destructed before g_LoadedMakefiles)
+ }
refptr<loadedmakefile> find(const loadedmakefile &pToSearch);
typedef vector<refptr<loadedmakefile> >::iterator iterator;
};