const FileLocation*
MingwModuleHandler::GetImportLibraryFilename (
const Module& module,
- string_list* pclean_files )
+ string_list* pclean_files,
+ bool delayimp )
{
- FileLocation *target = new FileLocation ( *module.dependency );
+ FileLocation *target;
+
+ if (module.HasImportLibrary())
+ {
+ if (delayimp)
+ {
+ target = new FileLocation ( *module.delayImportLibrary->target );
+ }
+ else
+ target = new FileLocation ( *module.importLibrary->target );
+ }
+ else
+ target = new FileLocation ( *module.dependency );
+
if ( pclean_files )
{
string_list& clean_files = *pclean_files;
case RpcProxy:
case MessageHeader:
case IdlHeader:
+ case IdlInterface:
case EmbeddedTypeLib:
case BootSector:
handler = new MingwModuleHandler( module );
case LiveIso:
handler = new MingwLiveIsoModuleHandler ( module );
break;
- case IsoRegTest:
- handler = new MingwIsoModuleHandler ( module );
- break;
- case LiveIsoRegTest:
- handler = new MingwLiveIsoModuleHandler ( module );
- break;
case Test:
handler = new MingwTestModuleHandler ( module );
break;
return true;
if ( module.type == IdlHeader )
return true;
+ if ( module.type == IdlInterface )
+ return true;
if ( module.type == MessageHeader)
return true;
return false;
MingwModuleHandler::OutputCopyCommand ( const FileLocation& source,
const FileLocation& destination )
{
+ fprintf ( fMakefile, "# OUTPUT COPY COMMAND\n" );
+ fprintf ( fMakefile,
+ "\t$(ECHO_CP)\n" );
+ fprintf ( fMakefile,
+ "\t${cp} %s %s 1>$(NUL)\n",
+ backend->GetFullName ( source ).c_str (),
+ backend->GetFullName ( *PassThruCacheDirectory ( &destination ) ).c_str () );
+}
+
+void
+MingwModuleHandler::OutputCopyCommandSingle ( const FileLocation& source,
+ const FileLocation& destination )
+{
+ fprintf ( fMakefile,
+ "%s : %s\n",
+ backend->GetFullName ( *PassThruCacheDirectory ( &destination ) ).c_str (),
+ backend->GetFullName ( source ).c_str () );
fprintf ( fMakefile,
"\t$(ECHO_CP)\n" );
fprintf ( fMakefile,
string
MingwModuleHandler::GetImportLibraryDependency (
- const Module& importedModule )
+ const Module& importedModule,
+ bool delayimp )
{
string dep;
if ( ReferenceObjects ( importedModule ) )
}
else
{
- const FileLocation *library_target = GetImportLibraryFilename ( importedModule, NULL );
+ const FileLocation *library_target = GetImportLibraryFilename ( importedModule, NULL, delayimp );
dep = backend->GetFullName ( *library_target );
delete library_target;
}
+
+ if ( IsStaticLibrary ( importedModule ) || importedModule.type == ObjectLibrary )
+ {
+ const std::vector<Library*>& libraries = importedModule.non_if_data.libraries;
+
+ for ( size_t i = 0; i < libraries.size (); ++ i )
+ {
+ dep += " ";
+ dep += GetImportLibraryDependency ( *libraries[i]->importedModule, libraries[i]->delayimp );
+ }
+ }
+
return dep;
}
}
}
else
- targets.push_back ( GetImportLibraryDependency ( dependencyModule ) );
+ targets.push_back ( GetImportLibraryDependency ( dependencyModule, false ) );
}
void
if ( module.type == BootSector )
return new FileLocation ( *module.output );
- else if ( extension == ".rc" || extension == ".RC" )
+ else if (extension == ".rc")
newExtension = "_" + module.name + ".coff";
- else if ( extension == ".mc" || extension == ".MC" )
+ else if (extension == ".mc")
newExtension = ".rc";
- else if ( extension == ".spec" || extension == ".SPEC" )
- newExtension = ".stubs.o";
- else if ( extension == ".pspec" || extension == ".PSPEC" )
- newExtension = ".stubs.o";
- else if ( extension == ".idl" || extension == ".IDL" )
+ else if (extension == ".idl")
{
if ( module.type == RpcServer )
newExtension = "_s.o";
newExtension = "_c.o";
else if ( module.type == RpcProxy )
newExtension = "_p.o";
+ else if ( module.type == IdlInterface )
+ newExtension = "_i.o";
else
newExtension = ".h";
}
if ( module.type == Alias )
return;
+ fprintf ( fMakefile, "# CLEAN TARGET\n" );
fprintf ( fMakefile,
".PHONY: %s_clean\n",
module.name.c_str() );
{
if ( !module.install )
return;
+ fprintf ( fMakefile, "# INSTALL TARGET\n" );
fprintf ( fMakefile, ".PHONY: %s_install\n", module.name.c_str() );
fprintf ( fMakefile,
"%s_install: %s\n",
void
MingwModuleHandler::GenerateDependsTarget () const
{
+ fprintf ( fMakefile, "# DEPENDS TARGET\n" );
fprintf ( fMakefile,
".PHONY: %s_depends\n",
module.name.c_str() );
module.name.c_str () );
}
-string
-MingwModuleHandler::GetObjectFilenames ()
+static
+const char * const CompilerPrefixTable [ CompilerTypesCount ] =
{
- const vector<CompilationUnit*>& compilationUnits = module.non_if_data.compilationUnits;
- if ( compilationUnits.size () == 0 )
- return "";
+ "C",
+ "CXX",
+ "CPP",
+ "AS",
+ "MIDL",
+ "RC",
+ "NASM",
+};
- string objectFilenames ( "" );
- for ( size_t i = 0; i < compilationUnits.size (); i++ )
+/* static */ void
+MingwModuleHandler::GenerateParameters (
+ const char* prefix,
+ const char* assignmentOperation,
+ const IfableData& data )
+{
+ for ( unsigned type = CompilerTypeCC; type < CompilerTypesCount; ++ type )
{
- if ( objectFilenames.size () > 0 )
- objectFilenames += " ";
- const FileLocation& compilationName = compilationUnits[i]->GetFilename ();
- const FileLocation *object_file = GetObjectFilename ( &compilationName, module );
- objectFilenames += backend->GetFullName ( *object_file );
- delete object_file;
+ CompilerType compiler = static_cast < CompilerType > ( type );
+
+ // Includes
+ std::string includes = GenerateIncludeParametersFromVector ( data.includes, compiler );
+
+ if ( includes.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sINCLUDES%s%s\n",
+ prefix,
+ CompilerPrefixTable [ compiler ],
+ assignmentOperation,
+ includes.c_str () );
+ }
+
+ // Defines
+ std::string defines = GenerateDefineParametersFromVector ( data.defines, compiler );
+
+ if ( defines.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sDEFINES%s%s\n",
+ prefix,
+ CompilerPrefixTable [ compiler ],
+ assignmentOperation,
+ defines.c_str () );
+ }
+
+ // Flags
+ std::string flags = GenerateCompilerParametersFromVector ( data.compilerFlags, compiler );
+
+ if ( flags.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sFLAGS%s%s\n",
+ prefix,
+ CompilerPrefixTable [ compiler ],
+ assignmentOperation,
+ flags.c_str () );
+ }
}
- return objectFilenames;
}
/* static */ string
Define& define = *defines[i];
if (used_defs.find(define.name) != used_defs.end())
continue;
+ if (define.redefine)
+ {
+ if (parameters.length () > 0)
+ parameters += " ";
+ parameters += "-U";
+ parameters += define.name;
+ }
if (parameters.length () > 0)
parameters += " ";
- if (define.name.find('(') != string::npos)
+ if (define.arguments.length ())
parameters += "$(QT)";
parameters += "-D";
parameters += define.name;
+ parameters += define.arguments;
if (define.value.length () > 0)
{
parameters += "=";
parameters += define.value;
}
- if (define.name.find('(') != string::npos)
+ if (define.arguments.length ())
parameters += "$(QT)";
used_defs.insert(used_defs.begin(),define.name);
}
return parameters;
}
-string
-MingwModuleHandler::GenerateGccDefineParameters () const
+/* static */ string
+MingwModuleHandler::GenerateDefineParametersFromVector (
+ const std::vector<Define*>& defines,
+ CompilerType compiler )
{
- set<string> used_defs;
- string parameters = GenerateGccDefineParametersFromVector ( module.project.non_if_data.defines, used_defs );
- string s = GenerateGccDefineParametersFromVector ( module.non_if_data.defines, used_defs );
- if ( s.length () > 0 )
+ string parameters;
+
+ for ( size_t i = 0; i < defines.size (); i++ )
{
- parameters += " ";
- parameters += s;
+ Define& define = *defines[i];
+ if (!define.IsCompilerSet (compiler))
+ continue;
+ if (define.redefine)
+ {
+ if (parameters.length () > 0)
+ parameters += " ";
+ parameters += "-U";
+ parameters += define.name;
+ }
+ if (parameters.length () > 0)
+ parameters += " ";
+ if (define.arguments.length ())
+ parameters += "$(QT)";
+ parameters += "-D";
+ parameters += define.name;
+ parameters += define.arguments;
+ if (define.value.length () > 0)
+ {
+ parameters += "=";
+ parameters += define.value;
+ }
+ if (define.arguments.length ())
+ parameters += "$(QT)";
}
return parameters;
}
}
/* static */ string
-MingwModuleHandler::GenerateGccIncludeParametersFromVector ( const vector<Include*>& includes )
+MingwModuleHandler::GenerateIncludeParametersFromVector ( const vector<Include*>& includes, const CompilerType type )
{
string parameters, path_prefix;
for ( size_t i = 0; i < includes.size (); i++ )
{
Include& include = *includes[i];
- if ( parameters.length () > 0 )
- parameters += " ";
- parameters += "-I" + backend->GetFullPath ( *include.directory );;
+ if ( include.IsCompilerSet( type ) )
+ parameters += " -I" + backend->GetFullPath ( *include.directory );
}
return parameters;
}
-string
-MingwModuleHandler::GenerateGccIncludeParameters () const
-{
- string parameters = GenerateGccIncludeParametersFromVector ( module.non_if_data.includes );
- string s = GenerateGccIncludeParametersFromVector ( module.project.non_if_data.includes );
- if ( s.length () > 0 )
- {
- parameters += " ";
- parameters += s;
- }
- return parameters;
-}
-
-string
-MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags, const CompilerType type ) const
+/* static */ string
+MingwModuleHandler::GenerateCompilerParametersFromVector ( const vector<CompilerFlag*>& compilerFlags, const CompilerType type )
{
string parameters;
for ( size_t i = 0; i < compilerFlags.size (); i++ )
{
CompilerFlag& compilerFlag = *compilerFlags[i];
- if ( compilerFlag.compiler == type )
+ if ( compilerFlag.IsCompilerSet( type ) )
parameters += " " + compilerFlag.flag;
}
return parameters;
dependencies += " \\\n\t\t", wrap_count = 0;
else if ( dependencies.size () > 0 )
dependencies += " ";
- dependencies += GetImportLibraryDependency ( *libraries[i]->importedModule );
+ dependencies += GetImportLibraryDependency ( *libraries[i]->importedModule, libraries[i]->delayimp );
}
return dependencies;
}
return GenerateLinkerParametersFromVector ( module.linkerFlags );
}
-void
-MingwModuleHandler::GenerateMacro (
- const char* assignmentOperation,
- const string& macro,
- const IfableData& data,
- set<const Define *> *used_defs,
- bool generatingCompilerMacro )
-{
- size_t i;
- bool generateAssignment;
-
- generateAssignment = (use_pch && module.pch != NULL ) || data.includes.size () > 0 || data.defines.size () > 0;
- if ( generatingCompilerMacro )
- generateAssignment |= data.compilerFlags.size () > 0;
- if ( generateAssignment )
- {
- fprintf ( fMakefile,
- "%s %s",
- macro.c_str(),
- assignmentOperation );
- }
-
- const FileLocation *pchFilename = GetPrecompiledHeaderFilename ();
- if ( pchFilename )
- {
- fprintf ( fMakefile,
- " -I%s",
- backend->GetFullPath ( *pchFilename ).c_str () );
- delete pchFilename;
- }
-
- if ( generatingCompilerMacro )
- {
- string compilerParameters = GenerateCompilerParametersFromVector ( data.compilerFlags, CompilerTypeDontCare );
- if ( compilerParameters.size () > 0 )
- {
- fprintf (
- fMakefile,
- "%s",
- compilerParameters.c_str () );
- }
- }
- for ( i = 0; i < data.includes.size(); i++ )
- {
- const Include& include = *data.includes[i];
- const FileLocation* includeDirectory = include.directory;
- fprintf (
- fMakefile,
- " -I%s",
- backend->GetFullPath ( *includeDirectory ).c_str() );
- }
- for ( i = 0; i < data.defines.size(); i++ )
- {
- const Define& define = *data.defines[i];
- if ( used_defs )
- {
- set<const Define *>::const_iterator last_define;
- for (last_define = used_defs->begin ();
- last_define != used_defs->end ();
- last_define++)
- {
- if ( (*last_define)->name != define.name )
- continue;
- if ( !define.overridable )
- {
- throw InvalidOperationException ( (*last_define)->node->location.c_str (),
- 0,
- "Invalid override of define '%s', already defined at %s",
- define.name.c_str (),
- define.node->location.c_str () );
- }
- if ( backend->configuration.Verbose )
- printf("%s: Overriding '%s' already defined at %s\n",
- (*last_define)->node->location.c_str (), define.name.c_str (),
- define.node->location.c_str () );
- break;
- }
- if ( last_define != used_defs->end () )
- continue;
- }
- fprintf (
- fMakefile,
- " -D%s",
- define.name.c_str() );
- if (define.value.length () > 0)
- fprintf (
- fMakefile,
- "=%s",
- define.value.c_str() );
- if ( used_defs )
- used_defs->insert( used_defs->begin (), &define );
- }
- if ( generateAssignment )
- {
- fprintf ( fMakefile, "\n" );
- }
-}
-
void
MingwModuleHandler::GenerateMacros (
const char* assignmentOperation,
const vector<LinkerFlag*>* linkerFlags,
set<const Define *>& used_defs )
{
- GenerateMacro ( assignmentOperation,
- cflagsMacro,
- data,
- &used_defs,
- true );
- GenerateMacro ( assignmentOperation,
- windresflagsMacro,
- data,
- NULL,
- false );
-
if ( linkerFlags != NULL )
{
string linkerParameters = GenerateLinkerParametersFromVector ( *linkerFlags );
if ( data.libraries.size () > 0 )
{
+ // Check if host and target modules are not mixed up
+ HostType current = ModuleHandlerInformations[module.type].DefaultHost;
+ std::vector<Library*>::const_iterator it;
+ for ( it = data.libraries.begin(); it != data.libraries.end(); ++it )
+ {
+ HostType imported = ModuleHandlerInformations[(*it)->importedModule->type].DefaultHost;
+ if (current != imported)
+ {
+ throw InvalidOperationException ( __FILE__,
+ __LINE__,
+ "Module '%s' imports module '%s', which is not of the right type",
+ module.name.c_str (),
+ (*it)->importedModule->name.c_str () );
+ }
+ }
+
string deps = GenerateImportLibraryDependenciesFromVector ( data.libraries );
if ( deps.size () > 0 )
{
delete object_file;
}
CleanupCompilationUnitVector ( sourceCompilationUnits );
+
+ if ( IsSpecDefinitionFile() )
+ {
+ const FileLocation *stubs_file = new FileLocation(
+ IntermediateDirectory,
+ module.importLibrary->source->relative_path,
+ ReplaceExtension ( module.importLibrary->source->name, "_" + module.name + ".stubs.o" ) );
+
+ fprintf (
+ fMakefile,
+ "%s += %s\n",
+ objectsMacro.c_str(),
+ backend->GetFullName ( *stubs_file ).c_str () );
+
+ delete stubs_file;
+ }
+
+ if ( module.type == RpcProxy )
+ {
+ const FileLocation *dlldata_file = GetDlldataFilename();
+
+ fprintf (
+ fMakefile,
+ "%s += %s\n",
+ objectsMacro.c_str(),
+ ReplaceExtension ( backend->GetFullName ( *dlldata_file ), ".o" ).c_str() );
+
+ delete dlldata_file;
+ }
}
-/* caller needs to delete the returned object */
const FileLocation*
-MingwModuleHandler::GetPrecompiledHeaderFilename () const
+MingwModuleHandler::GetDlldataFilename() const
+{
+ std::string dlldata_path = "";
+ size_t dlldata_path_len = module.xmlbuildFile.find_last_of(cSep);
+
+ if ( dlldata_path_len != std::string::npos && dlldata_path_len != 0 )
+ dlldata_path = module.xmlbuildFile.substr(0, dlldata_path_len);
+
+ return new FileLocation( IntermediateDirectory, dlldata_path, module.name + ".dlldata.c" );
+}
+
+const FileLocation*
+MingwModuleHandler::GetPrecompiledHeaderPath () const
{
if ( !module.pch || !use_pch )
return NULL;
return new FileLocation ( IntermediateDirectory,
module.pch->file->relative_path,
+ ".gch_" + module.name );
+}
+
+const FileLocation*
+MingwModuleHandler::GetPrecompiledHeaderFilename () const
+{
+ if ( !module.pch || !use_pch )
+ return NULL;
+ return new FileLocation ( IntermediateDirectory,
+ module.pch->file->relative_path + "/.gch_" + module.name,
module.pch->file->name + ".gch" );
}
-Rule arRule1 ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).a: $($(module_name)_OBJS) | $(INTERMEDIATE)$(SEP)$(source_dir)\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).a",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule windresRule ( "$(eval $(call RBUILD_WRC_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).coff",
+ "$(intermediate_path_unique).res",
+ "$(intermediate_path_unique).res.d",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule winebuildPRule ( "$(eval $(call RBUILD_WINEBUILD_WITH_CPP_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags),$(module_dllname)))\n",
+ "$(intermediate_path_unique).spec",
+ "$(intermediate_path_unique).spec.d",
+ "$(intermediate_path_unique).auto.def",
+ "$(intermediate_path_unique).stubs.c",
+ "$(intermediate_path_unique).stubs.o",
+ "$(intermediate_path_unique).stubs.o.d",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule winebuildRule ( "$(eval $(call RBUILD_WINEBUILD_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags),$(module_dllname)))\n",
+ "$(intermediate_path_unique).auto.def",
+ "$(intermediate_path_unique).stubs.c",
+ "$(intermediate_path_unique).stubs.o",
+ "$(intermediate_path_unique).stubs.o.d",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule gasRule ( "$(eval $(call RBUILD_GAS_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_path_unique).o.d", NULL );
+Rule gccRule ( "$(eval $(call RBUILD_CC_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_path_unique).o.d", NULL );
+Rule gccHostRule ( "$(eval $(call RBUILD_HOST_GCC_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o", NULL );
+Rule gppRule ( "$(eval $(call RBUILD_CXX_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_path_unique).o.d", NULL );
+Rule gppHostRule ( "$(eval $(call RBUILD_HOST_GPP_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_unique).o", NULL );
+Rule widlHeaderRule ( "$(eval $(call RBUILD_WIDL_HEADER_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_noext).h",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule widlServerRule ( "$(eval $(call RBUILD_WIDL_SERVER_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_noext)_s.h",
+ "$(intermediate_path_noext)_s.c",
+ "$(intermediate_path_noext)_s.o",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule widlClientRule ( "$(eval $(call RBUILD_WIDL_CLIENT_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_noext)_c.h",
+ "$(intermediate_path_noext)_c.c",
+ "$(intermediate_path_noext)_c.o",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule widlProxyRule ( "$(eval $(call RBUILD_WIDL_PROXY_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_noext)_p.h",
+ "$(intermediate_path_noext)_p.c",
+ "$(intermediate_path_noext)_p.o",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule widlInterfaceRule ( "$(eval $(call RBUILD_WIDL_INTERFACE_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_path_noext)_i.c",
+ "$(intermediate_path_noext)_i.o",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule widlDlldataRule ( "$(eval $(call RBUILD_WIDL_DLLDATA_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags),$(bare_dependencies)))\n",
+ "$(intermediate_path_noext).o", NULL );
+Rule widlTlbRule ( "$(eval $(call RBUILD_WIDL_TLB_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_dir)$(SEP)", NULL );
+Rule pchRule ( "$(eval $(call RBUILD_CC_PCH_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)", NULL );
+Rule pchCxxRule ( "$(eval $(call RBUILD_CXX_PCH_RULE,$(module_name),$(source),$(dependencies),$(compiler_flags)))\n",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)$(source_name).gch.d",
+ "$(intermediate_dir)$(SEP).gch_$(module_name)$(SEP)", NULL );
+Rule bootRule ( "$(eval $(call RBUILD_NASM,$(module_name),$(source),$(dependencies),,$(module_output)))\n",
+ "$(module_output)",
+ "$(OUTPUT)$(SEP)$(source_dir)$(SEP)", NULL );
+Rule nasmRule ( "$(eval $(call RBUILD_NASM,$(module_name),$(source),$(dependencies),,$(intermediate_path_unique).o))\n",
+ "$(intermediate_path_unique).o",
+ "$(intermediate_dir)$(SEP)", NULL );
+
+/* TODO: move these to rules.mak */
+Rule wmcRule ( "$(intermediate_path_noext).rc $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h: $(WMC_TARGET) $(source) | $(intermediate_dir)\n"
+ "\t$(ECHO_WMC)\n"
+ "\t$(Q)$(WMC_TARGET) -i -H $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h -o $(intermediate_path_noext).rc $(source)\n",
+ "$(intermediate_path_noext).rc",
+ "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h",
+ "$(intermediate_dir)$(SEP)", NULL );
+/* TODO: if possible, move these to rules.mak */
+Rule arRule1 ( "$(intermediate_path_noext).a: $($(module_name)_OBJS) $(dependencies) | $(intermediate_dir)\n",
+ "$(intermediate_path_noext).a",
+ "$(intermediate_dir)$(SEP)", NULL );
Rule arRule2 ( "\t$(ECHO_AR)\n"
"\t${ar} -rc $@ $($(module_name)_OBJS)\n",
NULL );
-Rule arHostRule2 ( "\t$(ECHO_AR)\n"
+Rule arHostRule2 ( "\t$(ECHO_HOSTAR)\n"
"\t${host_ar} -rc $@ $($(module_name)_OBJS)\n",
NULL );
-Rule gasRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_GAS)\n"
- "\t${gcc} -x assembler-with-cpp -o $@ -D__ASM__ $($(module_name)_CFLAGS) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule bootRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(module_output): $(source)$(dependencies) | $(OUTPUT)$(SEP)$(source_dir)\n"
- "\t$(ECHO_NASM)\n"
- "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
- "$(OUTPUT)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule nasmRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_NASM)\n"
- "\t$(Q)${nasm} -f win32 $< -o $@ $($(module_name)_NASMFLAGS)\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule windresRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).coff: $(source)$(dependencies) $(WRC_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir) $(TEMPORARY)\n"
- "\t$(ECHO_WRC)\n"
- "\t${gcc} -xc -E -DRC_INVOKED ${$(module_name)_RCFLAGS} $(source) > $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp\n"
- "\t$(Q)$(WRC_TARGET) ${$(module_name)_RCFLAGS} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp\n"
- "\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).rci.tmp 2>$(NUL)\n"
- "\t${windres} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp -o $@\n"
- "\t-@${rm} $(TEMPORARY)$(SEP)$(module_name).$(source_name_noext).res.tmp 2>$(NUL)\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).coff",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule wmcRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc $(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h: $(WMC_TARGET) $(source) | $(INTERMEDIATE)$(SEP)$(source_dir)\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",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).rc",
- "$(INTERMEDIATE)$(SEP)include$(SEP)reactos$(SEP)$(source_name_noext).h",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule winebuildKMRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_WINEBLD)\n"
- "\t${gcc} -xc -E $(source) -I. > $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c:\n"
- "\t${cp} $(NUL) $@ 1>$(NUL)\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule winebuildPCRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_WINEBLD)\n"
- "\t${gcc} -xc -E $(source) -I. > $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec.def --def -E $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
- "$(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c: $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).spec $(WINEBUILD_TARGET)\n"
- "\t$(ECHO_WINEBLD)\n"
- "\t$(Q)$(WINEBUILD_TARGET) $(WINEBUILD_FLAGS) -o $(INTERMEDIATE)$(SEP)$(source_path)$(SEP)$(source_name_noext).stubs.c --pedll $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule winebuildRule ( "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def: $(source)$(dependencies) $(WINEBUILD_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\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)\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$(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"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).spec.def",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.c",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).stubs.o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlHeaderRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h $(source)\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).h",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlServerRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h -s -S $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(source)\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.h",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.c",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_s.o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlClientRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h -c -C $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(source)\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.h",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.c",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_c.o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlProxyRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -h -H $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h -p -P $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(source)\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.o: $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.h",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.c",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_p.o",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule widlTlbRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(module_name).tlb: $(source)$(dependencies) $(WIDL_TARGET) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_WIDL)\n"
- "\t$(Q)$(WIDL_TARGET) $($(module_name)_WIDLFLAGS) -t -T $(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext).tlb $(source)\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)", NULL );
-Rule gccRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o", NULL );
-Rule gccHostRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${host_gcc} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o", NULL );
-Rule gppRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${gpp} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o", NULL );
-Rule gppHostRule ( "$(source): ${$(module_name)_precondition}\n"
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o: $(source)$(dependencies) | $(INTERMEDIATE)$(SEP)$(source_dir)\n"
- "\t$(ECHO_CC)\n"
- "\t${host_gpp} -o $@ $($(module_name)_CFLAGS)$(compiler_flags) -c $<\n",
- "$(INTERMEDIATE)$(SEP)$(source_dir)$(SEP)$(source_name_noext)_$(module_name).o", NULL );
+
Rule emptyRule ( "", NULL );
void
const FileLocation *pchFilename = GetPrecompiledHeaderFilename ();
string dependencies = extraDependencies;
- string flags;
- string extension = GetExtension ( *sourceFile );
- if ( extension == ".cc" || extension == ".cpp" || extension == ".cxx" )
- flags = GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags, CompilerTypeCPP );
- else
- flags = GenerateCompilerParametersFromVector ( module.non_if_data.compilerFlags, CompilerTypeCC );
-
if ( pchFilename )
{
dependencies += " " + backend->GetFullName ( *pchFilename );
if ( rpcDependencies.size () > 0 )
dependencies += " " + v2s ( backend, rpcDependencies, 5 );
- rule->Execute ( fMakefile, backend, module, sourceFile, clean_files, dependencies, flags );
+ rule->Execute ( fMakefile, backend, module, sourceFile, clean_files, dependencies );
}
string
MingwModuleHandler::GetPropertyValue ( const Module& module, const std::string& name )
{
- for ( size_t i = 0; i < module.project.non_if_data.properties.size (); i++ )
- {
- const Property& property = *module.project.non_if_data.properties[i];
- if ( property.name == name )
- return property.value;
- }
- return string ( "" );
+ const Property* property = module.project.LookupProperty(name);
+
+ if (property)
+ return property->value;
+ else
+ return string ( "" );
}
/* caller needs to delete the returned object */
{ HostDontCare, TypeDontCare, ".asm", &nasmRule },
{ HostDontCare, TypeDontCare, ".rc", &windresRule },
{ HostDontCare, TypeDontCare, ".mc", &wmcRule },
- { HostFalse, Kernel, ".spec", &winebuildKMRule },
- { HostFalse, KernelModeDLL, ".spec", &winebuildKMRule },
- { HostDontCare, TypeDontCare, ".pspec", &winebuildPCRule },
- { HostDontCare, TypeDontCare, ".spec", &winebuildRule },
{ HostDontCare, RpcServer, ".idl", &widlServerRule },
{ HostDontCare, RpcClient, ".idl", &widlClientRule },
{ HostDontCare, RpcProxy, ".idl", &widlProxyRule },
+ { HostDontCare, IdlInterface, ".idl", &widlInterfaceRule },
{ HostDontCare, EmbeddedTypeLib, ".idl", &widlTlbRule },
{ HostDontCare, TypeDontCare, ".idl", &widlHeaderRule },
{ HostTrue, TypeDontCare, ".c", &gccHostRule },
void
MingwModuleHandler::GenerateBuildMapCode ( const FileLocation *mapTarget )
{
+ fprintf ( fMakefile, "# BUILD MAP CODE\n" );
+
fprintf ( fMakefile,
"ifeq ($(ROS_BUILDMAP),full)\n" );
void
MingwModuleHandler::GenerateBuildNonSymbolStrippedCode ()
{
+ fprintf ( fMakefile, "# BUILD NO STRIP CODE\n" );
+
fprintf ( fMakefile,
"ifeq ($(ROS_BUILDNOSTRIP),yes)\n" );
void
MingwModuleHandler::GenerateRunRsymCode () const
{
+ fprintf ( fMakefile, "# RUN RSYM CODE\n" );
fprintf ( fMakefile,
"ifneq ($(ROS_GENERATE_RSYM),no)\n" );
fprintf ( fMakefile,
void
MingwModuleHandler::GenerateRunStripCode () const
{
+ fprintf ( fMakefile, "# RUN STRIP CODE\n" );
fprintf ( fMakefile,
"ifeq ($(ROS_LEAN_AND_MEAN),yes)\n" );
fprintf ( fMakefile,
string objectsMacro = GetObjectsMacro ( module );
string libsMacro = GetLibsMacro ();
+ fprintf ( fMakefile, "# LINKER COMMAND\n" );
+
string target_macro ( GetTargetMacro ( module ) );
string target_folder ( backend->GetFullPath ( *target_file ) );
else
linkerScriptArgument = "";
- fprintf ( fMakefile,
- "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
- target_macro.c_str (),
- definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
- dependencies.c_str (),
- target_folder.c_str () );
- fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
- string targetName ( module.output->name );
-
- /* HACK: if we have C++ in kernel, link it with some user mode dlls (kernel32 + msvcrt) ... */
- static const string libsCppKernel = " '$(shell ${TARGET_CC} -print-file-name=libkernel32.a)' '$(shell ${TARGET_CC} -print-file-name=libmsvcrt.a)'";
+ /* check if we need to add default C++ libraries, ie if we have
+ * a C++ user-mode module without the -nostdlib linker flag
+ */
+ bool link_defaultlibs = module.cplusplus &&
+ linkerParameters.find ("-nostdlib") == string::npos &&
+ !(module.type == KernelModeDLL || module.type == KernelModeDriver);
if ( !module.HasImportLibrary() )
{
fprintf ( fMakefile,
- "\t%s %s%s %s %s%s %s %s -o %s\n",
+ "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
+ target_macro.c_str (),
+ definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
+ dependencies.c_str (),
+ target_folder.c_str () );
+ fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
+
+ fprintf ( fMakefile,
+ "\t%s %s%s %s %s %s %s -o %s\n",
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
objectsMacro.c_str (),
- module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
- module.cplusplus && (module.type == KernelModeDLL || module.type == KernelModeDriver) ? libsCppKernel.c_str () : "",
+ link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
}
else
{
- FileLocation temp_exp ( TemporaryDirectory,
- "",
- module.name + ".temp.exp" );
+ FileLocation temp_exp ( IntermediateDirectory,
+ module.output->relative_path,
+ module.name + ".exp" );
CLEAN_FILE ( temp_exp );
fprintf ( fMakefile,
- "\t${dlltool} --dllname %s --def %s --output-exp %s%s%s\n",
- targetName.c_str (),
+ "%s: %s | %s\n",
+ backend->GetFullName ( temp_exp ).c_str (),
+ definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
+ backend->GetFullPath ( temp_exp ).c_str () );
+ fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
+
+ fprintf ( fMakefile,
+ "\t${dlltool} --dllname %s --def %s --output-exp $@%s%s\n",
+ module.GetDllName ().c_str (),
definitionFilename ? backend->GetFullName ( *definitionFilename ).c_str () : "",
- backend->GetFullName ( temp_exp ).c_str (),
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
fprintf ( fMakefile,
- "\t%s %s%s %s %s %s%s %s %s -o %s\n",
+ "%s: %s %s $(RSYM_TARGET) $(PEFIXUP_TARGET) | %s\n",
+ target_macro.c_str (),
+ backend->GetFullName ( temp_exp ).c_str (),
+ dependencies.c_str (),
+ target_folder.c_str () );
+ fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
+
+ fprintf ( fMakefile,
+ "\t%s %s%s %s %s %s %s %s -o %s\n",
+
linker.c_str (),
linkerParameters.c_str (),
linkerScriptArgument.c_str (),
backend->GetFullName ( temp_exp ).c_str (),
objectsMacro.c_str (),
- module.cplusplus ? "$(PROJECT_LPPFLAGS) " : "",
- module.cplusplus && (module.type == KernelModeDLL || module.type == KernelModeDriver) ? libsCppKernel.c_str () : "",
+ link_defaultlibs ? "$(PROJECT_LPPFLAGS) " : "",
libsMacro.c_str (),
GetLinkerMacro ().c_str (),
target_macro.c_str () );
"\t$(Q)$(PEFIXUP_TARGET) %s -exports%s\n",
target_macro.c_str (),
pefixupParameters.c_str() );
-
- fprintf ( fMakefile,
- "\t-@${rm} %s 2>$(NUL)\n",
- backend->GetFullName ( temp_exp ).c_str () );
}
GenerateBuildMapCode ();
string targetMacro ( GetTargetMacro ( module ) );
const FileLocation *target_file = GetTargetFilename ( module, NULL );
+ fprintf ( fMakefile, "# PHONY TARGET\n" );
fprintf ( fMakefile,
".PHONY: %s\n\n",
targetMacro.c_str ());
size_t i;
string moduleDependencies;
+ fprintf ( fMakefile, "# OBJECT FILE TARGETS\n" );
+
const vector<CompilationUnit*>& compilationUnits = data.compilationUnits;
for ( i = 0; i < compilationUnits.size (); i++ )
{
{
GenerateCommands ( *compilationUnits[i],
moduleDependencies );
- fprintf ( fMakefile,
- "\n" );
}
vector<CompilationUnit*> sourceCompilationUnits;
moduleDependencies );
}
CleanupCompilationUnitVector ( sourceCompilationUnits );
+
+ if ( module.type == RpcProxy )
+ {
+ widlDlldataRule.Execute ( fMakefile,
+ backend,
+ module,
+ GetDlldataFilename(),
+ clean_files,
+ ssprintf ( "$(%s_SOURCES)", module.name.c_str ()) );
+ }
}
void
MingwModuleHandler::GenerateObjectFileTargets ()
{
- const FileLocation *pchFilename = GetPrecompiledHeaderFilename ();
+ fprintf ( fMakefile, "# OBJECT FILE TARGETS\n" );
- if ( pchFilename )
+ if ( module.pch && use_pch )
{
- string cc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ? "${host_gcc}" : "${gcc}" );
- string cppc = ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue ? "${host_gpp}" : "${gpp}" );
- const FileLocation& baseHeaderFile = *module.pch->file;
- CLEAN_FILE ( *pchFilename );
- string dependencies = backend->GetFullName ( baseHeaderFile );
+ std::map<string, string> vars;
+
/* WIDL generated headers may be used */
+ string dependencies;
vector<FileLocation> rpcDependencies;
GetRpcHeaderDependencies ( rpcDependencies );
if ( rpcDependencies.size () > 0 )
- dependencies += " " + v2s ( backend, rpcDependencies, 5 );
- fprintf ( fMakefile,
- "%s: %s | %s\n",
- backend->GetFullName ( *pchFilename ).c_str(),
- dependencies.c_str(),
- backend->GetFullPath ( *pchFilename ).c_str() );
- fprintf ( fMakefile, "\t$(ECHO_PCH)\n" );
- fprintf ( fMakefile,
- "\t%s -o %s %s -g %s\n\n",
- module.cplusplus ? cppc.c_str() : cc.c_str(),
- backend->GetFullName ( *pchFilename ).c_str(),
- cflagsMacro.c_str(),
- backend->GetFullName ( baseHeaderFile ).c_str() );
- delete pchFilename;
+ dependencies = " " + v2s ( backend, rpcDependencies, 5 );
+
+ if ( module.cplusplus )
+ pchCxxRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
+ else
+ pchRule.Execute ( fMakefile, backend, module, module.pch->file, clean_files, dependencies );
+
+ fprintf ( fMakefile, "\n" );
}
GenerateObjectFileTargets ( module.non_if_data );
const FileLocation *archiveFilename = GetModuleArchiveFilename ();
const FileLocation *definitionFilename = GetDefinitionFilename ();
- arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
+ fprintf ( fMakefile, "# ARCHIVE TARGET\n" );
if ( IsStaticLibrary ( module ) && definitionFilename )
{
+ arRule1.Execute ( fMakefile,
+ backend,
+ module,
+ archiveFilename,
+ clean_files,
+ backend->GetFullName ( *definitionFilename ).c_str () );
+
fprintf ( fMakefile,
"\t${dlltool} --dllname %s --def %s --output-lib $@%s%s\n",
- module.importLibrary->dllname.c_str (),
+ module.GetDllName ().c_str (),
backend->GetFullName ( *definitionFilename ).c_str (),
module.mangledSymbols ? "" : " --kill-at",
module.underscoreSymbols ? " --add-underscore" : "" );
}
+ else
+ arRule1.Execute ( fMakefile, backend, module, archiveFilename, clean_files );
if ( definitionFilename )
delete definitionFilename;
return archiveFilename;
}
-string
-MingwModuleHandler::GetCFlagsMacro () const
-{
- return ssprintf ( "$(%s_CFLAGS)",
- module.name.c_str () );
-}
-
/*static*/ string
MingwModuleHandler::GetObjectsMacro ( const Module& module )
{
module.name.c_str () );
}
-string
-MingwModuleHandler::GetLinkingDependenciesMacro () const
-{
- return ssprintf ( "$(%s_LINKDEPS)", module.name.c_str () );
-}
-
string
MingwModuleHandler::GetLibsMacro () const
{
module.name.c_str () );
}
+string
+MingwModuleHandler::GetDebugFormat ()
+{
+ if (Environment::GetArch() == "amd64")
+ {
+ return "dwarf-2";
+ }
+ return "stabs+";
+}
+
string
MingwModuleHandler::GetModuleTargets ( const Module& module )
{
{
sourcesMacro = ssprintf ( "%s_SOURCES", module.name.c_str ());
- GenerateSourceMacros ( module.non_if_data );
+ if ( module.type == RpcProxy || module.type == Cabinet )
+ GenerateSourceMacros ( module.non_if_data );
// future references to the macro will be to get its values
sourcesMacro = ssprintf ("$(%s)", sourcesMacro.c_str ());
{
set<const Define *> used_defs;
- cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());
- nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());
- windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());
- widlflagsMacro = ssprintf ("%s_WIDLFLAGS", module.name.c_str ());
linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());
libsMacro = ssprintf("%s_LIBS", module.name.c_str ());
- linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ());
- GenerateMacros (
- "=",
- module.non_if_data,
- &module.linkerFlags,
- used_defs );
+ const FileLocation * pchPath = GetPrecompiledHeaderPath ();
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
+ if ( pchPath )
{
- GenerateMacros (
- "+=",
- module.project.non_if_data,
- NULL,
- used_defs );
- }
+ string pchPathStr = backend->GetFullName ( *pchPath );
+ delete pchPath;
- vector<FileLocation> s;
- if ( module.importLibrary )
- {
- const vector<CompilationUnit*>& compilationUnits = module.non_if_data.compilationUnits;
- for ( size_t i = 0; i < compilationUnits.size (); i++ )
- {
- CompilationUnit& compilationUnit = *compilationUnits[i];
- const FileLocation& sourceFile = compilationUnit.GetFilename ();
- string extension = GetExtension ( sourceFile );
- if ( extension == ".spec" || extension == ".SPEC" )
- GetSpecObjectDependencies ( s, &sourceFile );
- }
- }
- if ( s.size () > 0 )
- {
- fprintf (
- fMakefile,
- "%s +=",
- linkDepsMacro.c_str() );
- for ( size_t i = 0; i < s.size(); i++ )
- fprintf ( fMakefile,
- " %s",
- backend->GetFullName ( s[i] ).c_str () );
- fprintf ( fMakefile, "\n" );
- }
+ fprintf ( fMakefile,
+ "%s_%sINCLUDES+= -I%s\n",
+ module.name.c_str(),
+ CompilerPrefixTable[CompilerTypeCC],
+ pchPathStr.c_str() );
- string globalCflags = "";
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
- globalCflags += " $(PROJECT_CFLAGS)";
- else
- globalCflags += " -Wall -Wpointer-arith -D__REACTOS__";
- globalCflags += " -g";
- if ( backend->usePipe )
- globalCflags += " -pipe";
- if ( !module.allowWarnings )
- globalCflags += " -Werror";
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
- {
- if ( module.cplusplus )
- globalCflags += " $(HOST_CPPFLAGS)";
- else
- globalCflags += " -Wno-strict-aliasing $(HOST_CFLAGS)";
- }
- else
- {
- if ( module.cplusplus )
- {
- // HACK: use host headers when building C++
- globalCflags += " $(HOST_CPPFLAGS)";
- }
- else
- globalCflags += " -nostdinc";
+ fprintf ( fMakefile,
+ "%s_%sINCLUDES+= -I%s\n",
+ module.name.c_str(),
+ CompilerPrefixTable[CompilerTypeCXX],
+ pchPathStr.c_str() );
}
- // Always force disabling of sibling calls optimisation for GCC
- // (TODO: Move to version-specific once this bug is fixed in GCC)
- globalCflags += " -fno-optimize-sibling-calls";
+ const char * toolPrefix = "";
- fprintf (
- fMakefile,
- "%s +=%s\n",
- cflagsMacro.c_str (),
- globalCflags.c_str () );
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
+ toolPrefix = "HOST_";
- if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
+ // FIXME: this is very ugly and generates lots of useless entries
+ for ( unsigned type = CompilerTypeCC; type < CompilerTypesCount; ++ type )
{
- fprintf (
- fMakefile,
- "%s += $(PROJECT_RCFLAGS)\n",
- windresflagsMacro.c_str () );
+ string flags;
- fprintf (
- fMakefile,
- "%s += $(PROJECT_WIDLFLAGS) -I%s\n",
- widlflagsMacro.c_str (),
- module.output->relative_path.c_str () );
+ if ( module.dynamicCRT )
+ flags += ssprintf ( " $(%s%sFLAG_CRTDLL)", toolPrefix, CompilerPrefixTable[type] );
- fprintf (
- fMakefile,
- "%s_LFLAGS := $(PROJECT_LFLAGS) -g $(%s_LFLAGS)\n",
- module.name.c_str (),
- module.name.c_str () );
- }
- else
- {
- fprintf (
- fMakefile,
- "%s_LFLAGS += $(HOST_LFLAGS)\n",
- module.name.c_str () );
- }
+ // FIXME: this duplicates the flag for CPP and C/CXX
+ if ( !module.allowWarnings )
+ flags += ssprintf ( " $(%s%sFLAG_WERROR)", toolPrefix, CompilerPrefixTable[type] );
- fprintf (
- fMakefile,
- "%s += $(%s)\n",
- linkDepsMacro.c_str (),
- libsMacro.c_str () );
+ if ( module.isUnicode )
+ flags += ssprintf ( " $(%s%sFLAG_UNICODE)", toolPrefix, CompilerPrefixTable[type] );
- const char *cflags = ModuleHandlerInformations[module.type].cflags;
- if ( strlen( cflags ) > 0 )
- {
- fprintf ( fMakefile,
- "%s += %s\n\n",
- cflagsMacro.c_str (),
- cflags );
+ if ( flags.size() )
+ {
+ fprintf ( fMakefile,
+ "%s_%sFLAGS+=%s\n",
+ module.name.c_str(),
+ CompilerPrefixTable[type],
+ flags.c_str() );
+ }
}
- const char* nasmflags = ModuleHandlerInformations[module.type].nasmflags;
- if ( strlen( nasmflags ) > 0 )
- {
- fprintf ( fMakefile,
- "%s += %s\n\n",
- nasmflagsMacro.c_str (),
- nasmflags );
- }
+ GenerateParameters ( module.name.c_str(), "+=", module.non_if_data );
const char *linkerflags = ModuleHandlerInformations[module.type].linkerflags;
if ( strlen( linkerflags ) > 0 )
linkerflags );
}
- if ( IsStaticLibrary ( module ) && module.isStartupLib )
+ // FIXME: make rules for linker, move standard flags there
+ if ( ModuleHandlerInformations[module.type].DefaultHost == HostFalse )
{
- fprintf ( fMakefile,
- "%s += -Wno-main\n\n",
- cflagsMacro.c_str () );
+ if ( module.cplusplus )
+ fprintf ( fMakefile,
+ "%s+= $(PROJECT_LPPFLAGS)\n\n",
+ linkerflagsMacro.c_str () );
+ else
+ fprintf ( fMakefile,
+ "%s+= $(PROJECT_LFLAGS)\n\n",
+ linkerflagsMacro.c_str () );
}
- fprintf ( fMakefile, "\n\n" );
+ GenerateMacros (
+ "+=",
+ module.non_if_data,
+ &module.linkerFlags,
+ used_defs );
- // future references to the macros will be to get their values
- cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ());
- nasmflagsMacro = ssprintf ("$(%s)", nasmflagsMacro.c_str ());
- widlflagsMacro = ssprintf ("$(%s)", widlflagsMacro.c_str ());
+ fprintf ( fMakefile, "\n\n" );
}
void
MingwModuleHandler::GenerateRules ()
{
+ SpecFileType spec;
+
+ fprintf ( fMakefile, "# RULES\n" );
string targetMacro = GetTargetMacro ( module );
//CLEAN_FILE ( targetMacro );
CLEAN_FILE ( FileLocation ( SourceDirectory, "", targetMacro ) );
delete ar_target;
}
+
+ spec = IsSpecDefinitionFile();
+
+ if(spec)
+ {
+ Rule * defRule;
+
+ if (spec == PSpec)
+ defRule = &winebuildPRule;
+ else
+ defRule = &winebuildRule;
+
+ defRule->Execute ( fMakefile, backend, module, module.importLibrary->source, clean_files );
+ }
+
GenerateObjectFileTargets ();
}
if ( module.invocations.size () == 0 )
return;
+ fprintf ( fMakefile, "# INVOCATIONS\n" );
+
size_t iend = module.invocations.size ();
for ( size_t i = 0; i < iend; i++ )
{
if ( ModuleHandlerInformations[module.type].DefaultHost == HostTrue )
return;
- if (module.name != "psdk" &&
+ if (module.name != "psdk" &&
module.name != "dxsdk")
{
dependencies.push_back ( "$(PSDK_TARGET) $(psdk_HEADERS)" );
dependencies.push_back ( "$(DXSDK_TARGET) $(dxsdk_HEADERS)" );
}
- if (module.name != "errcodes" &&
+ if (module.name != "errcodes" &&
module.name != "bugcodes" &&
module.name != "ntstatus")
{
void
MingwModuleHandler::GeneratePreconditionDependencies ()
{
+ fprintf ( fMakefile, "# PRECONDITION DEPENDENCIES\n" );
string preconditionDependenciesName = GetPreconditionDependenciesName ();
string_list dependencies;
GetDefaultDependencies ( dependencies );
fprintf ( fMakefile, "\n" );
}
-bool
-MingwModuleHandler::IsWineModule () const
+SpecFileType
+MingwModuleHandler::IsSpecDefinitionFile () const
{
- if ( module.importLibrary == NULL)
- return false;
+ if(!module.importLibrary)
+ return None;
+
+ std::string ext = GetExtension ( *module.importLibrary->source );
+
+ if ( ext == ".spec" )
+ return Spec;
+
+ if ( ext == ".pspec" )
+ return PSpec;
- size_t index = module.importLibrary->source->name.rfind ( ".spec.def" );
- return ( index != string::npos );
+ return None;
}
/* caller needs to delete the returned object */
if ( module.importLibrary == NULL )
return NULL;
- DirectoryLocation directory;
- if ( IsWineModule () )
- directory = IntermediateDirectory;
+ if ( IsSpecDefinitionFile () )
+ {
+ return new FileLocation ( IntermediateDirectory,
+ module.importLibrary->source->relative_path,
+ GetBasename ( module.importLibrary->source->name ) + "_" + module.name + ".auto.def" );
+ }
else
- directory = SourceDirectory;
-
- return new FileLocation ( directory,
- module.importLibrary->source->relative_path,
- module.importLibrary->source->name );
+ {
+ return new FileLocation ( SourceDirectory,
+ module.importLibrary->source->relative_path,
+ module.importLibrary->source->name );
+ }
}
void
-MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
+MingwModuleHandler::GenerateImportLibraryTarget (
+ const FileLocation *defFilename,
+ const FileLocation *library_target,
+ bool delayimp)
{
- if ( module.importLibrary != NULL )
- {
- const FileLocation *library_target = GetImportLibraryFilename ( module, &clean_files );
- const FileLocation *defFilename = GetDefinitionFilename ();
- string empty = "tools" + sSep + "rbuild" + sSep + "empty.def";
+ string empty = "tools" + sSep + "rbuild" + sSep + "empty.def";
- vector<FileLocation> deps;
- GetDefinitionDependencies ( deps );
+ fprintf ( fMakefile, "# IMPORT LIBRARY RULE\n" );
- fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );
+ fprintf ( fMakefile, "%s:",
+ backend->GetFullName ( *library_target ).c_str () );
- fprintf ( fMakefile, "%s:",
- backend->GetFullName ( *library_target ).c_str () );
+ if ( defFilename )
+ {
+ fprintf ( fMakefile, " %s",
+ backend->GetFullName ( *defFilename ).c_str () );
+ }
- if ( defFilename )
- {
- fprintf ( fMakefile, " %s",
- backend->GetFullName ( *defFilename ).c_str () );
- }
+ fprintf ( fMakefile, " | %s\n",
+ backend->GetFullPath ( *library_target ).c_str () );
- size_t i, iend = deps.size();
- for ( i = 0; i < iend; i++ )
- fprintf ( fMakefile, " %s",
- backend->GetFullName ( deps[i] ).c_str () );
+ fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
- fprintf ( fMakefile, " | %s\n",
- backend->GetFullPath ( *library_target ).c_str () );
+ fprintf ( fMakefile,
+ "\t${dlltool} --dllname %s --def %s %s %s%s%s\n\n",
+ module.GetDllName ().c_str (),
+ defFilename ? backend->GetFullName ( *defFilename ).c_str ()
+ : empty.c_str (),
+ delayimp ? "--output-delaylib" : "--output-lib",
+ backend->GetFullName ( *library_target ).c_str (),
+ module.mangledSymbols ? "" : " --kill-at",
+ module.underscoreSymbols ? " --add-underscore" : "" );
+}
- fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );
+void
+MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()
+{
+ if ( module.importLibrary != NULL )
+ {
+ const FileLocation *library_target = GetImportLibraryFilename ( module, &clean_files, false );
+ const FileLocation *delayimp_target = GetImportLibraryFilename ( module, &clean_files, true );
+ const FileLocation *defFilename = GetDefinitionFilename ();
- fprintf ( fMakefile,
- "\t${dlltool} --dllname %s --def %s --output-lib %s%s%s\n\n",
- module.output->name.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" : "" );
+ GenerateImportLibraryTarget(defFilename, library_target, false);
+ GenerateImportLibraryTarget(defFilename, delayimp_target, true);
if ( defFilename )
delete defFilename;
delete library_target;
+ delete delayimp_target;
+
}
}
vector<FileLocation>& dependencies,
const FileLocation *file ) const
{
- string basename = GetBasename ( file->name );
-
- FileLocation defDependency ( IntermediateDirectory,
- file->relative_path,
- basename + ".spec.def" );
- dependencies.push_back ( defDependency );
-
- FileLocation stubsDependency ( IntermediateDirectory,
- file->relative_path,
- basename + ".stubs.c" );
- dependencies.push_back ( stubsDependency );
+ dependencies.push_back ( FileLocation ( IntermediateDirectory,
+ file->relative_path,
+ GetBasename ( file->name ) + "_" + module.name + ".stubs.c" ) );
}
void
const CompilationUnit& compilationUnit = *compilationUnits[i];
const FileLocation& sourceFile = compilationUnit.GetFilename ();
string extension = GetExtension ( sourceFile );
- if ( extension == ".spec" || extension == ".SPEC" )
+
+ if (extension == ".spec" || extension == ".pspec")
GetSpecObjectDependencies ( dependencies, &sourceFile );
- if ( extension == ".idl" || extension == ".IDL" )
+
+ if (extension == ".idl")
{
if ( ( module.type == RpcServer ) || ( module.type == RpcClient ) || ( module.type == RpcProxy ) )
GetWidlObjectDependencies ( dependencies, &sourceFile );
module.non_if_data.libraries.push_back(pLibrary);
}
+static void
+MingwAddCRTLibrary( Module &module )
+{
+ const char * crtAttr = module.CRT.c_str ();
+ const char * crtLib = NULL;
+
+ if ( stricmp ( crtAttr, "libc" ) == 0 )
+ crtLib = "crt";
+ else if ( stricmp ( crtAttr, "msvcrt" ) == 0 )
+ crtLib = "msvcrt";
+ else if ( stricmp ( crtAttr, "libcntpr" ) == 0 )
+ crtLib = "libcntpr";
+ else if ( stricmp ( crtAttr, "ntdll" ) == 0 )
+ crtLib = "ntdll";
+
+ if ( crtLib )
+ {
+ Library* pLibrary = new Library ( module, std::string ( crtLib ) );
+
+ if ( pLibrary->importedModule == NULL)
+ {
+ throw XMLInvalidBuildFileException (
+ module.node.location,
+ "module '%s' trying to import non-existant C runtime module '%s'",
+ module.name.c_str(),
+ crtLib );
+ }
+
+ module.non_if_data.libraries.push_back ( pLibrary );
+ }
+}
+
MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ )
: MingwModuleHandler ( module_ )
{
{
string targetMacro ( GetTargetMacro (module) );
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
string libsMacro = GetLibsMacro ();
GenerateRules ();
+ fprintf ( fMakefile, "# BUILD TOOL MODULE TARGET\n" );
+
string linker;
if ( module.cplusplus )
linker = "${host_gpp}";
fprintf ( fMakefile, "%s: %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
- fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
+ fprintf ( fMakefile, "\t$(ECHO_HOSTLD)\n" );
fprintf ( fMakefile,
"\t%s %s -o $@ %s %s\n\n",
linker.c_str (),
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
void
MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module )
{
+ MingwAddCRTLibrary ( module );
MingwAddDebugSupportLibraries ( module, DebugKernelMode );
}
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ();
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
void
MingwNativeDLLModuleHandler::AddImplicitLibraries ( Module& module )
{
+ MingwAddCRTLibrary ( module );
MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
void
MingwNativeCUIModuleHandler::AddImplicitLibraries ( Module& module )
{
+ MingwAddCRTLibrary ( module );
MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=native -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
}
-static bool
-LinksToCrt( Module &module )
-{
- for ( size_t i = 0; i < module.non_if_data.libraries.size (); i++ )
- {
- Library& library = *module.non_if_data.libraries[i];
- if ( library.name == "libcntpr" || library.name == "crt" )
- return true;
- }
- return false;
-}
-
static void
MingwAddImplicitLibraries( Module &module )
{
Library* pLibrary;
- bool links_to_crt;
if ( module.type != Win32DLL
&& module.type != Win32OCX
&& module.type != Win32GUI
&& module.type != Win32SCR)
{
- // no implicit libraries
return;
}
- links_to_crt = LinksToCrt ( module );
-
- if ( !module.isDefaultEntryPoint )
+ if ( module.isDefaultEntryPoint )
{
- if ( module.GetEntryPoint(false) == "0" )
+ if ( module.IsDLL () )
{
- if ( !links_to_crt )
- {
- pLibrary = new Library ( module, "mingw_common" );
- module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin() , pLibrary );
-
- pLibrary = new Library ( module, "msvcrt" );
- module.non_if_data.libraries.push_back ( pLibrary );
- links_to_crt = true;
- }
+ //pLibrary = new Library ( module, "__mingw_dllmain" );
+ //module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
+ }
+ else
+ {
+ pLibrary = new Library ( module, module.isUnicode ? "mingw_wmain" : "mingw_main" );
+ module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
}
- pLibrary = new Library ( module, "debugsup_ntdll" );
- module.non_if_data.libraries.push_back(pLibrary);
- return;
- }
-
- if ( module.IsDLL () )
- {
- //pLibrary = new Library ( module, "__mingw_dllmain" );
- //module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
- }
- else
- {
- pLibrary = new Library ( module, module.isUnicode ? "mingw_wmain" : "mingw_main" );
- module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin(), pLibrary );
}
pLibrary = new Library ( module, "mingw_common" );
- module.non_if_data.libraries.insert ( module.non_if_data.libraries.begin() + 1, pLibrary );
+ module.non_if_data.libraries.push_back ( pLibrary );
- if ( !links_to_crt )
- {
- // always link in msvcrt to get the basic routines
- pLibrary = new Library ( module, "msvcrt" );
- module.non_if_data.libraries.push_back ( pLibrary );
- }
-
- pLibrary = new Library ( module, "debugsup_ntdll" );
- module.non_if_data.libraries.push_back(pLibrary);
+ MingwAddCRTLibrary ( module );
+ MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
void
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000 -shared",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
{
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=windows -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
void
MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()
{
+ fprintf ( fMakefile, "# BOOT LOADER MODULE TARGET\n" );
string targetName ( module.output->name );
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ();
module.name + ".junk.tmp" );
CLEAN_FILE ( junk_tmp );
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
string libsMacro = GetLibsMacro ();
GenerateRules ();
fprintf ( fMakefile, "%s: %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );
if (Environment::GetArch() == "arm")
{
fprintf ( fMakefile,
- "\t${gcc} -Wl,--subsystem,native -Wl,--section-start,startup=0x8000 -o %s %s %s %s\n",
+ "\t${gcc} -Wl,--subsystem,native -o %s %s %s %s\n",
backend->GetFullName ( junk_tmp ).c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
GetLinkerMacro ().c_str ());
}
else
"\t${gcc} -Wl,--subsystem,native -Wl,-Ttext,0x8000 -o %s %s %s %s\n",
backend->GetFullName ( junk_tmp ).c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
GetLinkerMacro ().c_str ());
}
fprintf ( fMakefile,
void
MingwBootProgramModuleHandler::GenerateBootProgramModuleTarget ()
{
+ fprintf ( fMakefile, "# BOOT PROGRAM MODULE TARGET\n" );
+
string targetName ( module.output->name );
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ();
CLEAN_FILE ( junk_elf );
CLEAN_FILE ( junk_cpy );
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
string libsMacro = GetLibsMacro ();
const Module *payload = module.project.LocateModule ( module.payload );
fprintf ( fMakefile, "%s: %s %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
payload->name.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
backend->GetFullName ( junk_cpy ).c_str (),
backend->GetFullName ( junk_tmp ).c_str () );
- fprintf ( fMakefile, "\t${ld} $(%s_LINKFORMAT) %s %s -g -o %s\n",
+ fprintf ( fMakefile, "\t${ld} $(%s_LINKFORMAT) %s %s -o %s\n",
module.buildtype.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullName ( junk_tmp ).c_str (),
backend->GetFullName ( junk_elf ).c_str () );
void
MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (
- const string& bootcdDirectory )
+ const string& bootcdDirectory,
+ vector<FileLocation>& destinations )
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL )
? bootcdDirectory + sSep + m.bootstrap->base
: bootcdDirectory,
m.bootstrap->nameoncd );
- OutputCopyCommand ( *m.output, targetFile );
+ OutputCopyCommandSingle ( *m.output, targetFile );
+ destinations.push_back ( targetFile );
}
}
}
void
MingwIsoModuleHandler::OutputCdfileCopyCommands (
- const string& bootcdDirectory )
+ const string& bootcdDirectory,
+ std::vector<FileLocation>& destinations )
{
for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )
{
? bootcdDirectory + sSep + cdfile.target->relative_path
: bootcdDirectory,
cdfile.target->name );
- OutputCopyCommand ( *cdfile.source, targetFile );
+ OutputCopyCommandSingle ( *cdfile.source, targetFile );
+ destinations.push_back ( targetFile );
+ }
+ for ( size_t i = 0; i < module.cdfiles.size (); i++ )
+ {
+ const CDFile& cdfile = *module.cdfiles[i];
+ FileLocation targetFile ( OutputDirectory,
+ cdfile.target->relative_path.length () > 0
+ ? bootcdDirectory + sSep + cdfile.target->relative_path
+ : bootcdDirectory,
+ cdfile.target->name );
+ OutputCopyCommandSingle ( *cdfile.source, targetFile );
+ destinations.push_back ( targetFile );
}
}
MingwIsoModuleHandler::GetBootstrapCdDirectories ( vector<FileLocation>& out,
const string& bootcdDirectory )
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL )
MingwIsoModuleHandler::GetBootstrapCdFiles (
vector<FileLocation>& out ) const
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.bootstrap != NULL )
void
MingwIsoModuleHandler::GenerateIsoModuleTarget ()
{
- string bootcdDirectory = "cd";
+ fprintf ( fMakefile, "# ISO MODULE TARGET\n" );
+ string bootcdDirectory = module.name;
FileLocation bootcd ( OutputDirectory,
bootcdDirectory,
"" );
FileLocation bootcdReactos ( OutputDirectory,
bootcdDirectory + sSep + Environment::GetCdOutputPath (),
"" );
- vector<FileLocation> vSourceFiles, vCdFiles;
- vector<FileLocation> vCdDirectories;
-
- // unattend.inf
- FileLocation srcunattend ( SourceDirectory,
- "boot" + sSep + "bootdata" + sSep + "bootcdregtest",
- "unattend.inf" );
- FileLocation tarunattend ( bootcdReactos.directory,
- bootcdReactos.relative_path,
- "unattend.inf" );
- if (module.type == IsoRegTest)
- vSourceFiles.push_back ( srcunattend );
// bootsector
const Module* bootModule = module.bootSector->bootSectorModule;
}
const FileLocation *isoboot = bootModule->output;
- vSourceFiles.push_back ( *isoboot );
// prepare reactos.dff and reactos.inf
FileLocation reactosDff ( SourceDirectory,
bootcdReactos.relative_path,
"reactos.inf" );
- vSourceFiles.push_back ( reactosDff );
-
- /*
+ /*
We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule.
- Iso/LiveIso outputs are generated in code base root
+ Iso/LiveIso outputs are generated in code base root
*/
string IsoName = module.output->name;
- string sourceFiles = v2s ( backend, vSourceFiles, 5 );
-
- // fill cdrom
- GetCdDirectories ( vCdDirectories, bootcdDirectory );
- GetCdFiles ( vCdFiles );
- string cdDirectories = "";//v2s ( vCdDirectories, 5 );
- string cdFiles = v2s ( backend, vCdFiles, 5 );
-
- fprintf ( fMakefile, ".PHONY: %s\n\n",
- module.name.c_str ());
- fprintf ( fMakefile,
- "%s: all %s %s %s $(CABMAN_TARGET) $(CDMAKE_TARGET) %s\n",
+ fprintf ( fMakefile, ".PHONY: %s_CABINET\n\n",
+ module.name.c_str () );
+ fprintf ( fMakefile, "%s_CABINET: all $(CABMAN_TARGET) %s | %s\n",
module.name.c_str (),
- backend->GetFullName ( *isoboot ).c_str (),
- sourceFiles.c_str (),
- cdFiles.c_str (),
- cdDirectories.c_str () );
+ backend->GetFullName ( reactosDff ).c_str (),
+ backend->GetFullPath ( bootcdReactos ).c_str () );
fprintf ( fMakefile,
"\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I -P $(OUTPUT)\n",
backend->GetFullName ( reactosDff ).c_str (),
backend->GetFullName ( reactosInf ).c_str (),
backend->GetFullPath ( bootcdReactos ).c_str ());
fprintf ( fMakefile,
- "\t-@${rm} %s 2>$(NUL)\n",
+ "\t-@${rm} %s 2>$(NUL)\n\n",
backend->GetFullName ( reactosInf ).c_str () );
- OutputBootstrapfileCopyCommands ( bootcdDirectory );
- OutputCdfileCopyCommands ( bootcdDirectory );
- if (module.type == IsoRegTest)
- OutputCopyCommand ( srcunattend, tarunattend );
+ std::vector<FileLocation> sourceFiles;
+ OutputBootstrapfileCopyCommands ( bootcdDirectory, sourceFiles );
+ OutputCdfileCopyCommands ( bootcdDirectory, sourceFiles );
+
+ fprintf( fMakefile,
+ "\n%s_OBJS := %s\n\n",
+ module.name.c_str (),
+ v2s ( backend, sourceFiles, 5 ).c_str () );
+
+ fprintf ( fMakefile, ".PHONY: %s\n\n",
+ module.name.c_str ());
+ fprintf ( fMakefile,
+ "%s: $(%s_OBJS) %s_CABINET %s $(CDMAKE_TARGET) | %s\n",
+ module.name.c_str (),
+ module.name.c_str (),
+ module.name.c_str (),
+ backend->GetFullName ( *isoboot ).c_str (),
+ backend->GetFullPath ( FileLocation ( OutputDirectory,
+ bootcdDirectory,
+ "" ) ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" );
fprintf ( fMakefile,
void
MingwLiveIsoModuleHandler::OutputModuleCopyCommands ( string& livecdDirectory,
- string& reactosDirectory )
+ string& reactosDirectory,
+ std::vector<FileLocation>& destinations )
{
- for ( size_t i = 0; i < module.project.modules.size (); i++ )
+ for ( std::map<std::string, Module*>::const_iterator p = module.project.modules.begin (); p != module.project.modules.end (); ++ p )
{
- const Module& m = *module.project.modules[i];
+ const Module& m = *p->second;
if ( !m.enabled )
continue;
if ( m.install )
? livecdDirectory + sSep + reactosDirectory + sSep + m.install->relative_path
: livecdDirectory + sSep + reactosDirectory,
m.install->name );
- OutputCopyCommand ( *aliasedModule.output,
- destination);
+ OutputCopyCommandSingle ( *aliasedModule.output,
+ destination);
+ destinations.push_back ( destination );
}
}
}
void
MingwLiveIsoModuleHandler::OutputNonModuleCopyCommands ( string& livecdDirectory,
- string& reactosDirectory )
+ string& reactosDirectory,
+ std::vector<FileLocation>& destinations )
{
for ( size_t i = 0; i < module.project.installfiles.size (); i++ )
{
? livecdDirectory + sSep + reactosDirectory + sSep + installfile.target->relative_path
: livecdDirectory + sSep + reactosDirectory,
installfile.target->name );
- OutputCopyCommand ( *installfile.source, target );
+ OutputCopyCommandSingle ( *installfile.source, target );
+ destinations.push_back ( target );
}
}
void
-MingwLiveIsoModuleHandler::OutputProfilesDirectoryCommands ( string& livecdDirectory )
+MingwLiveIsoModuleHandler::OutputProfilesDirectoryCommands ( string& livecdDirectory,
+ vector<FileLocation>& destinations )
{
CreateDirectory ( livecdDirectory + sSep + "Profiles" );
CreateDirectory ( livecdDirectory + sSep + "Profiles" + sSep + "All Users") ;
FileLocation destination ( OutputDirectory,
livecdDirectory,
"freeldr.ini" );
- OutputCopyCommand ( livecdIni,
- destination );
+ OutputCopyCommandSingle ( livecdIni,
+ destination );
+ destinations.push_back ( destination );
}
void
-MingwLiveIsoModuleHandler::OutputLoaderCommands ( string& livecdDirectory )
+MingwLiveIsoModuleHandler::OutputLoaderCommands ( string& livecdDirectory,
+ std::vector<FileLocation>& destinations )
{
FileLocation freeldr ( OutputDirectory,
"boot" + sSep + "freeldr" + sSep + "freeldr",
FileLocation destination ( OutputDirectory,
livecdDirectory + sSep + "loader",
"setupldr.sys" );
- OutputCopyCommand ( freeldr,
- destination );
+ OutputCopyCommandSingle ( freeldr,
+ destination );
+ destinations.push_back ( destination );
}
void
MingwLiveIsoModuleHandler::OutputRegistryCommands ( string& livecdDirectory )
{
+ fprintf ( fMakefile, "# REGISTRY COMMANDS\n" );
FileLocation reactosSystem32ConfigDirectory ( OutputDirectory,
livecdDirectory + sSep + "reactos" + sSep + "system32" + sSep + "config",
"" );
void
MingwLiveIsoModuleHandler::GenerateLiveIsoModuleTarget ()
{
+ fprintf ( fMakefile, "# LIVE ISO MODULE TARGET\n" );
string livecdDirectory = module.name;
FileLocation livecd ( OutputDirectory, livecdDirectory, "" );
const FileLocation *isoboot = bootModule->output;
- /*
+ /*
We use only the name and not full FileLocation(ouput) because Iso/LiveIso are an exception to the general rule.
- Iso/LiveIso outputs are generated in code base root
+ Iso/LiveIso outputs are generated in code base root
*/
IsoName = module.output->name;
"" );
CLEAN_FILE ( livecdReactos );
+ std::vector<FileLocation> sourceFiles;
+ OutputModuleCopyCommands ( livecdDirectory,
+ reactosDirectory,
+ sourceFiles );
+ OutputNonModuleCopyCommands ( livecdDirectory,
+ reactosDirectory,
+ sourceFiles );
+ OutputProfilesDirectoryCommands ( livecdDirectory, sourceFiles );
+ OutputLoaderCommands ( livecdDirectory, sourceFiles );
+
+ fprintf( fMakefile,
+ "\n%s_OBJS := %s\n\n",
+ module.name.c_str (),
+ v2s ( backend, sourceFiles, 5 ).c_str () );
+
fprintf ( fMakefile, ".PHONY: %s\n\n",
module.name.c_str ());
fprintf ( fMakefile,
- "%s: all %s %s $(MKHIVE_TARGET) $(CDMAKE_TARGET)\n",
+ "%s : $(%s_OBJS) %s %s $(MKHIVE_TARGET) $(CDMAKE_TARGET)\n",
+ module.name.c_str (),
module.name.c_str (),
backend->GetFullName ( *isoboot) .c_str (),
- backend->GetFullPath ( livecdReactos ).c_str () );
- OutputModuleCopyCommands ( livecdDirectory,
- reactosDirectory );
- OutputNonModuleCopyCommands ( livecdDirectory,
- reactosDirectory );
- OutputProfilesDirectoryCommands ( livecdDirectory );
- OutputLoaderCommands ( livecdDirectory );
+ backend->GetFullPath ( FileLocation ( OutputDirectory,
+ livecdDirectory,
+ "" ) ).c_str () );
OutputRegistryCommands ( livecdDirectory );
fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" );
fprintf ( fMakefile,
{
string targetMacro ( GetTargetMacro ( module ) );
string workingDirectory = GetWorkingDirectory ( );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
+ string libsMacro = GetLibsMacro ();
GenerateImportLibraryTargetIfNeeded ();
{
GenerateRules ();
- string dependencies = linkDepsMacro + " " + objectsMacro;
+ string dependencies = libsMacro + " " + objectsMacro;
string linkerParameters = ssprintf ( "-subsystem=console -entry=%s -image-base=%s -file-alignment=0x1000 -section-alignment=0x1000",
module.GetEntryPoint(!(Environment::GetArch() == "arm")).c_str (),
void
MingwCabinetModuleHandler::Process ()
{
+ fprintf ( fMakefile, "# CABINET MODULE TARGET\n" );
string targetMacro ( GetTargetMacro (module) );
GenerateRules ();
-
+
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: $(CABMAN_TARGET) | %s\n",
targetMacro.c_str (),
string targetMacro ( GetTargetMacro (module) );
string workingDirectory = GetWorkingDirectory ();
string objectsMacro = GetObjectsMacro ( module );
- string linkDepsMacro = GetLinkingDependenciesMacro ();
string libsMacro = GetLibsMacro ();
+ string debugFormat = GetDebugFormat ();
+ fprintf ( fMakefile, "# ELF EXECUTABLE TARGET\n" );
GenerateRules ();
const FileLocation *target_file = GetTargetFilename ( module, NULL );
fprintf ( fMakefile, "%s: %s %s | %s\n",
targetMacro.c_str (),
objectsMacro.c_str (),
- linkDepsMacro.c_str (),
+ libsMacro.c_str (),
backend->GetFullPath ( *target_file ).c_str () );
fprintf ( fMakefile, "\t$(ECHO_BOOTPROG)\n" );
- fprintf ( fMakefile, "\t${gcc} $(%s_LINKFORMAT) %s %s -g -o %s\n",
+ fprintf ( fMakefile, "\t${gcc} $(%s_LINKFORMAT) %s %s -g%s -o %s\n",
module.buildtype.c_str(),
objectsMacro.c_str(),
libsMacro.c_str(),
+ debugFormat.c_str(),
targetMacro.c_str () );
delete target_file;
+ fprintf ( fMakefile, "#/ELF EXECUTABLE TARGET\n" );
}