delete objectFile;
return sourceFile;
}
+ else if ( extension == ".mc" || extension == ".MC" )
+ {
+ const FileLocation *objectFile = GetObjectFilename ( file, module, NULL );
+ FileLocation *sourceFile = new FileLocation (
+ objectFile->directory,
+ objectFile->relative_path,
+ ReplaceExtension ( objectFile->name, ".rc" ) );
+ delete objectFile;
+ return sourceFile;
+ }
else
return new FileLocation ( *file );
}
dep += ssprintf ( " $(%s_HEADERS)", importedModule.name.c_str () );
break;
}
+ if ( GetExtension ( *objectFilename ) == ".rc" )
+ {
+ dep += ssprintf ( " $(%s_MCHEADERS)", importedModule.name.c_str () );
+ break;
+ }
}
}
else
}
vector<FileLocation> v;
GetDefinitionDependencies ( v );
+
for ( size_t i = 0; i < v.size (); i++ )
{
const FileLocation& file = v[i];
return new FileLocation ( *module.output );
else if ( extension == ".rc" || extension == ".RC" )
newExtension = "_" + module.name + ".coff";
+ else if ( extension == ".mc" || extension == ".MC" )
+ newExtension = ".rc";
else if ( extension == ".spec" || extension == ".SPEC" )
newExtension = ".stubs.o";
else if ( extension == ".idl" || extension == ".IDL" )
const vector<CompilationUnit*>& compilationUnits = data.compilationUnits;
vector<const FileLocation *> headers;
+ vector<const FileLocation *> mcheaders;
+ vector<const FileLocation *> mcresources;
if ( compilationUnits.size () > 0 )
{
for ( i = 0; i < compilationUnits.size (); i++ )
const FileLocation *objectFilename = GetObjectFilename ( compilationUnit.GetFilename (), module, NULL );
if ( GetExtension ( *objectFilename ) == ".h" )
headers.push_back ( objectFilename );
+ else if ( GetExtension ( *objectFilename ) == ".rc" )
+ {
+ const FileLocation *headerFilename = GetMcHeaderFilename ( compilationUnit.GetFilename () );
+ mcheaders.push_back ( headerFilename );
+ mcresources.push_back ( objectFilename );
+ }
else
fprintf (
fMakefile,
fprintf ( fMakefile, "\n" );
}
+ if ( mcheaders.size () > 0 )
+ {
+ fprintf (
+ fMakefile,
+ "%s_MCHEADERS %s",
+ module.name.c_str (),
+ assignmentOperation );
+ for ( i = 0; i < mcheaders.size (); i++ )
+ fprintf (
+ fMakefile,
+ "%s%s",
+ ( i%10 == 9 ? " \\\n\t" : " " ),
+ backend->GetFullName ( *mcheaders[i] ).c_str () );
+ fprintf ( fMakefile, "\n" );
+ }
+
+ if ( mcresources.size () > 0 )
+ {
+ fprintf (
+ fMakefile,
+ "%s_RESOURCES %s",
+ module.name.c_str (),
+ assignmentOperation );
+ for ( i = 0; i < mcresources.size (); i++ )
+ fprintf (
+ fMakefile,
+ "%s%s",
+ ( i%10 == 9 ? " \\\n\t" : " " ),
+ backend->GetFullName ( *mcresources[i] ).c_str () );
+ fprintf ( fMakefile, "\n" );
+ }
+
const vector<If*>& ifs = data.ifs;
for ( i = 0; i < ifs.size(); i++ )
{
backend->GetFullName ( *sourceFile ).c_str () );
}
+void
+MingwModuleHandler::GenerateWmcCommands (
+ const FileLocation* sourceFile )
+{
+ string dependencies = backend->GetFullName ( *sourceFile );
+ dependencies += " " + NormalizeFilename ( module.xmlbuildFile );
+
+ string basename = GetBasename ( sourceFile->name );
+ FileLocation rc_file ( IntermediateDirectory,
+ sourceFile->relative_path,
+ basename + ".rc" );
+ FileLocation h_file ( IntermediateDirectory,
+ "include/reactos",
+ basename + ".h" );
+ CLEAN_FILE ( rc_file );
+ CLEAN_FILE ( h_file );
+
+ fprintf ( fMakefile,
+ "%s %s: $(WMC_TARGET) %s\n",
+ backend->GetFullName ( rc_file ).c_str (),
+ backend->GetFullName ( h_file ).c_str (),
+ backend->GetFullName ( *sourceFile ).c_str () );
+ fprintf ( fMakefile, "\t$(ECHO_WMC)\n" );
+ fprintf ( fMakefile,
+ "\t%s -i -H %s -o %s %s\n",
+ "$(Q)$(WMC_TARGET)",
+ backend->GetFullName ( h_file ).c_str (),
+ backend->GetFullName ( rc_file ).c_str (),
+ backend->GetFullName ( *sourceFile ).c_str () );
+}
+
string
MingwModuleHandler::GetWidlFlags ( const CompilationUnit& compilationUnit )
{
return new FileLocation ( IntermediateDirectory, base->relative_path, newname );
}
+const FileLocation*
+MingwModuleHandler::GetMcHeaderFilename ( const FileLocation *base ) const
+{
+ string newname = GetBasename ( base->name ) + ".h";
+ return new FileLocation ( IntermediateDirectory, "include/reactos" , newname );
+}
+
void
MingwModuleHandler::GenerateWidlCommandsEmbeddedTypeLib (
const CompilationUnit& compilationUnit,
windresflagsMacro );
return;
}
+ else if ( extension == ".mc" || extension == ".MC" )
+ {
+ GenerateWmcCommands ( sourceFile );
+ return;
+ }
else if ( extension == ".spec" || extension == ".SPEC" )
{
GenerateWinebuildCommands ( sourceFile );
const FileLocation *objectFilename = GetObjectFilename ( compilationUnit.GetFilename (), module, NULL );
if ( GetExtension ( *objectFilename ) == ".h" )
{
- moduleDependencies = ssprintf ( " $(%s_HEADERS)", module.name.c_str () );
+ moduleDependencies += ssprintf ( " $(%s_HEADERS)", module.name.c_str () );
+ break;
+ }
+ if ( GetExtension ( *objectFilename ) == ".rc" )
+ {
+ moduleDependencies += ssprintf ( " $(%s_RESOURCES)", module.name.c_str () );
break;
}
}
if ( module.type != BuildTool
&& module.name != "psdk" )
- dependencies.push_back ( "$(PSDK_TARGET) $(psdk_HEADERS)" );
+ dependencies.push_back ( "$(PSDK_TARGET) $(psdk_HEADERS)" );
+
+ /* Check if any dependent library relays on the generated headers */
+ for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ {
+ const Module& m = *module.project.modules[i];
+ for ( size_t j = 0; j < m.non_if_data.compilationUnits.size (); j++ )
+ {
+ CompilationUnit& compilationUnit = *m.non_if_data.compilationUnits[j];
+ const FileLocation* sourceFile = compilationUnit.GetFilename ();
+ string extension = GetExtension ( *sourceFile );
+ if (extension == ".mc" || extension == ".MC" )
+ {
+ string dependency = ssprintf ( " $(%s_MCHEADERS)", m.name.c_str () );
+ dependencies.push_back ( dependency );
+ }
+ }
+ }
}
void
vector<FileLocation> deps;
GetDefinitionDependencies ( deps );
-
+
fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );
fprintf ( fMakefile, "%s: %s",
dependencies.push_back ( stubsDependency );
}
+void
+MingwModuleHandler::GetMcObjectDependencies (
+ vector<FileLocation>& dependencies,
+ const FileLocation *file ) const
+{
+ string basename = GetBasename ( file->name );
+
+ FileLocation defDependency ( IntermediateDirectory,
+ "include/reactos",
+ basename + ".h" );
+ dependencies.push_back ( defDependency );
+
+ FileLocation stubsDependency ( IntermediateDirectory,
+ file->relative_path,
+ basename + ".rc" );
+ dependencies.push_back ( stubsDependency );
+}
+
void
MingwModuleHandler::GetWidlObjectDependencies (
vector<FileLocation>& dependencies,