typedef set<string> set_string;
-static const struct
-{
- HostType DefaultHost;
-} ModuleHandlerInformations[] = {
- { HostTrue }, // BuildTool
- { HostFalse }, // StaticLibrary
- { HostFalse }, // ObjectLibrary
- { HostFalse }, // Kernel
- { HostFalse }, // KernelModeDLL
- { HostFalse }, // KernelModeDriver
- { HostFalse }, // NativeDLL
- { HostFalse }, // NativeCUI
- { HostFalse }, // Win32DLL
- { HostFalse }, // Win32OCX
- { HostFalse }, // Win32CUI
- { HostFalse }, // Win32GUI
- { HostFalse }, // BootLoader
- { HostFalse }, // BootSector
- { HostFalse }, // Iso
- { HostFalse }, // LiveIso
- { HostFalse }, // Test
- { HostFalse }, // RpcServer
- { HostFalse }, // RpcClient
- { HostFalse }, // Alias
- { HostFalse }, // BootProgram
- { HostFalse }, // Win32SCR
- { HostFalse }, // IdlHeader
- { HostFalse }, // IsoRegTest
- { HostFalse }, // LiveIsoRegTest
- { HostFalse }, // EmbeddedTypeLib
- { HostFalse }, // ElfExecutable
- { HostFalse }, // RpcProxy
- { HostTrue }, // HostStaticLibrary
- { HostFalse }, // Cabinet
- { HostFalse }, // KeyboardLayout
- { HostFalse }, // MessageHeader
+const struct ModuleHandlerInformations ModuleHandlerInformations[] = {
+ { HostTrue, "", "", "" }, // BuildTool
+ { HostFalse, "", "", "" }, // StaticLibrary
+ { HostFalse, "", "", "" }, // ObjectLibrary
+ { HostFalse, "", "", "" }, // Kernel
+ { HostFalse, "", "", "" }, // KernelModeDLL
+ { HostFalse, "-D__NTDRIVER__", "", "" }, // KernelModeDriver
+ { HostFalse, "", "", "" }, // NativeDLL
+ { HostFalse, "-D__NTAPP__", "", "" }, // NativeCUI
+ { HostFalse, "", "", "" }, // Win32DLL
+ { HostFalse, "", "", "" }, // Win32OCX
+ { HostFalse, "", "", "" }, // Win32CUI
+ { HostFalse, "", "", "" }, // Win32GUI
+ { HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootLoader
+ { HostFalse, "", "-f bin", "" }, // BootSector
+ { HostFalse, "", "", "" }, // Iso
+ { HostFalse, "", "", "" }, // LiveIso
+ { HostFalse, "", "", "" }, // Test
+ { HostFalse, "", "", "" }, // RpcServer
+ { HostFalse, "", "", "" }, // RpcClient
+ { HostFalse, "", "", "" }, // Alias
+ { HostFalse, "", "", "-nostartfiles -nostdlib" }, // BootProgram
+ { HostFalse, "", "", "" }, // Win32SCR
+ { HostFalse, "", "", "" }, // IdlHeader
+ { HostFalse, "", "", "" }, // IsoRegTest
+ { HostFalse, "", "", "" }, // LiveIsoRegTest
+ { HostFalse, "", "", "" }, // EmbeddedTypeLib
+ { HostFalse, "", "", "" }, // ElfExecutable
+ { HostFalse, "", "", "" }, // RpcProxy
+ { HostTrue, "", "", "" }, // HostStaticLibrary
+ { HostFalse, "", "", "" }, // Cabinet
+ { HostFalse, "", "", "" }, // KeyboardLayout
+ { HostFalse, "", "", "" }, // MessageHeader
};
string
h->AddImplicitLibraries ( module );
if ( use_pch && CanEnablePreCompiledHeaderSupportForModule ( module ) )
h->EnablePreCompiledHeaderSupport ();
- if ( module.host == HostDefault )
- {
- module.host = ModuleHandlerInformations[h->module.type].DefaultHost;
- assert ( module.host != HostDefault );
- }
v.push_back ( h );
}
void
MingwBackend::ProcessNormal ()
{
- assert(sizeof(ModuleHandlerInformations)/sizeof(ModuleHandlerInformations[0]) == TypeDontCare);
+ assert(sizeof(ModuleHandlerInformations)/sizeof(ModuleHandlerInformations[0]) == TypeDontCare);
DetectCompiler ();
DetectBinutils ();
case MessageHeader:
case IdlHeader:
case EmbeddedTypeLib:
+ case BootSector:
handler = new MingwModuleHandler( module );
break;
case BuildTool:
case BootLoader:
handler = new MingwBootLoaderModuleHandler ( module );
break;
- case BootSector:
- handler = new MingwBootSectorModuleHandler ( module );
- break;
case BootProgram:
handler = new MingwBootProgramModuleHandler ( module );
break;
for ( i = 0; i < sizeof ( rules ) / sizeof ( rules[0] ); i++ )
{
- if ( rules[i].host != HostDontCare && rules[i].host != module.host )
+ if ( rules[i].host != HostDontCare && rules[i].host != ModuleHandlerInformations[module.type].DefaultHost )
continue;
if ( rules[i].type != TypeDontCare && rules[i].type != module.type )
continue;
if ( pchFilename )
{
- string cc = ( module.host == HostTrue ? "${host_gcc}" : "${gcc}" );
- string cppc = ( module.host == HostTrue ? "${host_gpp}" : "${gpp}" );
+ string cc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ? "${host_gcc}" : "${gcc}" );
+ string cppc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ? "${host_gpp}" : "${gpp}" );
const FileLocation& baseHeaderFile = *module.pch->file;
CLEAN_FILE ( *pchFilename );
&module.linkerFlags,
used_defs );
- if ( module.host == HostFalse )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
{
GenerateMacros (
"+=",
}
string globalCflags = "";
- if ( module.host == HostFalse )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
globalCflags += " $(PROJECT_CFLAGS)";
else
globalCflags += " -Wall -Wpointer-arith -D__REACTOS__";
globalCflags += " -pipe";
if ( !module.allowWarnings )
globalCflags += " -Werror";
- if ( module.host == HostTrue )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
{
if ( module.cplusplus )
globalCflags += " $(HOST_CPPFLAGS)";
cflagsMacro.c_str (),
globalCflags.c_str () );
- if ( module.host == HostFalse )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
{
fprintf (
fMakefile,
linkDepsMacro.c_str (),
libsMacro.c_str () );
- string cflags = TypeSpecificCFlags();
- if ( cflags.size() > 0 )
+ const char *cflags = ModuleHandlerInformations[module.type].cflags;
+ if ( strlen( cflags ) > 0 )
{
fprintf ( fMakefile,
"%s += %s\n\n",
cflagsMacro.c_str (),
- cflags.c_str () );
+ cflags );
}
- string nasmflags = TypeSpecificNasmFlags();
- if ( nasmflags.size () > 0 )
+ const char* nasmflags = ModuleHandlerInformations[module.type].nasmflags;
+ if ( strlen( nasmflags ) > 0 )
{
fprintf ( fMakefile,
"%s += %s\n\n",
nasmflagsMacro.c_str (),
- nasmflags.c_str () );
+ nasmflags );
}
- string linkerflags = TypeSpecificLinkerFlags();
- if ( linkerflags.size() > 0 )
+ const char *linkerflags = ModuleHandlerInformations[module.type].linkerflags;
+ if ( strlen( linkerflags ) > 0 )
{
fprintf ( fMakefile,
"%s += %s\n\n",
linkerflagsMacro.c_str (),
- linkerflags.c_str () );
+ linkerflags );
}
if ( IsStaticLibrary ( module ) && module.isStartupLib )
string_list& dependencies ) const
{
/* Avoid circular dependency */
- if ( module.host == HostTrue )
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
return;
if (module.name != "psdk" &&
}
-MingwBootSectorModuleHandler::MingwBootSectorModuleHandler (
- const Module& module_ )
-
- : MingwModuleHandler ( module_ )
-{
-}
-
-void
-MingwBootSectorModuleHandler::Process ()
-{
- GenerateBootSectorModuleTarget ();
-}
-
-void
-MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ()
-{
- string objectsMacro = GetObjectsMacro ( module );
-
- GenerateRules ();
-
- fprintf ( fMakefile, ".PHONY: %s\n\n",
- module.name.c_str ());
- fprintf ( fMakefile,
- "%s: %s\n",
- module.name.c_str (),
- objectsMacro.c_str () );
-}
-
-
MingwBootProgramModuleHandler::MingwBootProgramModuleHandler (
const Module& module_ )
: MingwModuleHandler ( module_ )
MingwBackend* backend_ );
void GeneratePreconditionDependencies ();
virtual void Process () { GenerateRules (); }
- virtual std::string TypeSpecificCFlags() { return ""; }
- virtual std::string TypeSpecificNasmFlags() { return ""; }
- virtual std::string TypeSpecificLinkerFlags() { return ""; }
void GenerateInvocations () const;
void GenerateCleanTarget () const;
void GenerateInstallTarget () const;
public:
MingwKernelModeDriverModuleHandler ( const Module& module );
virtual void Process ();
- std::string TypeSpecificCFlags() { return "-D__NTDRIVER__"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateKernelModeDriverModuleTarget ();
public:
MingwNativeCUIModuleHandler ( const Module& module );
virtual void Process ();
- std::string TypeSpecificCFlags() { return "-D__NTAPP__"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateNativeCUIModuleTarget ();
public:
MingwBootLoaderModuleHandler ( const Module& module );
virtual void Process ();
- std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
private:
void GenerateBootLoaderModuleTarget ();
};
-class MingwBootSectorModuleHandler : public MingwModuleHandler
-{
-public:
- MingwBootSectorModuleHandler ( const Module& module );
- virtual void Process ();
- std::string TypeSpecificNasmFlags() { return "-f bin"; }
-private:
- void GenerateBootSectorModuleTarget ();
-};
-
-
class MingwBootProgramModuleHandler : public MingwModuleHandler
{
public:
MingwBootProgramModuleHandler ( const Module& module );
virtual void Process ();
std::string GetProgTextAddrMacro ();
- std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
private:
void GenerateBootProgramModuleTarget ();
};