aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-12-10 15:49:55 +0000
committermarha <marha@users.sourceforge.net>2009-12-10 15:49:55 +0000
commit0925cb4f76a1667fb3777efbe6a0e0e69c4cca3c (patch)
treebbe20184d5104c1489cb84815f2f27dc4437be08 /tools/mhmake/src
parent0540eb5a1f795c0f5265d244ec979b8ddfcf3acb (diff)
downloadvcxsrv-0925cb4f76a1667fb3777efbe6a0e0e69c4cca3c.tar.gz
vcxsrv-0925cb4f76a1667fb3777efbe6a0e0e69c4cca3c.tar.bz2
vcxsrv-0925cb4f76a1667fb3777efbe6a0e0e69c4cca3c.zip
Added 64-bit compilation
Removed autodep optimisation.
Diffstat (limited to 'tools/mhmake/src')
-rw-r--r--tools/mhmake/src/bison.cc8
-rw-r--r--tools/mhmake/src/build.cpp17
-rw-r--r--tools/mhmake/src/fileinfo.cpp2
-rw-r--r--tools/mhmake/src/fileinfo.h2
-rw-r--r--tools/mhmake/src/flexskel.cc14
-rw-r--r--tools/mhmake/src/flexskel.h6
-rw-r--r--tools/mhmake/src/functions.cpp22
-rw-r--r--tools/mhmake/src/md5.cpp5
-rw-r--r--tools/mhmake/src/md5.h2
-rw-r--r--tools/mhmake/src/mhmakefileparser.cpp94
-rw-r--r--tools/mhmake/src/mhmakefileparser.h8
-rw-r--r--tools/mhmake/src/mhmakelexer.l10
-rw-r--r--tools/mhmake/src/util.cpp4
-rw-r--r--tools/mhmake/src/util.h2
14 files changed, 93 insertions, 103 deletions
diff --git a/tools/mhmake/src/bison.cc b/tools/mhmake/src/bison.cc
index bb15365b6..e0315efd4 100644
--- a/tools/mhmake/src/bison.cc
+++ b/tools/mhmake/src/bison.cc
@@ -503,7 +503,7 @@ int YY_@_DEBUG_FLAG; /* nonzero means print parse trace
in available built-in functions on various systems. */
#ifdef __cplusplus
-static void __yy_bcopy (char *from, char *to, int count)
+static void __yy_bcopy (char *from, char *to, size_t count)
#else
#ifdef __STDC__
static void __yy_bcopy (char *from, char *to, int count)
@@ -517,7 +517,7 @@ static void __yy_bcopy (from, to, count)
{
register char *f = from;
register char *t = to;
- register int i = count;
+ register size_t i = count;
while (i-- > 0)
*t++ = *f++;
@@ -618,7 +618,7 @@ YYLABEL(yynewstate)
#endif
/* Get the current used size of the three stacks, in elements. */
- int size = yyssp - yyss + 1;
+ size_t size = yyssp - yyss + 1;
#ifdef yyoverflow
/* Each stack pointer address is followed by the size of
@@ -884,7 +884,7 @@ YYLABEL(yyerrlab) /* here on detecting error */
if (yyn > YYFLAG && yyn < YYLAST)
{
- int size = 0;
+ size_t size = 0;
char *msg;
int x, count;
diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp
index 67b5bfffb..8e4732c32 100644
--- a/tools/mhmake/src/build.cpp
+++ b/tools/mhmake/src/build.cpp
@@ -481,7 +481,7 @@ static bool CopyFile(refptr<fileinfo> pSrc, refptr<fileinfo> pDest)
return false;
}
char Buf[4096];
- int Ret;
+ size_t Ret;
while ( (Ret=fread(Buf,1,sizeof(Buf),pSrcFile)) > 0)
{
@@ -602,7 +602,7 @@ exit:
static bool EchoCommand(const string &Params)
{
// Find the first > character
- int Pos=Params.find_first_of('>');
+ size_t Pos=Params.find_first_of('>');
if (Pos==string::npos)
{
// Just echo it
@@ -651,7 +651,7 @@ static bool CopyFiles(const string &Params)
SplitToItems(Params,Files);
- int NrSrcs=Files.size()-1;
+ size_t NrSrcs=Files.size()-1;
if (NrSrcs<1)
{
@@ -666,7 +666,7 @@ static bool CopyFiles(const string &Params)
return false;
}
- for (int i=0; i<NrSrcs; i++)
+ for (size_t i=0; i<NrSrcs; i++)
{
refptr<fileinfo> pSrc=Files[i];
@@ -914,9 +914,9 @@ string mhmakefileparser::GetFullCommand(string Command)
}
if (!bBuild)
{
- deps_t Autodeps;
+ set< refptr<fileinfo> > Autodeps;
GetAutoDeps(pPyFile, Autodeps);
- deps_t::iterator It=Autodeps.begin();
+ set< refptr<fileinfo> >::iterator It=Autodeps.begin();
while (It!=Autodeps.end())
{
if (pExeFile->GetDate().IsOlder((*It)->GetDate()))
@@ -1074,7 +1074,7 @@ bool OsExeCommand(const string &Command,const string &Params,bool IgnoreError,st
CloseHandle(ProcessInfo.hThread);
char Buf[256];
- int Nbr;
+ size_t Nbr;
while ( (Nbr=fread(Buf,1,sizeof(Buf)-1,pStdOut)) > 0)
{
if (pOutput)
@@ -1679,6 +1679,7 @@ mh_time_t mhmakefileparser::BuildTarget(const refptr<fileinfo> &Target,bool bChe
Target->SetCommandsMd5_32(Md5_32); /* If the rule of the target was added with an implicit rule the targets in the rule is empty */
pMakefile->AddTarget(Target);
+ pMakefile->m_AutoDepsDirty=true;
pRule->SetTargetsIsBuild(Md5_32);
break;
}
@@ -1689,7 +1690,7 @@ mh_time_t mhmakefileparser::BuildTarget(const refptr<fileinfo> &Target,bool bChe
// Only rebuild if it is not yet rebuild in this current run. This may happen for implicit rules that have multiple targets (implicit rules that build more then one target at the same time
Target->SetCommandsMd5_32(Md5_32);
pMakefile->AddTarget(Target);
- m_AutoDepsDirty=true; /* We need to update the autodeps file if the md5 has been changed */
+ pMakefile->m_AutoDepsDirty=true; /* We need to update the autodeps file if the md5 has been changed */
break;
}
else
diff --git a/tools/mhmake/src/fileinfo.cpp b/tools/mhmake/src/fileinfo.cpp
index 6ea9c158e..387b2816d 100644
--- a/tools/mhmake/src/fileinfo.cpp
+++ b/tools/mhmake/src/fileinfo.cpp
@@ -57,7 +57,7 @@ string QuoteFileName(const string &Filename)
///////////////////////////////////////////////////////////////////////////////
string UnquoteFileName(const string &Filename)
{
- int Pos=0;
+ size_t Pos=0;
string Name(Filename);
#if OSPATHSEP=='\\'
/* Remove all the quotes from the filename */
diff --git a/tools/mhmake/src/fileinfo.h b/tools/mhmake/src/fileinfo.h
index 9be40bdbe..9a521d4a6 100644
--- a/tools/mhmake/src/fileinfo.h
+++ b/tools/mhmake/src/fileinfo.h
@@ -211,7 +211,7 @@ public:
{
#if defined(_DEBUG) && defined(_MSC_VER)
if (m_pRule && m_pRule->GetCommands().size()) {
- _asm int 3;
+ DebugBreak();
}
#endif
m_pRule=pRule;
diff --git a/tools/mhmake/src/flexskel.cc b/tools/mhmake/src/flexskel.cc
index 148e7f54c..43c395dba 100644
--- a/tools/mhmake/src/flexskel.cc
+++ b/tools/mhmake/src/flexskel.cc
@@ -277,7 +277,7 @@ struct yy_buffer_state
int yy_buf_size;
/* number of characters read into yy_ch_buf, not including EOB characters */
- int yy_n_chars;
+ size_t yy_n_chars;
int yy_eof_status; /* whether we've seen an EOF on this buffer */
#define EOF_NOT_SEEN 0
@@ -307,7 +307,7 @@ static int yy_n_chars; /* number of characters read into yy_ch_buf */
/* GLOBAL */
YY_@_CHAR *yy___text;
-int yy___leng;
+size_t yy___leng;
YY_@_IFILE *yy___in = (YY_@_IFILE *) 0;
YY_@_OFILE *yy___out = (YY_@_OFILE *) 0;
@@ -342,7 +342,7 @@ void YY_@_CLASS::yy___echo()
}
#endif
#ifndef YY_@_INPUT_NOCODE
-int YY_@_CLASS::yy___input(char * buffer,int &result,int max_size)
+size_t YY_@_CLASS::yy___input(char * buffer,size_t &result,size_t max_size)
{
YY_@_INPUT_CODE
}
@@ -514,7 +514,7 @@ do_action: /* this label is used only to access EOF actions */
case YY_END_OF_BUFFER:
{
/* amount of text matched not including the EOB char */
- int yy_amount_of_matched_text = yy_cp - yy___text - 1;
+ int yy_amount_of_matched_text = (int)(yy_cp - yy___text - 1);
/* undo the effects of YY_DO_BEFORE_ACTION */
*yy_cp = yy_hold_char;
@@ -643,7 +643,7 @@ int YY_@_CLASS::yy_get_next_buffer()
{
register YY_@_CHAR *dest = YY_@_CURRENT_BUFFER->yy_ch_buf;
register YY_@_CHAR *source = yy___text - 1; /* copy prev. char, too */
- register int number_to_move, i;
+ register ptrdiff_t number_to_move, i;
int ret_val;
if ( yy_c_buf_p > &YY_@_CURRENT_BUFFER->yy_ch_buf[yy_n_chars + 1] )
@@ -665,7 +665,7 @@ int YY_@_CLASS::yy_get_next_buffer()
else
{
- int num_to_read = YY_@_CURRENT_BUFFER->yy_buf_size - number_to_move - 1;
+ ptrdiff_t num_to_read = YY_@_CURRENT_BUFFER->yy_buf_size - number_to_move - 1;
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
@@ -791,7 +791,7 @@ void YY_@_CLASS::yyunput( YY_@_CHAR c, YY_@_CHAR *yy_bp )
if ( yy_cp < YY_@_CURRENT_BUFFER->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
- register int number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
+ register ptrdiff_t number_to_move = yy_n_chars + 2; /* +2 for EOB chars */
register YY_@_CHAR *dest = &YY_@_CURRENT_BUFFER->yy_ch_buf[YY_@_CURRENT_BUFFER->yy_buf_size + 2];
register YY_@_CHAR *source = &YY_@_CURRENT_BUFFER->yy_ch_buf[number_to_move];
diff --git a/tools/mhmake/src/flexskel.h b/tools/mhmake/src/flexskel.h
index 58d807f6a..563e469c7 100644
--- a/tools/mhmake/src/flexskel.h
+++ b/tools/mhmake/src/flexskel.h
@@ -329,7 +329,7 @@ class YY_@_CLASS YY_@_INHERIT
private:/* data */
YY_@_CHAR *yy_c_buf_p;
YY_@_CHAR yy_hold_char;
- int yy_n_chars;
+ size_t yy_n_chars;
int yy_init;
int yy_start;
int yy_did_buffer_switch_on_eof;
@@ -356,7 +356,7 @@ protected:/* non virtual */
=0
#endif
;
- virtual int YY_@_INPUT(char *buf,int &result,int max_size)
+ virtual size_t YY_@_INPUT(char *buf,size_t &result,size_t max_size)
#ifdef YY_@_INPUT_PURE
=0
#endif
@@ -373,7 +373,7 @@ protected:/* non virtual */
;
public:
YY_@_CHAR *YY_@_TEXT;
- int YY_@_LENG;
+ size_t YY_@_LENG;
YY_@_IFILE *YY_@_IN;
YY_@_OFILE *YY_@_OUT;
YY_@_LEX_RETURN YY_@_LEX ( YY_@_LEX_PARAM);
diff --git a/tools/mhmake/src/functions.cpp b/tools/mhmake/src/functions.cpp
index 3765bc37c..c93292d88 100644
--- a/tools/mhmake/src/functions.cpp
+++ b/tools/mhmake/src/functions.cpp
@@ -73,7 +73,7 @@ static string TrimString(const string &Input)
while (strchr(" \t",Input[Start])) Start++;
if (Start>=Input.size())
return g_EmptyString;
- unsigned Stop=Input.size()-1;
+ size_t Stop=Input.size()-1;
while (strchr(" \t",Input[Stop])) Stop--;
return Input.substr(Start,Stop-Start+1);
}
@@ -81,7 +81,7 @@ static string TrimString(const string &Input)
///////////////////////////////////////////////////////////////////////////////
string mhmakefileparser::f_filter(const string & Arg) const
{
- int ipos=Arg.find(',');
+ size_t ipos=Arg.find(',');
#ifdef _DEBUG
if (ipos==string::npos) {
throw string("filter func should have 2 arguments: ")+Arg;
@@ -120,7 +120,7 @@ string mhmakefileparser::f_filter(const string & Arg) const
///////////////////////////////////////////////////////////////////////////////
string mhmakefileparser::f_filterout(const string & Arg) const
{
- int ipos=Arg.find(',');
+ size_t ipos=Arg.find(',');
#ifdef _DEBUG
if (ipos==string::npos) {
throw string("filter func should have 2 arguments: ")+Arg;
@@ -182,8 +182,8 @@ string mhmakefileparser::f_call(const string & Arg) const
i++;
char Tmp[10];
::sprintf(Tmp,"$(%d)",i);
- int Len=::strlen(Tmp);
- int Pos=Func.find(Tmp);
+ size_t Len=::strlen(Tmp);
+ size_t Pos=Func.find(Tmp);
while (Func.npos!=Pos)
{
Func=Func.substr(0,Pos)+Repl+Func.substr(Pos+Len);
@@ -216,8 +216,8 @@ string mhmakefileparser::f_subst(const string & Arg) const
return Text;
string Ret;
- int Pos=Text.find(FromString);
- int PrevPos=0;
+ size_t Pos=Text.find(FromString);
+ size_t PrevPos=0;
while (Pos!=string::npos)
{
Ret+=Text.substr(PrevPos,Pos-PrevPos);
@@ -334,11 +334,11 @@ string mhmakefileparser::f_firstword(const string & Arg) const
string mhmakefileparser::f_wildcard(const string & Arg) const
{
string FileSpec=TrimString(Arg);
- int LastSep=FileSpec.find_last_of(OSPATHSEP)+1;
+ size_t LastSep=FileSpec.find_last_of(OSPATHSEP)+1;
string Dir=FileSpec.substr(0,LastSep);
#ifdef WIN32
struct _finddata_t FileInfo;
- long hFile=_findfirst(FileSpec.c_str(),&FileInfo);
+ intptr_t hFile=_findfirst(FileSpec.c_str(),&FileInfo);
if (hFile==-1)
return g_EmptyString;
@@ -500,7 +500,7 @@ string mhmakefileparser::f_basename(const string & FileNames) const
///////////////////////////////////////////////////////////////////////////////
static string notdir(const string &FileName,const string &)
{
- int Pos=FileName.find_last_of(OSPATHSEP);
+ size_t Pos=FileName.find_last_of(OSPATHSEP);
if (Pos==string::npos)
{
return FileName;
@@ -641,7 +641,7 @@ string mhmakefileparser::f_strip(const string & Arg) const
///////////////////////////////////////////////////////////////////////////////
static string dir(const string &FileName,const string &)
{
- int Pos=FileName.find_last_of(OSPATHSEP);
+ size_t Pos=FileName.find_last_of(OSPATHSEP);
if (Pos==string::npos)
{
return g_EmptyString;
diff --git a/tools/mhmake/src/md5.cpp b/tools/mhmake/src/md5.cpp
index 2161b3c75..908f28134 100644
--- a/tools/mhmake/src/md5.cpp
+++ b/tools/mhmake/src/md5.cpp
@@ -210,7 +210,7 @@ static uint8 md5_padding[64] =
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
};
-void md5_update( md5_context *ctx, uint8 *input, uint32 length )
+void md5_update( md5_context *ctx, uint8 *input, size_t length )
{
uint32 left, fill;
@@ -224,8 +224,7 @@ void md5_update( md5_context *ctx, uint8 *input, uint32 length )
left = ctx->total[0] & 0x3F;
fill = 64 - left;
- ctx->total[0] += length;
- ctx->total[0] &= 0xFFFFFFFF;
+ ctx->total[0] = (uint32)((ctx->total[0] + length)& 0xFFFFFFFF);
if( ctx->total[0] < length )
ctx->total[1]++;
diff --git a/tools/mhmake/src/md5.h b/tools/mhmake/src/md5.h
index 5f604d460..d2e3ef62f 100644
--- a/tools/mhmake/src/md5.h
+++ b/tools/mhmake/src/md5.h
@@ -44,7 +44,7 @@ md5_context;
typedef uint32 md5_val[4];
void md5_starts( md5_context *ctx );
-void md5_update( md5_context *ctx, uint8 *input, uint32 length );
+void md5_update( md5_context *ctx, uint8 *input, size_t length );
void md5_finish( md5_context *ctx, uint8 digest[16] );
uint32 *md5_finishbin( md5_context *ctx);
uint32 md5_finish32( md5_context *ctx);
diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp
index cc1c308dd..de7b22da3 100644
--- a/tools/mhmake/src/mhmakefileparser.cpp
+++ b/tools/mhmake/src/mhmakefileparser.cpp
@@ -79,14 +79,14 @@ bool mhmakefileparser::IsDefined(const string &Var) const
}
///////////////////////////////////////////////////////////////////////////////
-static inline int SkipUntilQuote(const string &Expr,int i,char Char)
+static inline size_t SkipUntilQuote(const string &Expr,size_t i,char Char)
{
while (Expr[i++]!=Char) ;
return i;
}
///////////////////////////////////////////////////////////////////////////////
-static inline int SkipMakeExpr(const string &Expr,int i)
+static inline size_t SkipMakeExpr(const string &Expr,size_t i)
{
char Char=Expr[i++];
if (Char!='(')
@@ -108,7 +108,7 @@ static inline int SkipMakeExpr(const string &Expr,int i)
// a macro or quoted string
static pair<string,string> SplitExpr(const string &Expr,char Item)
{
- int i=0;
+ size_t i=0;
char Char=Expr[i++];
while (Char!=Item)
{
@@ -132,8 +132,8 @@ bool mhmakefileparser::IsEqual(const string &EqualExpr) const
const char *pStr=Expr.c_str();
const char *pTmp=pStr;
while (*pTmp && *pTmp!=',') pTmp++;
- int Pos=pTmp-pStr;
- int Size=Expr.size();
+ ptrdiff_t Pos=pTmp-pStr;
+ size_t Size=Expr.size();
pTmp=pStr+Size-1;
while (pTmp>pStr && strchr(" \t",*pTmp))
{
@@ -164,8 +164,8 @@ bool mhmakefileparser::IsEqual(const string &EqualExpr) const
string mhmakefileparser::ExpandExpression(const string &Expr) const
{
((mhmakefileparser*)this)->m_InExpandExpression++;
- int i=0;
- int Length=Expr.size();
+ size_t i=0;
+ size_t Length=Expr.size();
string Ret;
string ToAdd;
while (i<Length)
@@ -181,7 +181,7 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const
}
else
{
- int inew=SkipMakeExpr(Expr,i);
+ size_t inew=SkipMakeExpr(Expr,i);
i++;
if (inew>i)
{
@@ -206,7 +206,7 @@ string mhmakefileparser::ExpandExpression(const string &Expr) const
// Here we do a special case in case we still have a $ within a %
if (Ret.find('$')!=string::npos)
Ret=ExpandExpression(Ret);
- int Pos;
+ size_t Pos;
while ((Pos=Ret.find("$$"))!=string::npos)
{
Ret=Ret.replace(Pos,2,"$");
@@ -458,7 +458,7 @@ void mhmakefileparser::AddRule()
}
///////////////////////////////////////////////////////////////////////////////
-void mhmakefileparser::GetAutoDeps(const refptr<fileinfo> &FirstDep, deps_t &Autodeps)
+void mhmakefileparser::GetAutoDeps(const refptr<fileinfo> &FirstDep,set< refptr<fileinfo> > &Autodeps)
{
/* Here we have to scan only c/c++ headers so skip certain extensions */
const char *pFullName=FirstDep->GetFullFileName().c_str();
@@ -550,11 +550,11 @@ void mhmakefileparser::GetAutoDeps(const refptr<fileinfo> &FirstDep, deps_t &Aut
/* Add the dependency when the file alrady exist or there is a rule available to be build */
if (BuildTarget(pInclude).DoesExist()) // Try to build the target, and add it if it exists after building
{
- deps_t::const_iterator pFind=Autodeps.find(pInclude);
+ set< refptr<fileinfo> >::iterator pFind=Autodeps.find(pInclude);
if (pFind==Autodeps.end())
{
Autodeps.insert(pInclude);
- GetAutoDepsIfNeeded(pInclude,pInclude);
+ GetAutoDeps(pInclude,Autodeps);
}
}
}
@@ -565,11 +565,11 @@ void mhmakefileparser::GetAutoDeps(const refptr<fileinfo> &FirstDep, deps_t &Aut
refptr<fileinfo> pInclude=GetFileInfo(IncludeFile,*It);
if (BuildTarget(pInclude).DoesExist()) // Try to build the target, and add it if it exists after building
{
- deps_t::const_iterator pFind=Autodeps.find(pInclude);
+ set< refptr<fileinfo> >::iterator pFind=Autodeps.find(pInclude);
if (pFind==Autodeps.end())
{
Autodeps.insert(pInclude);
- GetAutoDepsIfNeeded(pInclude,pInclude);
+ GetAutoDeps(pInclude,Autodeps);
}
break;
}
@@ -588,31 +588,12 @@ void mhmakefileparser::GetAutoDeps(const refptr<fileinfo> &FirstDep, deps_t &Aut
}
///////////////////////////////////////////////////////////////////////////////
-
-void mhmakefileparser::GetAutoDepsIfNeeded(const refptr<fileinfo> &Target, const refptr<fileinfo>&FirstDep)
-{
- autodeps_entry_t &Autodeps=m_AutoDeps[Target];
- if (!Autodeps.first)
- {
- Autodeps.first=true;
- /* We are going to rescan, so throw away the old. */
- Autodeps.second.clear();
- GetAutoDeps(FirstDep,Autodeps.second);
- // Now add these dependencies also to the rules
- deps_t::iterator It=Autodeps.second.begin();
- while (It!=Autodeps.second.end())
- {
- Target->AddDep(*It);
- It++;
- }
- }
-}
-
-///////////////////////////////////////////////////////////////////////////////
-
void mhmakefileparser::UpdateAutomaticDependencies(const refptr<fileinfo> &Target)
{
- m_AutoDepsDirty=true; /* Always assume dirty since in the autodeps file, the md5 strings are also saved. */
+ const char *pName=Target->GetFullFileName().c_str();
+ const char *pExt=strrchr(pName,'.');
+ if (!pExt)
+ return;
if (Target->IsAutoDepExtention())
{
// we have to search for the include files in the first dependency of Target
@@ -620,7 +601,18 @@ void mhmakefileparser::UpdateAutomaticDependencies(const refptr<fileinfo> &Targe
if (!Deps.size())
return; // There is no first dep
refptr<fileinfo> FirstDep=Deps[0];
- GetAutoDepsIfNeeded(Target,FirstDep);
+
+ set< refptr<fileinfo> > &Autodeps=m_AutoDeps[Target];
+ Autodeps.clear(); // We are going to scan again, so clear the list
+ GetAutoDeps(FirstDep,Autodeps);
+ // Now add these dependencies also to the rules
+ set< refptr<fileinfo> >::iterator It=Autodeps.begin();
+ while (It!=Autodeps.end())
+ {
+ Target->AddDep(*It);
+ It++;
+ }
+ m_AutoDepsDirty=true;
}
}
@@ -697,14 +689,14 @@ void mhmakefileparser::LoadAutoDepsFile(refptr<fileinfo> &DepFile)
while (FileName[0])
{
refptr<fileinfo> Target=GetFileInfo(FileName);
- autodeps_entry_t &Autodeps=m_AutoDeps[Target];
+ set< refptr<fileinfo> > &Autodeps=m_AutoDeps[Target];
ReadStr(pIn,FileName);
while (FileName[0])
{
if (!g_ForceAutoDepRescan) /* If we are forcing the autodepscan we do not have to load the dependencies. */
{
refptr<fileinfo> Dep=GetFileInfo(FileName);
- Autodeps.second.insert(Dep);
+ Autodeps.insert(Dep);
Target->AddDep(Dep);
}
ReadStr(pIn,FileName);
@@ -713,12 +705,15 @@ void mhmakefileparser::LoadAutoDepsFile(refptr<fileinfo> &DepFile)
}
uint32 Md5_32;
+ bool MakeNotDirty=true;
while (fread(&Md5_32,sizeof(Md5_32),1,pIn))
{
ReadStr(pIn,FileName);
pair <set<refptr<fileinfo>,less_refptrfileinfo >::iterator, bool> pPair=g_FileInfos.insert(new fileinfo(FileName,Md5_32));
if (!pPair.second)
{
+ if (!(*pPair.first)->CompareMd5_32(Md5_32) && !(*pPair.first)->CompareMd5_32(0))
+ MakeNotDirty=false; /* BuildTarget had set the dirty flag, but since the md5 did not change it was a false dirty. This is for BuildTargets called before this routine */
#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)->GetQuotedFullFileName()<<" Old: "<<hex<<(*pPair.first)->GetCommandsMd5_32()<<" New: "<<Md5_32<<endl;
@@ -729,6 +724,8 @@ void mhmakefileparser::LoadAutoDepsFile(refptr<fileinfo> &DepFile)
}
AddTarget(*pPair.first);
}
+ if (MakeNotDirty)
+ m_AutoDepsDirty=false;
fclose(pIn);
}
@@ -792,20 +789,17 @@ void mhmakefileparser::SaveAutoDepsFile()
fwrite(&Md5_32,sizeof(Md5_32),1,pOut);
fprintf(pOut,"%s\n",m_Variables[USED_ENVVARS].c_str());
- autodeps_t::const_iterator It=m_AutoDeps.begin();
+ map< refptr<fileinfo>, set< refptr<fileinfo> > >::const_iterator It=m_AutoDeps.begin();
while (It!=m_AutoDeps.end())
{
- if (!It->second.second.empty())
+ fprintf(pOut,"%s\n",It->first->GetFullFileName().c_str());
+ set< refptr<fileinfo> >::const_iterator DepIt=It->second.begin();
+ while (DepIt!=It->second.end())
{
- fprintf(pOut,"%s\n",It->first->GetFullFileName().c_str());
- deps_t::const_iterator DepIt=It->second.second.begin();
- while (DepIt!=It->second.second.end())
- {
- fprintf(pOut,"%s\n",(*DepIt)->GetFullFileName().c_str());
- DepIt++;
- }
- fprintf(pOut,"\n");
+ fprintf(pOut,"%s\n",(*DepIt)->GetFullFileName().c_str());
+ DepIt++;
}
+ fprintf(pOut,"\n");
It++;
}
/* Now save the Md5 strings */
diff --git a/tools/mhmake/src/mhmakefileparser.h b/tools/mhmake/src/mhmakefileparser.h
index 32d4ad88a..3afe84995 100644
--- a/tools/mhmake/src/mhmakefileparser.h
+++ b/tools/mhmake/src/mhmakefileparser.h
@@ -48,9 +48,6 @@ class fileinfoarray : public refbase,public vector<refptr<fileinfo> >
};
typedef set< refptr<fileinfo> > deps_t;
-typedef pair< bool, deps_t > autodeps_entry_t;
-typedef map< refptr<fileinfo>, autodeps_entry_t > autodeps_t;
-
class mhmakefileparser : public refbase
{
@@ -81,7 +78,7 @@ protected:
fileinfoarray m_IncludedMakefiles;
refptr< fileinfoarray > m_pIncludeDirs;
string m_IncludeDirs;
- autodeps_t m_AutoDeps;
+ map< refptr<fileinfo>, set< refptr<fileinfo> > > m_AutoDeps;
set< const fileinfo* , less_fileinfo > m_Targets; // List of targets that are build by this makefile
bool m_DoubleColonRule;
bool m_AutoDepsDirty;
@@ -158,10 +155,9 @@ public:
{
m_RuleThatIsBuild=NULL;
}
- void GetAutoDepsIfNeeded(const refptr<fileinfo> &Target, const refptr<fileinfo>&FirstDep);
void UpdateAutomaticDependencies(const refptr<fileinfo> &Target);
const refptr<fileinfoarray> GetIncludeDirs() const;
- void GetAutoDeps(const refptr<fileinfo> &FirstDep, deps_t &Autodeps);
+ void GetAutoDeps(const refptr<fileinfo> &FirstDep,set< refptr<fileinfo> > &Autodeps);
void SaveAutoDepsFile();
void LoadAutoDepsFile(refptr<fileinfo> &DepFile);
bool SkipHeaderFile(const string &FileName);
diff --git a/tools/mhmake/src/mhmakelexer.l b/tools/mhmake/src/mhmakelexer.l
index 0b25d4c74..00c9c3f9b 100644
--- a/tools/mhmake/src/mhmakelexer.l
+++ b/tools/mhmake/src/mhmakelexer.l
@@ -67,7 +67,7 @@ static void SaveMakMd5(refptr<fileinfo> &Target)
};\
int m_Line;\
int m_BraceIndent;\
- int m_IndentSkip;\
+ size_t m_IndentSkip;\
iterstack<int> m_IndentStack;\
bool m_IgnoreIncludeError;\
string m_InputFileName; \
@@ -567,7 +567,7 @@ export {
/*---------------------------------------------------------------------------*/
[a-zA-Z]:[a-zA-Z0-9\\\._\~\-%\@<&/]+\\[ \t\r]*\n {
- int EndIndex=::strlen((const char*)yytext);
+ size_t EndIndex=::strlen((const char*)yytext);
while (strchr(" \t\r\n\\",yytext[--EndIndex]));
yyless(EndIndex+1);
@@ -584,7 +584,7 @@ export {
/*---------------------------------------------------------------------------*/
([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*]|\\\ |\\#)+\\[ \t\r]*\n {
- int EndIndex=::strlen((const char*)yytext);
+ size_t EndIndex=::strlen((const char*)yytext);
while (strchr(" \t\r\n\\",yytext[--EndIndex]));
yyless(EndIndex+1);
@@ -594,7 +594,7 @@ export {
}
([a-zA-Z0-9\\\._\~\-\+%\@<&;/\*]|\\\ |\\#)+\+= {
- int Len;
+ size_t Len;
PRINTF(("%s %d: STRING: %s\n",m_InputFileName.c_str(),m_Line,yytext));
Len=strlen((const char *)yytext)-2;
yyless(Len);
@@ -727,7 +727,7 @@ export {
<COMMANDPARSE>[ \t]*\\#[^\n]* {
char ToAdd[100];
int i=0;
- int nChars=(strchr((const char *)yytext,'#')-(char*)yytext)+1;
+ int nChars=(int)((strchr((const char *)yytext,'#')-(char*)yytext))+1;
while (strchr(" \t",yytext[i]))
{
ToAdd[i]=yytext[i];
diff --git a/tools/mhmake/src/util.cpp b/tools/mhmake/src/util.cpp
index 0e227989a..9fc03ddad 100644
--- a/tools/mhmake/src/util.cpp
+++ b/tools/mhmake/src/util.cpp
@@ -231,7 +231,7 @@ bool PercentMatchList(const string &String,const string &ExprList,matchres *pRes
string ReplaceWithStem(const string &String,const string &Stem)
{
string Ret=String;
- int Pos=Ret.find('%');
+ size_t Pos=Ret.find('%');
while (Pos!=string::npos)
{
Ret=Ret.substr(0,Pos)+Stem+Ret.substr(Pos+1);
@@ -309,7 +309,7 @@ loadedmakefile::loadedmakefile(vector<string> &Args,const string&Makefile)
vector<string>::iterator ArgIt=Args.begin();
while (ArgIt!=Args.end())
{
- int EqPos=ArgIt->find('=');
+ size_t EqPos=ArgIt->find('=');
if (EqPos!=string::npos)
{
string Var=ArgIt->substr(0,EqPos);
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index 1634f5135..25db10e48 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "1.4.8"
+#define MHMAKEVER "1.4.10"
string SearchCommand(const string &Command, const string &Extension="");