mirror of
https://github.com/reactos/reactos.git
synced 2024-07-15 00:46:06 +00:00
Add preprocessor support for .spec files (exports can be different between architectures)
MingwModuleHandler::GetDefinitionFilename() can return NULL if no <importlibrary> tag exist svn path=/trunk/; revision=32735
This commit is contained in:
parent
3c7122afc2
commit
2ea6860b9e
|
@ -1284,9 +1284,11 @@ Rule wmcRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc
|
||||||
"\t$(ECHO_WMC)\n"
|
"\t$(ECHO_WMC)\n"
|
||||||
"\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h -o $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc $(source)\n",
|
"\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h -o $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc $(source)\n",
|
||||||
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc", "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h", NULL );
|
"$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc", "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h", NULL );
|
||||||
Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
|
Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir) $(TEMPORARY)\n"
|
||||||
"\t$(ECHO_WINEBLD)\n"
|
"\t$(ECHO_WINEBLD)\n"
|
||||||
"\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(source_path)$(SEP)$(source_name_noext).spec\n"
|
"\t${gcc} -xc -E ${$(module_name)_RCFLAGS} $(source) > $(TEMPORARY)$(SEP)$(module_name).spec.tmp\n"
|
||||||
|
"\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(TEMPORARY)$(SEP)$(module_name).spec.tmp\n"
|
||||||
|
"\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).spec.tmp 2>$(NUL)\n"
|
||||||
"$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c: $(source_path)$(SEP)$(source_name_noext).spec $(WINEBUILD_TARGET)\n"
|
"$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c: $(source_path)$(SEP)$(source_name_noext).spec $(WINEBUILD_TARGET)\n"
|
||||||
"\t$(ECHO_WINEBLD)\n"
|
"\t$(ECHO_WINEBLD)\n"
|
||||||
"\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll $(source_path)$(SEP)$(source_name_noext).spec\n"
|
"\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll $(source_path)$(SEP)$(source_name_noext).spec\n"
|
||||||
|
@ -1672,7 +1674,7 @@ MingwModuleHandler::GenerateLinkerCommand (
|
||||||
fprintf ( fMakefile,
|
fprintf ( fMakefile,
|
||||||
"%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
|
"%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
|
||||||
target_macro.c_str (),
|
target_macro.c_str (),
|
||||||
backend->GetFullName ( *definitionFilename ).c_str (),
|
definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
|
||||||
dependencies.c_str (),
|
dependencies.c_str (),
|
||||||
target_folder.c_str () );
|
target_folder.c_str () );
|
||||||
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
|
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
|
||||||
|
@ -1700,7 +1702,7 @@ MingwModuleHandler::GenerateLinkerCommand (
|
||||||
fprintf ( fMakefile,
|
fprintf ( fMakefile,
|
||||||
"\t${dlltool} --dllname %s --def %s --output-exp %s%s%s\n",
|
"\t${dlltool} --dllname %s --def %s --output-exp %s%s%s\n",
|
||||||
targetName.c_str (),
|
targetName.c_str (),
|
||||||
backend->GetFullName ( *definitionFilename ).c_str (),
|
definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
|
||||||
backend->GetFullName ( temp_exp ).c_str (),
|
backend->GetFullName ( temp_exp ).c_str (),
|
||||||
module.mangledSymbols ? "" : " --kill-at",
|
module.mangledSymbols ? "" : " --kill-at",
|
||||||
module.underscoreSymbols ? " --add-underscore" : "" );
|
module.underscoreSymbols ? " --add-underscore" : "" );
|
||||||
|
@ -1750,7 +1752,8 @@ MingwModuleHandler::GenerateLinkerCommand (
|
||||||
GenerateRunStripCode ();
|
GenerateRunStripCode ();
|
||||||
GenerateCleanObjectsAsYouGoCode ();
|
GenerateCleanObjectsAsYouGoCode ();
|
||||||
|
|
||||||
delete definitionFilename;
|
if ( definitionFilename )
|
||||||
|
delete definitionFilename;
|
||||||
delete target_file;
|
delete target_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1856,23 +1859,23 @@ const FileLocation*
|
||||||
MingwModuleHandler::GenerateArchiveTarget ()
|
MingwModuleHandler::GenerateArchiveTarget ()
|
||||||
{
|
{
|
||||||
const FileLocation *archiveFilename = GetModuleArchiveFilename ();
|
const FileLocation *archiveFilename = GetModuleArchiveFilename ();
|
||||||
|
const FileLocation *definitionFilename = GetDefinitionFilename ();
|
||||||
|
|
||||||
arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
|
arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
|
||||||
|
|
||||||
if ( IsStaticLibrary ( module ) && module.importLibrary )
|
if ( IsStaticLibrary ( module ) && definitionFilename )
|
||||||
{
|
{
|
||||||
const FileLocation *definitionFilename = GetDefinitionFilename ();
|
|
||||||
|
|
||||||
fprintf ( fMakefile,
|
fprintf ( fMakefile,
|
||||||
"\t${dlltool} --dllname %s --def %s --output-lib $@%s%s\n",
|
"\t${dlltool} --dllname %s --def %s --output-lib $@%s%s\n",
|
||||||
module.importLibrary->dllname.c_str (),
|
module.importLibrary->dllname.c_str (),
|
||||||
backend->GetFullName ( *definitionFilename ).c_str (),
|
backend->GetFullName ( *definitionFilename ).c_str (),
|
||||||
module.mangledSymbols ? "" : " --kill-at",
|
module.mangledSymbols ? "" : " --kill-at",
|
||||||
module.underscoreSymbols ? " --add-underscore" : "" );
|
module.underscoreSymbols ? " --add-underscore" : "" );
|
||||||
|
|
||||||
delete definitionFilename;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( definitionFilename )
|
||||||
|
delete definitionFilename;
|
||||||
|
|
||||||
if(module.type == HostStaticLibrary)
|
if(module.type == HostStaticLibrary)
|
||||||
arHostRule2.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
|
arHostRule2.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
|
||||||
else
|
else
|
||||||
|
@ -2357,20 +2360,18 @@ MingwModuleHandler::IsWineModule () const
|
||||||
const FileLocation*
|
const FileLocation*
|
||||||
MingwModuleHandler::GetDefinitionFilename () const
|
MingwModuleHandler::GetDefinitionFilename () const
|
||||||
{
|
{
|
||||||
if ( module.importLibrary != NULL )
|
if ( module.importLibrary == NULL )
|
||||||
{
|
return NULL;
|
||||||
DirectoryLocation directory;
|
|
||||||
if ( IsWineModule () )
|
|
||||||
directory = IntermediateDirectory;
|
|
||||||
else
|
|
||||||
directory = SourceDirectory;
|
|
||||||
|
|
||||||
return new FileLocation ( directory,
|
DirectoryLocation directory;
|
||||||
module.importLibrary->source->relative_path,
|
if ( IsWineModule () )
|
||||||
module.importLibrary->source->name );
|
directory = IntermediateDirectory;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
return new FileLocation ( SourceDirectory, "tools" + sSep + "rbuild", "empty.def" );
|
directory = SourceDirectory;
|
||||||
|
|
||||||
|
return new FileLocation ( directory,
|
||||||
|
module.importLibrary->source->relative_path,
|
||||||
|
module.importLibrary->source->name );
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -2380,15 +2381,21 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
|
||||||
{
|
{
|
||||||
const FileLocation *library_target = GetImportLibraryFilename ( module, &clean_files );
|
const FileLocation *library_target = GetImportLibraryFilename ( module, &clean_files );
|
||||||
const FileLocation *defFilename = GetDefinitionFilename ();
|
const FileLocation *defFilename = GetDefinitionFilename ();
|
||||||
|
string empty = "tools" + sSep + "rbuild" + sSep + "empty.def";
|
||||||
|
|
||||||
vector<FileLocation> deps;
|
vector<FileLocation> deps;
|
||||||
GetDefinitionDependencies ( deps );
|
GetDefinitionDependencies ( deps );
|
||||||
|
|
||||||
fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );
|
fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );
|
||||||
|
|
||||||
fprintf ( fMakefile, "%s: %s",
|
fprintf ( fMakefile, "%s:",
|
||||||
backend->GetFullName ( *library_target ).c_str (),
|
backend->GetFullName ( *library_target ).c_str () );
|
||||||
backend->GetFullName ( *defFilename ).c_str () );
|
|
||||||
|
if ( defFilename )
|
||||||
|
{
|
||||||
|
fprintf ( fMakefile, " %s",
|
||||||
|
backend->GetFullName ( *defFilename ).c_str () );
|
||||||
|
}
|
||||||
|
|
||||||
size_t i, iend = deps.size();
|
size_t i, iend = deps.size();
|
||||||
for ( i = 0; i < iend; i++ )
|
for ( i = 0; i < iend; i++ )
|
||||||
|
@ -2403,12 +2410,14 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
|
||||||
fprintf ( fMakefile,
|
fprintf ( fMakefile,
|
||||||
"\t${dlltool} --dllname %s --def %s --output-lib %s%s%s\n\n",
|
"\t${dlltool} --dllname %s --def %s --output-lib %s%s%s\n\n",
|
||||||
module.output->name.c_str (),
|
module.output->name.c_str (),
|
||||||
backend->GetFullName ( *defFilename ).c_str (),
|
defFilename ? backend->GetFullName ( *defFilename ).c_str ()
|
||||||
|
: empty.c_str (),
|
||||||
backend->GetFullName ( *library_target ).c_str (),
|
backend->GetFullName ( *library_target ).c_str (),
|
||||||
module.mangledSymbols ? "" : " --kill-at",
|
module.mangledSymbols ? "" : " --kill-at",
|
||||||
module.underscoreSymbols ? " --add-underscore" : "" );
|
module.underscoreSymbols ? " --add-underscore" : "" );
|
||||||
|
|
||||||
delete defFilename;
|
if ( defFilename )
|
||||||
|
delete defFilename;
|
||||||
delete library_target;
|
delete library_target;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue