aboutsummaryrefslogtreecommitdiff
path: root/tools/mhmake/src
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2010-08-04 09:37:27 +0000
committermarha <marha@users.sourceforge.net>2010-08-04 09:37:27 +0000
commitf19a1f2d41337986c94cecfd348aca32a5445993 (patch)
treeb50688dc07bfb1afadb4649d175bcbc64f1eb754 /tools/mhmake/src
parent240baf59a219841c5f8942c82f7ed61da9d2323b (diff)
downloadvcxsrv-f19a1f2d41337986c94cecfd348aca32a5445993.tar.gz
vcxsrv-f19a1f2d41337986c94cecfd348aca32a5445993.tar.bz2
vcxsrv-f19a1f2d41337986c94cecfd348aca32a5445993.zip
Added possibility to force a dependency scan on a target with .AUTODEPS
Diffstat (limited to 'tools/mhmake/src')
-rw-r--r--tools/mhmake/src/build.cpp2
-rw-r--r--tools/mhmake/src/fileinfo.h14
-rw-r--r--tools/mhmake/src/mhmakefileparser.cpp15
-rw-r--r--tools/mhmake/src/mhmakefileparser.h1
-rw-r--r--tools/mhmake/src/mhmakelexer.l6
-rw-r--r--tools/mhmake/src/mhmakeparser.y21
-rw-r--r--tools/mhmake/src/util.h2
7 files changed, 58 insertions, 3 deletions
diff --git a/tools/mhmake/src/build.cpp b/tools/mhmake/src/build.cpp
index 57cd94b79..ed02266b3 100644
--- a/tools/mhmake/src/build.cpp
+++ b/tools/mhmake/src/build.cpp
@@ -1627,6 +1627,8 @@ mh_time_t mhmakefileparser::StartBuildTarget(const refptr<fileinfo> &Target,bool
if (pMakefile->ForceAutoDepRescan()||MakeTarget==true)
pMakefile->UpdateAutomaticDependencies(Target);
}
+ else if (Target->GetAutoDepsMakefile())
+ Target->GetAutoDepsMakefile()->UpdateNoRuleAutomaticDependencies(Target);
BuildDependencies(pRule,Target,TargetDate,YoungestDate,MakeTarget);
diff --git a/tools/mhmake/src/fileinfo.h b/tools/mhmake/src/fileinfo.h
index 6c9800f38..e221293e6 100644
--- a/tools/mhmake/src/fileinfo.h
+++ b/tools/mhmake/src/fileinfo.h
@@ -136,6 +136,7 @@ class fileinfo : public refbase
bool m_IsPhony;
int m_BuildStatus; /* Bit 0 means the target built is started, Bit 1 means the target is still building */
refptr<rule> m_pRule;
+ mhmakeparser *m_pAutoDepsMakefile;
vector< refptr<fileinfo> > m_Deps;
mh_time_t m_Date;
uint32 m_CommandsMd5_32; // 32-bit Md5 checksum of commands to build this target
@@ -147,6 +148,7 @@ public:
fileinfo(const string &AbsFileName,uint32 Md5_32)
{
m_IsPhony=false;
+ m_pAutoDepsMakefile=NULL;
m_BuildStatus=0;
m_AbsFileName=UnquoteFileName(AbsFileName);
InvalidateDate();
@@ -292,6 +294,18 @@ public:
return m_Deps;
}
string GetPrerequisits(void) const;
+ void SetAutoDepsScan(mhmakeparser *pMakefile)
+ {
+ #ifdef _DEBUG
+ if (m_pAutoDepsMakefile)
+ throw(string(".AUTODEPS can only defined ones for rule ")+GetFullFileName());
+ #endif
+ m_pAutoDepsMakefile=pMakefile;
+ }
+ mhmakeparser *GetAutoDepsMakefile(void) const
+ {
+ return m_pAutoDepsMakefile;
+ }
void SetPhony(void)
{
m_IsPhony=true;
diff --git a/tools/mhmake/src/mhmakefileparser.cpp b/tools/mhmake/src/mhmakefileparser.cpp
index 30916878e..35d379cd0 100644
--- a/tools/mhmake/src/mhmakefileparser.cpp
+++ b/tools/mhmake/src/mhmakefileparser.cpp
@@ -642,6 +642,21 @@ void mhmakefileparser::UpdateAutomaticDependencies(const refptr<fileinfo> &Targe
}
///////////////////////////////////////////////////////////////////////////////
+void mhmakefileparser::UpdateNoRuleAutomaticDependencies(const refptr<fileinfo> &Target)
+{
+ // we have to search for the include files in the Target
+ set< refptr<fileinfo> > Autodeps;
+ GetAutoDeps(Target,Autodeps);
+ // Now add these dependencies also to the rules
+ set< refptr<fileinfo> >::iterator It=Autodeps.begin();
+ while (It!=Autodeps.end())
+ {
+ Target->AddDep(*It);
+ It++;
+ }
+}
+
+///////////////////////////////////////////////////////////////////////////////
const refptr<fileinfoarray> mhmakefileparser::GetIncludeDirs() const
{
string Includes=ExpandExpression("$(INCLUDES)");
diff --git a/tools/mhmake/src/mhmakefileparser.h b/tools/mhmake/src/mhmakefileparser.h
index b37e96466..048435f34 100644
--- a/tools/mhmake/src/mhmakefileparser.h
+++ b/tools/mhmake/src/mhmakefileparser.h
@@ -198,6 +198,7 @@ public:
m_RuleThatIsBuild=NULL;
}
void UpdateAutomaticDependencies(const refptr<fileinfo> &Target);
+ void UpdateNoRuleAutomaticDependencies(const refptr<fileinfo> &Target);
const refptr<fileinfoarray> GetIncludeDirs() const;
void GetAutoDeps(const refptr<fileinfo> &FirstDep,set< refptr<fileinfo> > &Autodeps);
void SaveAutoDepsFile();
diff --git a/tools/mhmake/src/mhmakelexer.l b/tools/mhmake/src/mhmakelexer.l
index 5e73dd812..d64d7cc5c 100644
--- a/tools/mhmake/src/mhmakelexer.l
+++ b/tools/mhmake/src/mhmakelexer.l
@@ -559,6 +559,12 @@ load_makefile {
}
/*---------------------------------------------------------------------------*/
+\.AUTODEPS {
+ PRINTF(("%s %d: .AUTODEPS: %s\n",m_InputFileName.c_str(),m_Line,yytext));
+ return mhmakeparser::AUTODEPS;
+}
+
+ /*---------------------------------------------------------------------------*/
export {
PRINTF(("%s %d: export: %s\n",m_InputFileName.c_str(),m_Line,yytext));
return mhmakeparser::EXPORT;
diff --git a/tools/mhmake/src/mhmakeparser.y b/tools/mhmake/src/mhmakeparser.y
index 2b2e11411..c11c84319 100644
--- a/tools/mhmake/src/mhmakeparser.y
+++ b/tools/mhmake/src/mhmakeparser.y
@@ -42,7 +42,7 @@
%token <theString> COMMAND
%token <theString> COMMA OPENBRACE CLOSEBRACE
%token <theString> STRING DOLLAREXPR EQUAL COLON DOUBLECOLON
-%token IMEQUAL PEQUAL OPTEQUAL PHONY EXPORT NEWLINE INCLUDEMAK SPACE
+%token IMEQUAL PEQUAL OPTEQUAL PHONY AUTODEPS EXPORT NEWLINE INCLUDEMAK SPACE
%type <theString> expression nonspaceexpression simpleexpression
%type <theString> maybeemptyexpression
@@ -72,6 +72,7 @@ statement: NEWLINE |
includemak |
ruledef |
phonyrule |
+ autodepsrule |
varassignment |
imvarassignment |
pvarassignment |
@@ -142,6 +143,22 @@ phonyrule: PHONY COLON expression
NEWLINE
;
+autodepsrule: AUTODEPS COLON expression
+ {
+ vector< refptr<fileinfo> > Items;
+ SplitToItems(ExpandExpression($3),Items);
+ vector< refptr<fileinfo> >::iterator pIt=Items.begin();
+ while (pIt!=Items.end())
+ {
+ (*pIt)->SetAutoDepsScan(this);
+ pIt++;
+ }
+ PRINTF(("Defining autodeps rule : %s\n",$3.c_str()));
+ PRINTF((" Expanded to : %s\n",ExpandExpression($3).c_str()));
+ }
+ NEWLINE
+;
+
exportrule: EXPORT SPACE exportstrings NEWLINE
;
@@ -189,7 +206,7 @@ optvarassignment: STRING OPTEQUAL maybeemptyexpression
maybeemptyexpression: NEWLINE {$$=g_EmptyString;} |
expression NEWLINE |
- expression SPACE NEWLINE
+ expression SPACE NEWLINE
;
expression: nonspaceexpression |
diff --git a/tools/mhmake/src/util.h b/tools/mhmake/src/util.h
index 9f8ab5b9b..ef874eb96 100644
--- a/tools/mhmake/src/util.h
+++ b/tools/mhmake/src/util.h
@@ -50,7 +50,7 @@
#define PLATFORM "linux"
#endif
-#define MHMAKEVER "2.0.6"
+#define MHMAKEVER "2.1.0"
class makecommand
{