mirror of
https://github.com/reactos/reactos.git
synced 2025-07-24 17:03:37 +00:00
bugfixes to new <if> and related code
svn path=/branches/xmlbuildsystem/; revision=13016
This commit is contained in:
parent
c869f797fb
commit
84c57ede37
8 changed files with 133 additions and 107 deletions
|
@ -8,11 +8,13 @@
|
|||
</xi:include>
|
||||
|
||||
<define name="_M_IX86" />
|
||||
<if property="dbg" value="true">
|
||||
<define name="dbg_or_kdbg" value="true" />
|
||||
<if property="DBG" value="1">
|
||||
<define name="DBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
<if property="kdbg" value="true">
|
||||
<define name="dbg_or_kdbg" value="true" />
|
||||
<if property="KDBG" value="1">
|
||||
<define name="KDBG" value="1" />
|
||||
<property name="DBG_OR_KDBG" value="true" />
|
||||
</if>
|
||||
|
||||
<include>include</include>
|
||||
|
|
|
@ -59,39 +59,79 @@ MingwBackend::GenerateHeader ()
|
|||
fprintf ( fMakefile, "# THIS FILE IS AUTOMATICALLY GENERATED, EDIT 'ReactOS.xml' INSTEAD\n\n" );
|
||||
}
|
||||
|
||||
string
|
||||
MingwBackend::GenerateProjectCFLAGS ()
|
||||
void
|
||||
MingwBackend::GenerateGlobalCFlagsAndProperties (
|
||||
const char* op,
|
||||
const vector<Property*>& properties,
|
||||
const vector<Include*>& includes,
|
||||
const vector<Define*>& defines,
|
||||
const vector<If*>& ifs )
|
||||
{
|
||||
size_t i;
|
||||
string clags;
|
||||
for ( i = 0; i < ProjectNode.includes.size (); i++ )
|
||||
|
||||
for ( i = 0; i < properties.size(); i++ )
|
||||
{
|
||||
Include& include = *ProjectNode.includes[i];
|
||||
if (clags.length () > 0)
|
||||
clags += " ";
|
||||
clags += "-I" + include.directory;
|
||||
Property& prop = *properties[i];
|
||||
fprintf ( fMakefile, "%s := %s\n",
|
||||
prop.name.c_str(),
|
||||
prop.value.c_str() );
|
||||
}
|
||||
|
||||
for ( i = 0; i < ProjectNode.defines.size (); i++ )
|
||||
|
||||
if ( includes.size() || defines.size() )
|
||||
{
|
||||
Define& define = *ProjectNode.defines[i];
|
||||
if ( clags.length () > 0 )
|
||||
clags += " ";
|
||||
clags += "-D" + define.name;
|
||||
if ( define.value.size() > 0 )
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"PROJECT_CFLAGS %s",
|
||||
op );
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
{
|
||||
clags += "=";
|
||||
clags += define.value;
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" -I%s",
|
||||
includes[i]->directory.c_str() );
|
||||
}
|
||||
for ( i = 0; i < defines.size(); i++ )
|
||||
{
|
||||
Define& d = *defines[i];
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" -D%s",
|
||||
d.name.c_str() );
|
||||
if ( d.value.size() )
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"=%s",
|
||||
d.value.c_str() );
|
||||
}
|
||||
fprintf ( fMakefile, "\n" );
|
||||
}
|
||||
|
||||
for ( i = 0; i < ifs.size(); i++ )
|
||||
{
|
||||
If& rIf = *ifs[i];
|
||||
if ( rIf.defines.size() || rIf.includes.size() || rIf.ifs.size() )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"ifeq (\"$(%s)\",\"%s\")\n",
|
||||
rIf.property.c_str(),
|
||||
rIf.value.c_str() );
|
||||
GenerateGlobalCFlagsAndProperties (
|
||||
"+=",
|
||||
rIf.properties,
|
||||
rIf.includes,
|
||||
rIf.defines,
|
||||
rIf.ifs );
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"endif\n\n" );
|
||||
}
|
||||
}
|
||||
return clags;
|
||||
}
|
||||
|
||||
void
|
||||
MingwBackend::GenerateGlobalVariables ()
|
||||
{
|
||||
size_t i;
|
||||
|
||||
fprintf ( fMakefile, "host_gcc = gcc\n" );
|
||||
fprintf ( fMakefile, "host_ar = ar\n" );
|
||||
fprintf ( fMakefile, "host_ld = ld\n" );
|
||||
|
@ -99,15 +139,13 @@ MingwBackend::GenerateGlobalVariables ()
|
|||
fprintf ( fMakefile, "gcc = gcc\n" );
|
||||
fprintf ( fMakefile, "ld = ld\n" );
|
||||
fprintf ( fMakefile, "ar = ar\n" );
|
||||
fprintf ( fMakefile, "dlltool = dlltool\n" );
|
||||
fprintf ( fMakefile, "PROJECT_CFLAGS = %s\n", GenerateProjectCFLAGS ().c_str () );
|
||||
for ( i = 0; i < ProjectNode.properties.size(); i++ )
|
||||
{
|
||||
Property& prop = *ProjectNode.properties[i];
|
||||
fprintf ( fMakefile, "%s := %s\n",
|
||||
prop.name.c_str(),
|
||||
prop.value.c_str() );
|
||||
}
|
||||
fprintf ( fMakefile, "dlltool = dlltool\n\n" );
|
||||
GenerateGlobalCFlagsAndProperties (
|
||||
"=",
|
||||
ProjectNode.properties,
|
||||
ProjectNode.includes,
|
||||
ProjectNode.defines,
|
||||
ProjectNode.ifs );
|
||||
fprintf ( fMakefile, "\n" );
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,13 @@ private:
|
|||
void CreateMakefile ();
|
||||
void CloseMakefile ();
|
||||
void GenerateHeader ();
|
||||
std::string GenerateProjectCFLAGS ();
|
||||
void
|
||||
MingwBackend::GenerateGlobalCFlagsAndProperties (
|
||||
const char* op,
|
||||
const std::vector<Property*>& properties,
|
||||
const std::vector<Include*>& includes,
|
||||
const std::vector<Define*>& defines,
|
||||
const std::vector<If*>& ifs );
|
||||
void GenerateGlobalVariables ();
|
||||
void GenerateAllTarget ();
|
||||
FILE* fMakefile;
|
||||
|
|
|
@ -262,34 +262,34 @@ MingwModuleHandler::GenerateGccIncludeParameters ( const Module& module ) const
|
|||
|
||||
void
|
||||
MingwModuleHandler::GenerateMacros (
|
||||
const Module& module,
|
||||
const char* op,
|
||||
const vector<File*>& files,
|
||||
const vector<Include*>* includes,
|
||||
const vector<Include*>& includes,
|
||||
const vector<Define*>& defines,
|
||||
const vector<If*>* ifs,
|
||||
const vector<If*>& ifs,
|
||||
const string& cflags_macro,
|
||||
const string& nasmflags_macro,
|
||||
const string& objs_macro) const
|
||||
{
|
||||
size_t i;
|
||||
|
||||
if ( (includes && includes->size()) || defines.size() )
|
||||
if ( includes.size() || defines.size() )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s %s",
|
||||
cflags_macro.c_str(),
|
||||
op );
|
||||
if ( includes )
|
||||
for ( i = 0; i < includes->size(); i++ )
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" -I%s",
|
||||
(*includes)[i]->directory.c_str() );
|
||||
for ( i = 0; i < module.defines.size(); i++ )
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
{
|
||||
Define& d = *module.defines[i];
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" -I%s",
|
||||
includes[i]->directory.c_str() );
|
||||
}
|
||||
for ( i = 0; i < defines.size(); i++ )
|
||||
{
|
||||
Define& d = *defines[i];
|
||||
fprintf (
|
||||
fMakefile,
|
||||
" -D%s",
|
||||
|
@ -321,32 +321,28 @@ MingwModuleHandler::GenerateMacros (
|
|||
fprintf ( fMakefile, "\n" );
|
||||
}
|
||||
|
||||
if ( ifs && ifs->size() )
|
||||
for ( i = 0; i < ifs.size(); i++ )
|
||||
{
|
||||
for ( size_t i = 0; i < ifs->size(); i++ )
|
||||
If& rIf = *ifs[i];
|
||||
if ( rIf.defines.size() || rIf.includes.size() || rIf.files.size() || rIf.ifs.size() )
|
||||
{
|
||||
If& rIf = *(*ifs)[i];
|
||||
if ( rIf.defines.size() || rIf.files.size() || rIf.ifs.size() )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"ifeq ($(%s),\"%s\")\n",
|
||||
rIf.property.c_str(),
|
||||
rIf.value.c_str() );
|
||||
GenerateMacros (
|
||||
module,
|
||||
"+=",
|
||||
rIf.files,
|
||||
NULL,
|
||||
rIf.defines,
|
||||
&rIf.ifs,
|
||||
cflags_macro,
|
||||
nasmflags_macro,
|
||||
objs_macro );
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"endif\n\n" );
|
||||
}
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"ifeq ($(%s),\"%s\")\n",
|
||||
rIf.property.c_str(),
|
||||
rIf.value.c_str() );
|
||||
GenerateMacros (
|
||||
"+=",
|
||||
rIf.files,
|
||||
rIf.includes,
|
||||
rIf.defines,
|
||||
rIf.ifs,
|
||||
cflags_macro,
|
||||
nasmflags_macro,
|
||||
objs_macro );
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"endif\n\n" );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -359,42 +355,16 @@ MingwModuleHandler::GenerateMacros (
|
|||
const string& objs_macro) const
|
||||
{
|
||||
GenerateMacros (
|
||||
module,
|
||||
"=",
|
||||
module.files,
|
||||
&module.includes,
|
||||
module.includes,
|
||||
module.defines,
|
||||
NULL,
|
||||
module.ifs,
|
||||
cflags_macro,
|
||||
nasmflags_macro,
|
||||
objs_macro );
|
||||
fprintf ( fMakefile, "\n" );
|
||||
|
||||
for ( size_t i = 0; i < module.ifs.size(); i++ )
|
||||
{
|
||||
If& rIf = *module.ifs[i];
|
||||
if ( rIf.defines.size() || rIf.files.size() || rIf.ifs.size() )
|
||||
{
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"ifeq (\"$(%s)\",\"%s\")\n",
|
||||
rIf.property.c_str(),
|
||||
rIf.value.c_str() );
|
||||
GenerateMacros (
|
||||
module,
|
||||
"+=",
|
||||
rIf.files,
|
||||
NULL,
|
||||
rIf.defines,
|
||||
&rIf.ifs,
|
||||
cflags_macro,
|
||||
nasmflags_macro,
|
||||
objs_macro );
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"endif\n\n" );
|
||||
}
|
||||
}
|
||||
fprintf (
|
||||
fMakefile,
|
||||
"%s += $(PROJECT_CFLAGS)\n\n",
|
||||
|
|
|
@ -46,12 +46,11 @@ private:
|
|||
std::string GenerateGccDefineParametersFromVector ( const std::vector<Define*>& defines ) const;
|
||||
std::string GenerateGccDefineParameters ( const Module& module ) const;
|
||||
std::string GenerateGccIncludeParametersFromVector ( const std::vector<Include*>& includes ) const;
|
||||
void GenerateMacros ( const Module& module,
|
||||
const char* op,
|
||||
void GenerateMacros ( const char* op,
|
||||
const std::vector<File*>& files,
|
||||
const std::vector<Include*>* includes,
|
||||
const std::vector<Include*>& includes,
|
||||
const std::vector<Define*>& defines,
|
||||
const std::vector<If*>* ifs,
|
||||
const std::vector<If*>& ifs,
|
||||
const std::string& cflags_macro,
|
||||
const std::string& nasmflags_macro,
|
||||
const std::string& objs_macro) const;
|
||||
|
|
|
@ -122,11 +122,11 @@ Module::ProcessXMLSubElement ( const XMLElement& e,
|
|||
}
|
||||
else if ( e.name == "include" )
|
||||
{
|
||||
Include* include = new Include ( project, this, e );
|
||||
if ( pIf )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<include> is not a valid sub-element of <if>" );
|
||||
includes.push_back ( new Include ( project, this, e ) );
|
||||
pIf->includes.push_back ( include );
|
||||
else
|
||||
includes.push_back ( include );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "define" )
|
||||
|
@ -513,6 +513,8 @@ If::~If ()
|
|||
size_t i;
|
||||
for ( i = 0; i < files.size(); i++ )
|
||||
delete files[i];
|
||||
for ( i = 0; i < includes.size(); i++ )
|
||||
delete includes[i];
|
||||
for ( i = 0; i < defines.size(); i++ )
|
||||
delete defines[i];
|
||||
for ( i = 0; i < ifs.size(); i++ )
|
||||
|
|
|
@ -96,6 +96,10 @@ Project::ProcessXMLSubElement ( const XMLElement& e,
|
|||
string subpath(path);
|
||||
if ( e.name == "module" )
|
||||
{
|
||||
if ( pIf )
|
||||
throw InvalidBuildFileException (
|
||||
e.location,
|
||||
"<module> is not a valid sub-element of <if>" );
|
||||
Module* module = new Module ( *this, e, path );
|
||||
if ( LocateModule ( module->name ) )
|
||||
throw InvalidBuildFileException (
|
||||
|
@ -114,7 +118,11 @@ Project::ProcessXMLSubElement ( const XMLElement& e,
|
|||
}
|
||||
else if ( e.name == "include" )
|
||||
{
|
||||
includes.push_back ( new Include ( *this, e ) );
|
||||
Include* include = new Include ( *this, e );
|
||||
if ( pIf )
|
||||
pIf->includes.push_back ( include );
|
||||
else
|
||||
includes.push_back ( include );
|
||||
subs_invalid = true;
|
||||
}
|
||||
else if ( e.name == "define" )
|
||||
|
|
|
@ -256,6 +256,7 @@ public:
|
|||
const Module* module;
|
||||
std::string property, value;
|
||||
std::vector<File*> files;
|
||||
std::vector<Include*> includes;
|
||||
std::vector<Define*> defines;
|
||||
std::vector<Property*> properties;
|
||||
std::vector<If*> ifs;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue