mirror of
https://github.com/reactos/reactos.git
synced 2025-02-23 00:45:24 +00:00
Add support for mc files and remove hardcoded WMC instructions from Makefile . Thanks to Amine and Colin for helping to test it
svn path=/trunk/; revision=31408
This commit is contained in:
parent
3cc5fbd970
commit
1b7ac1d2db
9 changed files with 1600 additions and 1476 deletions
|
@ -372,15 +372,8 @@ $(OUTPUT):
|
|||
${mkdir} $@
|
||||
endif
|
||||
|
||||
|
||||
NTOSKRNL_MC = ntoskrnl$(SEP)ntoskrnl.mc
|
||||
KERNEL32_MC = dll$(SEP)win32$(SEP)kernel32$(SEP)kernel32.mc
|
||||
NTDLL_MC = dll$(SEP)ntdll$(SEP)def$(SEP)ntstatus.mc
|
||||
BUILDNO_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)buildno.h
|
||||
BUGCODES_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)bugcodes.h
|
||||
BUGCODES_RC = $(INTERMEDIATE_)ntoskrnl$(SEP)bugcodes.rc
|
||||
ERRCODES_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)errcodes.h
|
||||
ERRCODES_RC = $(INTERMEDIATE_)dll$(SEP)win32$(SEP)kernel32$(SEP)errcodes.rc
|
||||
NTSTATUS_H = $(INTERMEDIATE_)include$(SEP)reactos$(SEP)ntstatus.h
|
||||
NTSTATUS_RC = $(INTERMEDIATE_)dll$(SEP)ntdll$(SEP)def$(SEP)ntstatus.rc
|
||||
|
||||
|
@ -394,10 +387,6 @@ PREAUTO := \
|
|||
$(BIN2C_TARGET) \
|
||||
$(BIN2RES_TARGET) \
|
||||
$(BUILDNO_H) \
|
||||
$(BUGCODES_H) \
|
||||
$(BUGCODES_RC) \
|
||||
$(ERRCODES_H) \
|
||||
$(ERRCODES_RC) \
|
||||
$(NTSTATUS_H) \
|
||||
$(NTSTATUS_RC) \
|
||||
$(GENDIB_DIB_FILES) \
|
||||
|
@ -471,24 +460,11 @@ msvc: $(RBUILD_TARGET)
|
|||
$(ECHO_RBUILD)
|
||||
$(Q)$(RBUILD_TARGET) $(RBUILD_FLAGS) $(ROS_RBUILDFLAGS) msvc
|
||||
|
||||
$(BUGCODES_H) $(BUGCODES_RC): $(WMC_TARGET) $(NTOSKRNL_MC)
|
||||
${mkdir} $(INTERMEDIATE_)include$(SEP)reactos 2>$(NUL)
|
||||
${mkdir} $(INTERMEDIATE_)ntoskrnl 2>$(NUL)
|
||||
$(ECHO_WMC)
|
||||
$(Q)$(WMC_TARGET) -i -H $(BUGCODES_H) -o $(BUGCODES_RC) $(NTOSKRNL_MC)
|
||||
|
||||
$(ERRCODES_H) $(ERRCODES_RC): $(WMC_TARGET) $(KERNEL32_MC)
|
||||
${mkdir} $(INTERMEDIATE_)include$(SEP)reactos 2>$(NUL)
|
||||
${mkdir} $(INTERMEDIATE_)dll$(SEP)win32$(SEP)kernel32 2>$(NUL)
|
||||
$(ECHO_WMC)
|
||||
$(Q)$(WMC_TARGET) -i -U -H $(ERRCODES_H) -o $(ERRCODES_RC) $(KERNEL32_MC)
|
||||
|
||||
$(NTSTATUS_H) $(NTSTATUS_RC): $(WMC_TARGET) $(NTDLL_MC)
|
||||
${mkdir} $(INTERMEDIATE_)include$(SEP)reactos 2>$(NUL)
|
||||
${mkdir} $(INTERMEDIATE_)dll$(SEP)ntdll$(SEP)def 2>$(NUL)
|
||||
$(ECHO_WMC)
|
||||
$(Q)$(WMC_TARGET) -i -U -H $(NTSTATUS_H) -o $(NTSTATUS_RC) $(NTDLL_MC)
|
||||
|
||||
.PHONY: msvc6
|
||||
msvc6: $(RBUILD_TARGET)
|
||||
$(ECHO_RBUILD)
|
||||
|
|
|
@ -117,6 +117,7 @@
|
|||
</directory>
|
||||
</if>
|
||||
</directory>
|
||||
<file>errcodes.mc</file>
|
||||
</module>
|
||||
<module name="kernel32" type="win32dll" baseaddress="${BASEADDRESS_KERNEL32}" installbase="system32" installname="kernel32.dll">
|
||||
<importlibrary definition="kernel32.def" />
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -422,6 +422,7 @@
|
|||
<directory name="wmi">
|
||||
<file>wmi.c</file>
|
||||
</directory>
|
||||
<file>bugcodes.mc</file>
|
||||
<file>ntoskrnl.rc</file>
|
||||
<linkerflag>-nostartfiles</linkerflag>
|
||||
<linkerflag>-nostdlib</linkerflag>
|
||||
|
|
|
@ -417,6 +417,7 @@
|
|||
<directory name="wmi">
|
||||
<file>wmi.c</file>
|
||||
</directory>
|
||||
<file>bugcodes.mc</file>
|
||||
<file>ntoskrnl.rc</file>
|
||||
<linkerflag>-nostartfiles</linkerflag>
|
||||
<linkerflag>-nostdlib</linkerflag>
|
||||
|
|
|
@ -289,6 +289,16 @@ MingwModuleHandler::GetActualSourceFilename (
|
|||
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 );
|
||||
}
|
||||
|
@ -392,6 +402,11 @@ MingwModuleHandler::GetImportLibraryDependency (
|
|||
dep += ssprintf ( " $(%s_HEADERS)", importedModule.name.c_str () );
|
||||
break;
|
||||
}
|
||||
if ( GetExtension ( *objectFilename ) == ".rc" )
|
||||
{
|
||||
dep += ssprintf ( " $(%s_MCHEADERS)", importedModule.name.c_str () );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -433,6 +448,7 @@ MingwModuleHandler::GetModuleDependencies (
|
|||
}
|
||||
vector<FileLocation> v;
|
||||
GetDefinitionDependencies ( v );
|
||||
|
||||
for ( size_t i = 0; i < v.size (); i++ )
|
||||
{
|
||||
const FileLocation& file = v[i];
|
||||
|
@ -502,6 +518,8 @@ MingwModuleHandler::GetObjectFilename (
|
|||
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" )
|
||||
|
@ -1033,6 +1051,8 @@ MingwModuleHandler::GenerateObjectMacros (
|
|||
|
||||
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++ )
|
||||
|
@ -1060,6 +1080,12 @@ MingwModuleHandler::GenerateObjectMacros (
|
|||
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,
|
||||
|
@ -1086,6 +1112,38 @@ MingwModuleHandler::GenerateObjectMacros (
|
|||
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++ )
|
||||
{
|
||||
|
@ -1296,6 +1354,37 @@ MingwModuleHandler::GenerateWinebuildCommands (
|
|||
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 )
|
||||
{
|
||||
|
@ -1371,6 +1460,13 @@ MingwModuleHandler::GetIdlHeaderFilename ( const FileLocation *base ) const
|
|||
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,
|
||||
|
@ -1535,6 +1631,11 @@ MingwModuleHandler::GenerateCommands (
|
|||
windresflagsMacro );
|
||||
return;
|
||||
}
|
||||
else if ( extension == ".mc" || extension == ".MC" )
|
||||
{
|
||||
GenerateWmcCommands ( sourceFile );
|
||||
return;
|
||||
}
|
||||
else if ( extension == ".spec" || extension == ".SPEC" )
|
||||
{
|
||||
GenerateWinebuildCommands ( sourceFile );
|
||||
|
@ -1830,7 +1931,12 @@ MingwModuleHandler::GenerateObjectFileTargets (
|
|||
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;
|
||||
}
|
||||
}
|
||||
|
@ -2341,7 +2447,24 @@ MingwModuleHandler::GetDefaultDependencies (
|
|||
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
|
||||
|
@ -2417,7 +2540,7 @@ MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
|
|||
|
||||
vector<FileLocation> deps;
|
||||
GetDefinitionDependencies ( deps );
|
||||
|
||||
|
||||
fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );
|
||||
|
||||
fprintf ( fMakefile, "%s: %s",
|
||||
|
@ -2462,6 +2585,24 @@ MingwModuleHandler::GetSpecObjectDependencies (
|
|||
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,
|
||||
|
|
|
@ -122,7 +122,6 @@ protected:
|
|||
void GenerateRules ();
|
||||
void GenerateImportLibraryTargetIfNeeded ();
|
||||
void GetDefinitionDependencies ( std::vector<FileLocation>& dependencies ) const;
|
||||
|
||||
std::string GetLinkingDependencies () const;
|
||||
static MingwBackend* backend;
|
||||
static FILE* fMakefile;
|
||||
|
@ -164,6 +163,7 @@ private:
|
|||
void GenerateWindresCommand ( const FileLocation* sourceFile,
|
||||
const std::string& windresflagsMacro );
|
||||
void GenerateWinebuildCommands ( const FileLocation* sourceFile );
|
||||
void GenerateWmcCommands ( const FileLocation* sourceFile);
|
||||
std::string GetWidlFlags ( const CompilationUnit& compilationUnit );
|
||||
void GenerateWidlCommandsServer (
|
||||
const CompilationUnit& compilationUnit,
|
||||
|
@ -202,6 +202,8 @@ private:
|
|||
const std::string& widlflagsMacro );
|
||||
const FileLocation* GenerateArchiveTarget ( const std::string& ar,
|
||||
const std::string& objs_macro ) const;
|
||||
void GetMcObjectDependencies ( std::vector<FileLocation>& dependencies,
|
||||
const FileLocation *file ) const;
|
||||
void GetSpecObjectDependencies ( std::vector<FileLocation>& dependencies,
|
||||
const FileLocation *file ) const;
|
||||
void GetWidlObjectDependencies ( std::vector<FileLocation>& dependencies,
|
||||
|
@ -213,10 +215,12 @@ private:
|
|||
void GenerateBuildNonSymbolStrippedCode ();
|
||||
void CleanupCompilationUnitVector ( std::vector<CompilationUnit*>& compilationUnits );
|
||||
void GetRpcHeaderDependencies ( std::vector<FileLocation>& dependencies ) const;
|
||||
void GetMcHeaderDependencies ( std::vector<FileLocation>& dependencies ) const;
|
||||
static std::string GetPropertyValue ( const Module& module, const std::string& name );
|
||||
const FileLocation* GetRpcServerHeaderFilename ( const FileLocation *base ) const;
|
||||
const FileLocation* GetRpcClientHeaderFilename ( const FileLocation *base ) const;
|
||||
const FileLocation* GetIdlHeaderFilename ( const FileLocation *base ) const;
|
||||
const FileLocation* GetMcHeaderFilename ( const FileLocation *base ) const;
|
||||
std::string GetModuleCleanTarget ( const Module& module ) const;
|
||||
void GetReferencedObjectLibraryModuleCleanTargets ( std::vector<std::string>& moduleNames ) const;
|
||||
public:
|
||||
|
|
|
@ -68,7 +68,7 @@ CompilationUnit::IsGeneratedFile () const
|
|||
return false;
|
||||
File* file = files[0];
|
||||
string extension = GetExtension ( file->file );
|
||||
return ( extension == ".spec" || extension == ".SPEC" );
|
||||
return ( extension == ".spec" || extension == ".SPEC" || extension == ".mc" || extension == ".MC");
|
||||
}
|
||||
|
||||
bool
|
||||
|
|
Loading…
Reference in a new issue