diff --git a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp b/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
index 0c45284692e..3960526c992 100644
--- a/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
+++ b/reactos/tools/rbuild/backend/codeblocks/codeblocks.cpp
@@ -37,6 +37,7 @@ using std::ifstream;
#undef OUT
#endif//OUT
+#define IsStaticLibrary( module ) ( ( module.type == StaticLibrary ) || ( module.type == HostStaticLibrary ) )
static class CBFactory : public Backend::Factory
{
@@ -497,7 +498,7 @@ CBBackend::_generate_cbproj ( const Module& module )
if ( !module.allowWarnings )
compiler_flags.push_back ( "-Werror" );
- if ( module.type == StaticLibrary && module.isStartupLib )
+ if ( IsStaticLibrary ( module ) && module.isStartupLib )
compiler_flags.push_back ( "-Wno-main" );
@@ -524,7 +525,7 @@ CBBackend::_generate_cbproj ( const Module& module )
if ( configuration.UseConfigurationInPath )
{
- if ( module.type == StaticLibrary ||module.type == ObjectLibrary )
+ if ( IsStaticLibrary ( module ) ||module.type == ObjectLibrary )
fprintf ( OUT, "\t\t\t\t\r\n", intdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str());
else
fprintf ( OUT, "\t\t\t\t\r\n", outdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str());
@@ -532,7 +533,7 @@ CBBackend::_generate_cbproj ( const Module& module )
}
else
{
- if ( module.type == StaticLibrary || module.type == ObjectLibrary )
+ if ( IsStaticLibrary ( module ) || module.type == ObjectLibrary )
fprintf ( OUT, "\t\t\t\t\r\n", intdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() );
else
fprintf ( OUT, "\t\t\t\t\r\n", outdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() );
@@ -672,7 +673,7 @@ CBBackend::_generate_cbproj ( const Module& module )
fprintf ( OUT, "\t\t\t\t\r\n" );
#if 0
- if ( module.type == StaticLibrary && module.importLibrary )
+ if ( IsStaticLibrary ( module ) && module.importLibrary )
fprintf ( OUT, "\t\t\t\t\t\r\n", module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" );
else if ( module.importLibrary != NULL )
fprintf ( OUT, "\t\t\t\t\t\r\n", module.GetTargetName ().c_str(), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" );
diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
index 7568a2ead4e..bdcddc42861 100644
--- a/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
+++ b/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
@@ -30,6 +30,7 @@ using std::string;
using std::vector;
#define CLEAN_FILE(f) clean_files.push_back ( (f).name.length () > 0 ? backend->GetFullName ( f ) : backend->GetFullPath ( f ) );
+#define IsStaticLibrary( module ) ( ( module.type == StaticLibrary ) || ( module.type == HostStaticLibrary ) )
MingwBackend*
MingwModuleHandler::backend = NULL;
@@ -170,6 +171,9 @@ MingwModuleHandler::InstanciateHandler (
case StaticLibrary:
handler = new MingwStaticLibraryModuleHandler ( module );
break;
+ case HostStaticLibrary:
+ handler = new MingwHostStaticLibraryModuleHandler ( module );
+ break;
case ObjectLibrary:
handler = new MingwObjectLibraryModuleHandler ( module );
break;
@@ -359,7 +363,7 @@ MingwModuleHandler::GetCompilationUnitDependencies (
const FileLocation*
MingwModuleHandler::GetModuleArchiveFilename () const
{
- if ( module.type == StaticLibrary )
+ if ( IsStaticLibrary ( module ) )
return GetTargetFilename ( module, NULL );
return new FileLocation ( IntermediateDirectory,
module.output->relative_path,
@@ -1842,7 +1846,7 @@ MingwModuleHandler::GenerateArchiveTarget ()
arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
- if ( module.type == StaticLibrary && module.importLibrary )
+ if ( IsStaticLibrary ( module ) && module.importLibrary )
{
const FileLocation *definitionFilename = GetDefinitionFilename ();
@@ -2016,11 +2020,14 @@ MingwModuleHandler::GenerateOtherMacros ()
&module.linkerFlags,
used_defs );
- GenerateMacros (
- "+=",
- module.project.non_if_data,
- NULL,
- used_defs );
+ if ( module.host == HostFalse )
+ {
+ GenerateMacros (
+ "+=",
+ module.project.non_if_data,
+ NULL,
+ used_defs );
+ }
vector s;
if ( module.importLibrary )
@@ -2048,7 +2055,12 @@ MingwModuleHandler::GenerateOtherMacros ()
fprintf ( fMakefile, "\n" );
}
- string globalCflags = "-g";
+ string globalCflags = "";
+ if ( module.host == HostFalse )
+ globalCflags += " $(PROJECT_CFLAGS)";
+ else
+ globalCflags += " -Wall -Wpointer-arith -D__REACTOS__";
+ globalCflags += " -g";
if ( backend->usePipe )
globalCflags += " -pipe";
if ( !module.allowWarnings )
@@ -2058,7 +2070,7 @@ MingwModuleHandler::GenerateOtherMacros ()
if ( module.cplusplus )
globalCflags += " $(HOST_CPPFLAGS)";
else
- globalCflags += " $(HOST_CFLAGS)";
+ globalCflags += " -Wno-strict-aliasing $(HOST_CFLAGS)";
}
else
{
@@ -2077,25 +2089,35 @@ MingwModuleHandler::GenerateOtherMacros ()
fprintf (
fMakefile,
- "%s += $(PROJECT_CFLAGS) %s\n",
+ "%s +=%s\n",
cflagsMacro.c_str (),
globalCflags.c_str () );
- fprintf (
- fMakefile,
- "%s += $(PROJECT_RCFLAGS)\n",
- windresflagsMacro.c_str () );
+ if ( module.host == HostFalse )
+ {
+ fprintf (
+ fMakefile,
+ "%s += $(PROJECT_RCFLAGS)\n",
+ windresflagsMacro.c_str () );
- fprintf (
- fMakefile,
- "%s += $(PROJECT_WIDLFLAGS) -I%s\n",
- widlflagsMacro.c_str (),
- module.output->relative_path.c_str () );
+ fprintf (
+ fMakefile,
+ "%s += $(PROJECT_WIDLFLAGS) -I%s\n",
+ widlflagsMacro.c_str (),
+ module.output->relative_path.c_str () );
- fprintf (
- fMakefile,
- "%s_LFLAGS += $(PROJECT_LFLAGS) -g\n",
- module.name.c_str () );
+ fprintf (
+ fMakefile,
+ "%s_LFLAGS += $(PROJECT_LFLAGS) -g\n",
+ module.name.c_str () );
+ }
+ else
+ {
+ fprintf (
+ fMakefile,
+ "%s_LFLAGS += $(HOST_LFLAGS)\n",
+ module.name.c_str () );
+ }
fprintf (
fMakefile,
@@ -2130,7 +2152,7 @@ MingwModuleHandler::GenerateOtherMacros ()
linkerflags.c_str () );
}
- if ( module.type == StaticLibrary && module.isStartupLib )
+ if ( IsStaticLibrary ( module ) && module.isStartupLib )
{
fprintf ( fMakefile,
"%s += -Wno-main\n\n",
@@ -2596,6 +2618,26 @@ MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ()
}
+MingwHostStaticLibraryModuleHandler::MingwHostStaticLibraryModuleHandler (
+ const Module& module_ )
+
+ : MingwModuleHandler ( module_ )
+{
+}
+
+void
+MingwHostStaticLibraryModuleHandler::Process ()
+{
+ GenerateHostStaticLibraryModuleTarget ();
+}
+
+void
+MingwHostStaticLibraryModuleHandler::GenerateHostStaticLibraryModuleTarget ()
+{
+ GenerateRules ();
+}
+
+
MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler (
const Module& module_ )
diff --git a/reactos/tools/rbuild/backend/mingw/modulehandler.h b/reactos/tools/rbuild/backend/mingw/modulehandler.h
index bc8ceddb870..102cf80ae58 100644
--- a/reactos/tools/rbuild/backend/mingw/modulehandler.h
+++ b/reactos/tools/rbuild/backend/mingw/modulehandler.h
@@ -226,6 +226,17 @@ private:
};
+class MingwHostStaticLibraryModuleHandler : public MingwModuleHandler
+{
+public:
+ MingwHostStaticLibraryModuleHandler ( const Module& module );
+ virtual HostType DefaultHost() { return HostTrue; }
+ virtual void Process ();
+private:
+ void GenerateHostStaticLibraryModuleTarget ();
+};
+
+
class MingwObjectLibraryModuleHandler : public MingwModuleHandler
{
public:
diff --git a/reactos/tools/rbuild/bootstrap.cpp b/reactos/tools/rbuild/bootstrap.cpp
index 277f8676348..fdd68bc7aa6 100644
--- a/reactos/tools/rbuild/bootstrap.cpp
+++ b/reactos/tools/rbuild/bootstrap.cpp
@@ -57,6 +57,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
return true;
case BuildTool:
case StaticLibrary:
+ case HostStaticLibrary:
case ObjectLibrary:
case Iso:
case LiveIso:
diff --git a/reactos/tools/rbuild/module.cpp b/reactos/tools/rbuild/module.cpp
index d439e18901e..4af7adef2f7 100644
--- a/reactos/tools/rbuild/module.cpp
+++ b/reactos/tools/rbuild/module.cpp
@@ -880,6 +880,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
return BuildTool;
if ( attribute.value == "staticlibrary" )
return StaticLibrary;
+ if ( attribute.value == "hoststaticlibrary" )
+ return HostStaticLibrary;
if ( attribute.value == "objectlibrary" )
return ObjectLibrary;
if ( attribute.value == "kernel" )
@@ -965,6 +967,7 @@ Module::GetTargetDirectoryTree () const
case ElfExecutable:
return OutputDirectory;
case StaticLibrary:
+ case HostStaticLibrary:
case ObjectLibrary:
case RpcServer:
case RpcClient:
@@ -990,6 +993,7 @@ Module::GetDefaultModuleExtension () const
return ExePostfix;
case BootProgram:
case StaticLibrary:
+ case HostStaticLibrary:
return ".a";
case ObjectLibrary:
return ".o";
@@ -1067,6 +1071,7 @@ Module::GetDefaultModuleEntrypoint () const
return "WinMainCRTStartup";
case BuildTool:
case StaticLibrary:
+ case HostStaticLibrary:
case ObjectLibrary:
case BootLoader:
case BootSector:
@@ -1115,6 +1120,7 @@ Module::GetDefaultModuleBaseaddress () const
return "0xe00000";
case BuildTool:
case StaticLibrary:
+ case HostStaticLibrary:
case ObjectLibrary:
case BootLoader:
case BootSector:
@@ -1140,7 +1146,7 @@ Module::GetDefaultModuleBaseaddress () const
bool
Module::HasImportLibrary () const
{
- return importLibrary != NULL && type != StaticLibrary;
+ return importLibrary != NULL && type != StaticLibrary && type != HostStaticLibrary;
}
bool
@@ -1162,6 +1168,7 @@ Module::IsDLL () const
case Win32GUI:
case BuildTool:
case StaticLibrary:
+ case HostStaticLibrary:
case ObjectLibrary:
case BootLoader:
case BootSector:
@@ -1613,7 +1620,7 @@ ImportLibrary::ImportLibrary ( const Project& project,
if ( dllname )
this->dllname = dllname->value;
- else if ( module.type == StaticLibrary )
+ else if ( module.type == StaticLibrary || module.type == HostStaticLibrary )
throw XMLInvalidBuildFileException (
node.location,
" dllname attribute required." );
diff --git a/reactos/tools/rbuild/rbuild.h b/reactos/tools/rbuild/rbuild.h
index 25986f2aaae..1e0f4313387 100644
--- a/reactos/tools/rbuild/rbuild.h
+++ b/reactos/tools/rbuild/rbuild.h
@@ -300,6 +300,7 @@ enum ModuleType
EmbeddedTypeLib = 26,
ElfExecutable = 27,
RpcProxy,
+ HostStaticLibrary,
TypeDontCare,
};