return out;\r
}\r
\r
+string v2s ( const vector<string>& v, int wrap_at )\r
+{\r
+ if ( !v.size() )\r
+ return "";\r
+ string s;\r
+ int wrap_count = 0;\r
+ for ( size_t i = 0; i < v.size(); i++ )\r
+ {\r
+ if ( !v[i].size() )\r
+ continue;\r
+ if ( wrap_at > 0 && wrap_count++ == wrap_at )\r
+ s += " \\\n\t\t";\r
+ else if ( s.size() )\r
+ s += " ";\r
+ s += v[i];\r
+ }\r
+ return s;\r
+}\r
\r
MingwModuleHandler::MingwModuleHandler ( ModuleType moduletype )\r
{\r
void\r
MingwModuleHandler::GenerateLinkerCommand (\r
const Module& module,\r
+ const string& target,\r
+ const string& dependencies,\r
const string& linker,\r
const string& linkerParameters,\r
const string& objectsMacro,\r
const string& libsMacro,\r
string_list& clean_files ) const\r
{\r
+ fprintf ( fMakefile,\r
+ "%s: %s ${RSYM_TARGET}\n",\r
+ target.c_str (),\r
+ dependencies.c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
string targetName ( module.GetTargetName () );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
if ( module.importLibrary != NULL )\r
{\r
static string ros_junk ( "$(ROS_TEMPORARY)" );\r
const string* nasmflags,\r
string_list& clean_files ) const\r
{\r
- string cc = ( module.host ? "${host_gcc}" : "${gcc}" );\r
- string cppc = ( module.host ? "${host_gpp}" : "${gpp}" );\r
- string ar = ( module.host ? "${host_ar}" : "${ar}" );\r
+ string cc = ( module.host == HostTrue ? "${host_gcc}" : "${gcc}" );\r
+ string cppc = ( module.host == HostTrue ? "${host_gpp}" : "${gpp}" );\r
+ string ar = ( module.host == HostTrue ? "${host_ar}" : "${ar}" );\r
\r
string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());\r
string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());\r
string\r
MingwModuleHandler::GetPreconditionDependenciesName ( const Module& module ) const\r
{\r
- return ssprintf ( "%s_precondition",\r
- module.name.c_str () );\r
+ return module.name + "_precondition";\r
}\r
\r
string\r
|| module.name == "hostzlib" )\r
return "$(ROS_INTERMEDIATE)." SSEP "tools $(ROS_INTERMEDIATE)." SSEP "lib" SSEP "zlib";\r
else\r
- return "init";\r
+ return "$(INIT)";\r
}\r
\r
void\r
}\r
\r
fprintf ( fMakefile,\r
- ".PHONY: %s\n\n",\r
- preconditionDependenciesName.c_str () );\r
- fprintf ( fMakefile,\r
- "%s: %s\n\n",\r
+ "%s = %s\n\n",\r
preconditionDependenciesName.c_str (),\r
dependencies.c_str () );\r
const char* p = sourceFilenames.c_str();\r
p2 = end;\r
}\r
fprintf ( fMakefile,\r
- "%.*s: %s\n",\r
+ "%.*s: ${%s}\n",\r
p2-p,\r
p,\r
preconditionDependenciesName.c_str ());\r
\r
GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
+ fprintf ( fMakefile, "%s: %s %s ${RSYM_TARGET}\n",\r
target.c_str (),\r
objectsMacro.c_str (),\r
linkDepsMacro.c_str () );\r
{\r
GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
- objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ string dependencies =\r
+ objectsMacro + " " + linkDepsMacro;\r
\r
string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
GenerateLinkerCommand ( module,\r
+ target,\r
+ dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
NULL,\r
clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
- objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ string dependencies =\r
+ objectsMacro + " " + linkDepsMacro;\r
\r
string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
GenerateLinkerCommand ( module,\r
+ target,\r
+ dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
{\r
GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
- objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ string dependencies =\r
+ objectsMacro + " " + linkDepsMacro;\r
\r
string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib -mdll",\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
GenerateLinkerCommand ( module,\r
+ target,\r
+ dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
NULL,\r
clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
- objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ string dependencies =\r
+ objectsMacro + " " + linkDepsMacro;\r
\r
string linkerParameters = ssprintf ( "-Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -nostdlib",\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
GenerateLinkerCommand ( module,\r
+ target,\r
+ dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
{\r
GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
- objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ string dependencies =\r
+ objectsMacro + " " + linkDepsMacro;\r
\r
string linker;\r
if ( module.cplusplus )\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
GenerateLinkerCommand ( module,\r
+ target,\r
+ dependencies,\r
linker,\r
linkerParameters,\r
objectsMacro,\r
{\r
GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
- objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ string dependencies =\r
+ objectsMacro + " " + linkDepsMacro;\r
\r
string linker;\r
if ( module.cplusplus )\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
GenerateLinkerCommand ( module,\r
+ target,\r
+ dependencies,\r
linker,\r
linkerParameters,\r
objectsMacro,\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
- objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ string dependencies =\r
+ objectsMacro + " " + linkDepsMacro;\r
\r
string linker;\r
if ( module.cplusplus )\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
GenerateLinkerCommand ( module,\r
+ target,\r
+ dependencies,\r
linker,\r
linkerParameters,\r
objectsMacro,\r
}\r
\r
void\r
-MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( const string bootcdDirectory,\r
- const Module& module ) const\r
+MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( const string& bootcdDirectory,\r
+ const Module& module ) const\r
{\r
for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
{\r
}\r
\r
void\r
-MingwIsoModuleHandler::OutputCdfileCopyCommands ( const string bootcdDirectory,\r
- const Module& module ) const\r
+MingwIsoModuleHandler::OutputCdfileCopyCommands ( const string& bootcdDirectory,\r
+ const Module& module ) const\r
{\r
for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
{\r
}\r
\r
string\r
-MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string bootcdDirectory,\r
- const Module& module ) const\r
+MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string& bootcdDirectory,\r
+ const Module& module ) const\r
{\r
string directories;\r
for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
}\r
\r
string\r
-MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string bootcdDirectory,\r
- const Module& module ) const\r
+MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string& bootcdDirectory,\r
+ const Module& module ) const\r
{\r
string directories;\r
for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
}\r
\r
string\r
-MingwIsoModuleHandler::GetCdDirectories ( const string bootcdDirectory,\r
- const Module& module ) const\r
+MingwIsoModuleHandler::GetCdDirectories ( const string& bootcdDirectory,\r
+ const Module& module ) const\r
{\r
string directories = GetBootstrapCdDirectories ( bootcdDirectory,\r
module );\r
return directories;\r
}\r
\r
-string\r
-MingwIsoModuleHandler::GetBootstrapCdFiles ( const string bootcdDirectory,\r
- const Module& module ) const\r
+void\r
+MingwIsoModuleHandler::GetBootstrapCdFiles (\r
+ vector<string>& out,\r
+ const Module& module ) const\r
{\r
- string cdfiles;\r
for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
{\r
const Module& m = *module.project.modules[i];\r
if ( m.bootstrap != NULL )\r
- {\r
- if ( cdfiles.size () > 0 )\r
- cdfiles += " ";\r
- cdfiles += FixupTargetFilename ( m.GetPath () );\r
- }\r
+ out.push_back ( FixupTargetFilename ( m.GetPath () ) );\r
}\r
- return cdfiles;\r
}\r
\r
-string\r
-MingwIsoModuleHandler::GetNonModuleCdFiles ( const string bootcdDirectory,\r
- const Module& module ) const\r
+void\r
+MingwIsoModuleHandler::GetNonModuleCdFiles (\r
+ vector<string>& out,\r
+ const Module& module ) const\r
{\r
- string cdfiles;\r
for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
{\r
const CDFile& cdfile = *module.project.cdfiles[i];\r
- if ( cdfiles.size () > 0 )\r
- cdfiles += " ";\r
- cdfiles += NormalizeFilename ( cdfile.GetPath () );\r
+ out.push_back ( NormalizeFilename ( cdfile.GetPath () ) );\r
}\r
- return cdfiles;\r
}\r
\r
-string\r
-MingwIsoModuleHandler::GetCdFiles ( const string bootcdDirectory,\r
- const Module& module ) const\r
+void\r
+MingwIsoModuleHandler::GetCdFiles (\r
+ vector<string>& out,\r
+ const Module& module ) const\r
{\r
- string cdfiles = GetBootstrapCdFiles ( bootcdDirectory,\r
- module );\r
- cdfiles += " " + GetNonModuleCdFiles ( bootcdDirectory,\r
- module );\r
- return cdfiles;\r
+ GetBootstrapCdFiles ( out, module );\r
+ GetNonModuleCdFiles ( out, module );\r
}\r
\r
void\r
string reactosDff = NormalizeFilename ( "bootdata/packages/reactos.dff" );\r
string cdDirectories = bootcdReactos + " " + GetCdDirectories ( bootcdDirectory,\r
module );\r
- string cdFiles = GetCdFiles ( bootcdDirectory,\r
- module );\r
+ vector<string> vCdFiles;\r
+ GetCdFiles ( vCdFiles, module );\r
+ string cdFiles = v2s ( vCdFiles, 5 );\r
\r
fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- module.name.c_str ());\r
+ module.name.c_str ());\r
fprintf ( fMakefile,\r
- "%s: all %s %s %s\n",\r
+ "%s: all %s %s %s ${CABMAN_TARGET} ${CDMAKE_TARGET}\n",\r
module.name.c_str (),\r
isoboot.c_str (),\r
cdDirectories.c_str (),\r
std::string GetLibsMacro ( const Module& module ) const;\r
std::string GetLinkerMacro ( const Module& module ) const;\r
void GenerateLinkerCommand ( const Module& module,\r
+ const std::string& target,\r
+ const std::string& dependencies,\r
const std::string& linker,\r
const std::string& linkerParameters,\r
const std::string& objectsMacro,\r
virtual void Process ( const Module& module, string_list& clean_files );\r
private:\r
void GenerateIsoModuleTarget ( const Module& module, string_list& clean_files );\r
- std::string GetBootstrapCdDirectories ( const std::string bootcdDirectory,\r
+ std::string GetBootstrapCdDirectories ( const std::string& bootcdDirectory,\r
const Module& module ) const;\r
- std::string GetNonModuleCdDirectories ( const std::string bootcdDirectory,\r
+ std::string GetNonModuleCdDirectories ( const std::string& bootcdDirectory,\r
const Module& module ) const;\r
- std::string GetCdDirectories ( const std::string bootcdDirectory,\r
+ std::string GetCdDirectories ( const std::string& bootcdDirectory,\r
const Module& module ) const;\r
- std::string GetBootstrapCdFiles ( const std::string bootcdDirectory,\r
- const Module& module ) const;\r
- std::string GetNonModuleCdFiles ( const std::string bootcdDirectory,\r
- const Module& module ) const;\r
- std::string GetCdFiles ( const std::string bootcdDirectory,\r
- const Module& module ) const;\r
- void OutputBootstrapfileCopyCommands ( const std::string bootcdDirectory,\r
+ void GetBootstrapCdFiles ( std::vector<std::string>& out,\r
+ const Module& module ) const;\r
+ void GetNonModuleCdFiles ( std::vector<std::string>& out,\r
+ const Module& module ) const;\r
+ void GetCdFiles ( std::vector<std::string>& out,\r
+ const Module& module ) const;\r
+ void OutputBootstrapfileCopyCommands ( const std::string& bootcdDirectory,\r
const Module& module ) const;\r
- void OutputCdfileCopyCommands ( const std::string bootcdDirectory,\r
+ void OutputCdfileCopyCommands ( const std::string& bootcdDirectory,\r
const Module& module ) const;\r
};\r
\r