Author: hpoussin
Date: Fri Mar 21 04:28:42 2008
New Revision: 32735
URL:
http://svn.reactos.org/svn/reactos?rev=3D32735&view=3Drev
Log:
Add preprocessor support for .spec files (exports can be different between =
architectures)
MingwModuleHandler::GetDefinitionFilename() can return NULL if no <importli=
brary> tag exist
Modified:
trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
Modified: trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/tools/rbuild/backend/=
mingw/modulehandler.cpp?rev=3D32735&r1=3D32734&r2=3D32735&view=3Ddiff
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D
--- trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp (original)
+++ trunk/reactos/tools/rbuild/backend/mingw/modulehandler.cpp Fri Mar 21 0=
4:28:42 2008
@@ -1284,9 +1284,11 @@
"\t$(ECHO_WMC)\n"
"\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SE=
P)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_noex=
t).rc", "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext=
).h", NULL );
-Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_nam=
e_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERME=
DIATE)$(SEP)$(source_dir)\n"
+Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_nam=
e_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERME=
DIATE)$(SEP)$(source_dir) $(TEMPORARY)\n"
"\t$(ECHO_WINEBLD)\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(IN=
TERMEDIATE)$(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 $(IN=
TERMEDIATE)$(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_na=
me_noext).stubs.c: $(source_path)$(SEP)$(source_name_noext).spec $(WINEBUIL=
D_TARGET)\n"
"\t$(ECHO_WINEBLD)\n"
"\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(IN=
TERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll $=
(source_path)$(SEP)$(source_name_noext).spec\n"
@@ -1672,7 +1674,7 @@
fprintf ( fMakefile,
"%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
target_macro.c_str (),
- backend->GetFullName ( *definitionFilename ).c_str (),
+ definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str =
() : "",
dependencies.c_str (),
target_folder.c_str () );
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
@@ -1700,7 +1702,7 @@
fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-exp %s%s%s\n",
targetName.c_str (),
- backend->GetFullName ( *definitionFilename ).c_str (),
+ definitionFilename ? backend->GetFullName ( *definitionFilenam=
e ).c_str () : "",
backend->GetFullName ( temp_exp ).c_str (),
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
@@ -1750,7 +1752,8 @@
GenerateRunStripCode ();
GenerateCleanObjectsAsYouGoCode ();
=
- delete definitionFilename;
+ if ( definitionFilename )
+ delete definitionFilename;
delete target_file;
}
=
@@ -1856,22 +1859,22 @@
MingwModuleHandler::GenerateArchiveTarget ()
{
const FileLocation *archiveFilename =3D GetModuleArchiveFilename ();
+ const FileLocation *definitionFilename =3D GetDefinitionFilename ();
=
arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_file=
s );
=
- if ( IsStaticLibrary ( module ) && module.importLibrary )
- {
- const FileLocation *definitionFilename =3D GetDefinitionFilename ();
-
+ if ( IsStaticLibrary ( module ) && definitionFilename )
+ {
fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-lib $@%s%s\n",
module.importLibrary->dllname.c_str (),
backend->GetFullName ( *definitionFilename ).c_str (),
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
-
+ }
+
+ if ( definitionFilename )
delete definitionFilename;
- }
=
if(module.type =3D=3D HostStaticLibrary)
arHostRule2.Execute ( fMakefile, backend, module, archiveFilename, clean=
_files );
@@ -2357,20 +2360,18 @@
const FileLocation*
MingwModuleHandler::GetDefinitionFilename () const
{
- if ( module.importLibrary !=3D NULL )
- {
- DirectoryLocation directory;
- if ( IsWineModule () )
- directory =3D IntermediateDirectory;
- else
- directory =3D SourceDirectory;
-
- return new FileLocation ( directory,
- module.importLibrary->source->relative_path,
- module.importLibrary->source->name );
- }
+ if ( module.importLibrary =3D=3D NULL )
+ return NULL;
+
+ DirectoryLocation directory;
+ if ( IsWineModule () )
+ directory =3D IntermediateDirectory;
else
- return new FileLocation ( SourceDirectory, "tools" + sSep +
"rbuild", "e=
mpty.def" );
+ directory =3D SourceDirectory;
+
+ return new FileLocation ( directory,
+ module.importLibrary->source->relative_path,
+ module.importLibrary->source->name );
}
=
void
@@ -2380,15 +2381,21 @@
{
const FileLocation *library_target =3D GetImportLibraryFilename ( module=
, &clean_files );
const FileLocation *defFilename =3D GetDefinitionFilename ();
+ string empty =3D "tools" + sSep + "rbuild" + sSep +
"empty.def";
=
vector<FileLocation> deps;
GetDefinitionDependencies ( deps );
=
fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );
=
- fprintf ( fMakefile, "%s: %s",
- backend->GetFullName ( *library_target ).c_str (),
- backend->GetFullName ( *defFilename ).c_str () );
+ fprintf ( fMakefile, "%s:",
+ backend->GetFullName ( *library_target ).c_str () );
+
+ if ( defFilename )
+ {
+ fprintf ( fMakefile, " %s",
+ backend->GetFullName ( *defFilename ).c_str () );
+ }
=
size_t i, iend =3D deps.size();
for ( i =3D 0; i < iend; i++ )
@@ -2403,12 +2410,14 @@
fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-lib %s%s%s\n\n",
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 (),
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
=
- delete defFilename;
+ if ( defFilename )
+ delete defFilename;
delete library_target;
}
}