Don't mix host and targets include files

Add HostStaticLibrary type

svn path=/trunk/; revision=32594
This commit is contained in:
Hervé Poussineau 2008-03-07 09:17:12 +00:00
parent 6e49f8efc8
commit 8002abf980
6 changed files with 93 additions and 30 deletions

View file

@ -37,6 +37,7 @@ using std::ifstream;
#undef OUT #undef OUT
#endif//OUT #endif//OUT
#define IsStaticLibrary( module ) ( ( module.type == StaticLibrary ) || ( module.type == HostStaticLibrary ) )
static class CBFactory : public Backend::Factory static class CBFactory : public Backend::Factory
{ {
@ -497,7 +498,7 @@ CBBackend::_generate_cbproj ( const Module& module )
if ( !module.allowWarnings ) if ( !module.allowWarnings )
compiler_flags.push_back ( "-Werror" ); compiler_flags.push_back ( "-Werror" );
if ( module.type == StaticLibrary && module.isStartupLib ) if ( IsStaticLibrary ( module ) && module.isStartupLib )
compiler_flags.push_back ( "-Wno-main" ); compiler_flags.push_back ( "-Wno-main" );
@ -524,7 +525,7 @@ CBBackend::_generate_cbproj ( const Module& module )
if ( configuration.UseConfigurationInPath ) if ( configuration.UseConfigurationInPath )
{ {
if ( module.type == StaticLibrary ||module.type == ObjectLibrary ) if ( IsStaticLibrary ( module ) ||module.type == ObjectLibrary )
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str()); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str());
else else
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.output->relative_path.c_str (), cfg.name.c_str(), module.name.c_str(), module_type.c_str()); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\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 else
{ {
if ( module.type == StaticLibrary || module.type == ObjectLibrary ) if ( IsStaticLibrary ( module ) || module.type == ObjectLibrary )
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() ); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", intdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() );
else else
fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\r\n", outdir.c_str (), module.output->relative_path.c_str (), module.name.c_str(), module_type.c_str() ); fprintf ( OUT, "\t\t\t\t<Option output=\"%s\\%s\\%s%s\" prefix_auto=\"0\" extension_auto=\"0\" />\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<ExtraCommands>\r\n" ); fprintf ( OUT, "\t\t\t\t<ExtraCommands>\r\n" );
#if 0 #if 0
if ( module.type == StaticLibrary && module.importLibrary ) if ( IsStaticLibrary ( module ) && module.importLibrary )
fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s --output-lib $exe_output; %s -U\" />\r\n", module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" ); fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s --output-lib $exe_output; %s -U\" />\r\n", module.importLibrary->dllname.c_str (), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" );
else if ( module.importLibrary != NULL ) else if ( module.importLibrary != NULL )
fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s --output-lib &quot;$(TARGET_OBJECT_DIR)lib$(TARGET_OUTPUT_BASENAME).a&quot; %s\" />\r\n", module.GetTargetName ().c_str(), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" ); fprintf ( OUT, "\t\t\t\t\t<Add after=\"dlltool --dllname %s --def %s --output-lib &quot;$(TARGET_OBJECT_DIR)lib$(TARGET_OUTPUT_BASENAME).a&quot; %s\" />\r\n", module.GetTargetName ().c_str(), module.importLibrary->definition.c_str(), module.mangledSymbols ? "" : "--kill-at" );

View file

@ -30,6 +30,7 @@ using std::string;
using std::vector; using std::vector;
#define CLEAN_FILE(f) clean_files.push_back ( (f).name.length () > 0 ? backend->GetFullName ( f ) : backend->GetFullPath ( f ) ); #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* MingwBackend*
MingwModuleHandler::backend = NULL; MingwModuleHandler::backend = NULL;
@ -170,6 +171,9 @@ MingwModuleHandler::InstanciateHandler (
case StaticLibrary: case StaticLibrary:
handler = new MingwStaticLibraryModuleHandler ( module ); handler = new MingwStaticLibraryModuleHandler ( module );
break; break;
case HostStaticLibrary:
handler = new MingwHostStaticLibraryModuleHandler ( module );
break;
case ObjectLibrary: case ObjectLibrary:
handler = new MingwObjectLibraryModuleHandler ( module ); handler = new MingwObjectLibraryModuleHandler ( module );
break; break;
@ -359,7 +363,7 @@ MingwModuleHandler::GetCompilationUnitDependencies (
const FileLocation* const FileLocation*
MingwModuleHandler::GetModuleArchiveFilename () const MingwModuleHandler::GetModuleArchiveFilename () const
{ {
if ( module.type == StaticLibrary ) if ( IsStaticLibrary ( module ) )
return GetTargetFilename ( module, NULL ); return GetTargetFilename ( module, NULL );
return new FileLocation ( IntermediateDirectory, return new FileLocation ( IntermediateDirectory,
module.output->relative_path, module.output->relative_path,
@ -1842,7 +1846,7 @@ MingwModuleHandler::GenerateArchiveTarget ()
arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files ); arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
if ( module.type == StaticLibrary && module.importLibrary ) if ( IsStaticLibrary ( module ) && module.importLibrary )
{ {
const FileLocation *definitionFilename = GetDefinitionFilename (); const FileLocation *definitionFilename = GetDefinitionFilename ();
@ -2016,11 +2020,14 @@ MingwModuleHandler::GenerateOtherMacros ()
&module.linkerFlags, &module.linkerFlags,
used_defs ); used_defs );
GenerateMacros ( if ( module.host == HostFalse )
"+=", {
module.project.non_if_data, GenerateMacros (
NULL, "+=",
used_defs ); module.project.non_if_data,
NULL,
used_defs );
}
vector<FileLocation> s; vector<FileLocation> s;
if ( module.importLibrary ) if ( module.importLibrary )
@ -2048,7 +2055,12 @@ MingwModuleHandler::GenerateOtherMacros ()
fprintf ( fMakefile, "\n" ); 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 ) if ( backend->usePipe )
globalCflags += " -pipe"; globalCflags += " -pipe";
if ( !module.allowWarnings ) if ( !module.allowWarnings )
@ -2058,7 +2070,7 @@ MingwModuleHandler::GenerateOtherMacros ()
if ( module.cplusplus ) if ( module.cplusplus )
globalCflags += " $(HOST_CPPFLAGS)"; globalCflags += " $(HOST_CPPFLAGS)";
else else
globalCflags += " $(HOST_CFLAGS)"; globalCflags += " -Wno-strict-aliasing $(HOST_CFLAGS)";
} }
else else
{ {
@ -2077,25 +2089,35 @@ MingwModuleHandler::GenerateOtherMacros ()
fprintf ( fprintf (
fMakefile, fMakefile,
"%s += $(PROJECT_CFLAGS) %s\n", "%s +=%s\n",
cflagsMacro.c_str (), cflagsMacro.c_str (),
globalCflags.c_str () ); globalCflags.c_str () );
fprintf ( if ( module.host == HostFalse )
fMakefile, {
"%s += $(PROJECT_RCFLAGS)\n", fprintf (
windresflagsMacro.c_str () ); fMakefile,
"%s += $(PROJECT_RCFLAGS)\n",
windresflagsMacro.c_str () );
fprintf ( fprintf (
fMakefile, fMakefile,
"%s += $(PROJECT_WIDLFLAGS) -I%s\n", "%s += $(PROJECT_WIDLFLAGS) -I%s\n",
widlflagsMacro.c_str (), widlflagsMacro.c_str (),
module.output->relative_path.c_str () ); module.output->relative_path.c_str () );
fprintf ( fprintf (
fMakefile, fMakefile,
"%s_LFLAGS += $(PROJECT_LFLAGS) -g\n", "%s_LFLAGS += $(PROJECT_LFLAGS) -g\n",
module.name.c_str () ); module.name.c_str () );
}
else
{
fprintf (
fMakefile,
"%s_LFLAGS += $(HOST_LFLAGS)\n",
module.name.c_str () );
}
fprintf ( fprintf (
fMakefile, fMakefile,
@ -2130,7 +2152,7 @@ MingwModuleHandler::GenerateOtherMacros ()
linkerflags.c_str () ); linkerflags.c_str () );
} }
if ( module.type == StaticLibrary && module.isStartupLib ) if ( IsStaticLibrary ( module ) && module.isStartupLib )
{ {
fprintf ( fMakefile, fprintf ( fMakefile,
"%s += -Wno-main\n\n", "%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 ( MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler (
const Module& module_ ) const Module& module_ )

View file

@ -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 class MingwObjectLibraryModuleHandler : public MingwModuleHandler
{ {
public: public:

View file

@ -57,6 +57,7 @@ Bootstrap::IsSupportedModuleType ( ModuleType type )
return true; return true;
case BuildTool: case BuildTool:
case StaticLibrary: case StaticLibrary:
case HostStaticLibrary:
case ObjectLibrary: case ObjectLibrary:
case Iso: case Iso:
case LiveIso: case LiveIso:

View file

@ -880,6 +880,8 @@ Module::GetModuleType ( const string& location, const XMLAttribute& attribute )
return BuildTool; return BuildTool;
if ( attribute.value == "staticlibrary" ) if ( attribute.value == "staticlibrary" )
return StaticLibrary; return StaticLibrary;
if ( attribute.value == "hoststaticlibrary" )
return HostStaticLibrary;
if ( attribute.value == "objectlibrary" ) if ( attribute.value == "objectlibrary" )
return ObjectLibrary; return ObjectLibrary;
if ( attribute.value == "kernel" ) if ( attribute.value == "kernel" )
@ -965,6 +967,7 @@ Module::GetTargetDirectoryTree () const
case ElfExecutable: case ElfExecutable:
return OutputDirectory; return OutputDirectory;
case StaticLibrary: case StaticLibrary:
case HostStaticLibrary:
case ObjectLibrary: case ObjectLibrary:
case RpcServer: case RpcServer:
case RpcClient: case RpcClient:
@ -990,6 +993,7 @@ Module::GetDefaultModuleExtension () const
return ExePostfix; return ExePostfix;
case BootProgram: case BootProgram:
case StaticLibrary: case StaticLibrary:
case HostStaticLibrary:
return ".a"; return ".a";
case ObjectLibrary: case ObjectLibrary:
return ".o"; return ".o";
@ -1067,6 +1071,7 @@ Module::GetDefaultModuleEntrypoint () const
return "WinMainCRTStartup"; return "WinMainCRTStartup";
case BuildTool: case BuildTool:
case StaticLibrary: case StaticLibrary:
case HostStaticLibrary:
case ObjectLibrary: case ObjectLibrary:
case BootLoader: case BootLoader:
case BootSector: case BootSector:
@ -1115,6 +1120,7 @@ Module::GetDefaultModuleBaseaddress () const
return "0xe00000"; return "0xe00000";
case BuildTool: case BuildTool:
case StaticLibrary: case StaticLibrary:
case HostStaticLibrary:
case ObjectLibrary: case ObjectLibrary:
case BootLoader: case BootLoader:
case BootSector: case BootSector:
@ -1140,7 +1146,7 @@ Module::GetDefaultModuleBaseaddress () const
bool bool
Module::HasImportLibrary () const Module::HasImportLibrary () const
{ {
return importLibrary != NULL && type != StaticLibrary; return importLibrary != NULL && type != StaticLibrary && type != HostStaticLibrary;
} }
bool bool
@ -1162,6 +1168,7 @@ Module::IsDLL () const
case Win32GUI: case Win32GUI:
case BuildTool: case BuildTool:
case StaticLibrary: case StaticLibrary:
case HostStaticLibrary:
case ObjectLibrary: case ObjectLibrary:
case BootLoader: case BootLoader:
case BootSector: case BootSector:
@ -1613,7 +1620,7 @@ ImportLibrary::ImportLibrary ( const Project& project,
if ( dllname ) if ( dllname )
this->dllname = dllname->value; this->dllname = dllname->value;
else if ( module.type == StaticLibrary ) else if ( module.type == StaticLibrary || module.type == HostStaticLibrary )
throw XMLInvalidBuildFileException ( throw XMLInvalidBuildFileException (
node.location, node.location,
"<importlibrary> dllname attribute required." ); "<importlibrary> dllname attribute required." );

View file

@ -300,6 +300,7 @@ enum ModuleType
EmbeddedTypeLib = 26, EmbeddedTypeLib = 26,
ElfExecutable = 27, ElfExecutable = 27,
RpcProxy, RpcProxy,
HostStaticLibrary,
TypeDontCare, TypeDontCare,
}; };