\r
#define CLEAN_FILE(f) clean_files.push_back ( f ); /*if ( module.name == "crt" ) printf ( "%s(%i): clean: %s\n", __FILE__, __LINE__, f.c_str() )*/\r
\r
+static string ros_temp = "$(ROS_TEMPORARY)";\r
+MingwBackend*\r
+MingwModuleHandler::backend = NULL;\r
FILE*\r
MingwModuleHandler::fMakefile = NULL;\r
bool\r
MingwModuleHandler::use_pch = false;\r
\r
-string\r
-ReplaceExtension ( const string& filename,\r
- const string& newExtension )\r
-{\r
- size_t index = filename.find_last_of ( '/' );\r
- if ( index == string::npos )\r
- index = 0;\r
- size_t index2 = filename.find_last_of ( '\\' );\r
- if ( index2 != string::npos && index2 > index )\r
- index = index2;\r
- string tmp = filename.substr( index /*, filename.size() - index*/ );\r
- size_t ext_index = tmp.find_last_of( '.' );\r
- if ( ext_index != string::npos )\r
- return filename.substr ( 0, index + ext_index ) + newExtension;\r
- return filename + newExtension;\r
-}\r
-\r
string\r
PrefixFilename (\r
const string& filename,\r
return out;\r
}\r
\r
-string v2s ( const vector<string>& v, int wrap_at )\r
+string\r
+v2s ( const string_list& v, int wrap_at )\r
{\r
if ( !v.size() )\r
return "";\r
return s;\r
}\r
\r
-MingwModuleHandler::MingwModuleHandler ( ModuleType moduletype,\r
- MingwBackend* backend_ )\r
- : backend ( backend_ )\r
+string\r
+GetTargetMacro ( const Module& module, bool with_dollar )\r
+{\r
+ string s ( module.name );\r
+ strupr ( &s[0] );\r
+ s += "_TARGET";\r
+ if ( with_dollar )\r
+ return ssprintf ( "$(%s)", s.c_str() );\r
+ return s;\r
+}\r
+\r
+MingwModuleHandler::MingwModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : module(module_)\r
{\r
}\r
\r
{\r
}\r
\r
-const string &\r
-MingwModuleHandler::PassThruCacheDirectory ( const string &file )\r
+/*static*/ void\r
+MingwModuleHandler::SetBackend ( MingwBackend* backend_ )\r
{\r
- backend->CreateDirectoryTargetIfNotYetCreated ( GetDirectory ( file ) );\r
- return file;\r
+ backend = backend_;\r
}\r
\r
-void\r
+/*static*/ void\r
MingwModuleHandler::SetMakefile ( FILE* f )\r
{\r
fMakefile = f;\r
}\r
\r
-void\r
+/*static*/ void\r
MingwModuleHandler::SetUsePch ( bool b )\r
{\r
use_pch = b;\r
}\r
\r
-MingwModuleHandler*\r
-MingwModuleHandler::InstanciateHandler ( const string& location,\r
- ModuleType moduletype,\r
- MingwBackend* backend )\r
+/*static*/ string\r
+MingwModuleHandler::PassThruCacheDirectory (\r
+ const string &file, bool out )\r
+{\r
+ string dir ( GetDirectory ( file ) );\r
+ return backend->AddDirectoryTarget ( dir, out ) + SSEP + file;\r
+}\r
+\r
+/*static*/ string\r
+MingwModuleHandler::GetTargetFilename (\r
+ const Module& module,\r
+ string_list* pclean_files )\r
+{\r
+ string target = PassThruCacheDirectory (\r
+ FixupTargetFilename ( module.GetPath () ),\r
+ true );\r
+ if ( pclean_files )\r
+ {\r
+ string_list& clean_files = *pclean_files;\r
+ CLEAN_FILE ( target );\r
+ }\r
+ return target;\r
+}\r
+\r
+/*static*/ string\r
+MingwModuleHandler::GetImportLibraryFilename (\r
+ const Module& module,\r
+ string_list* pclean_files )\r
+{\r
+ string target = PassThruCacheDirectory (\r
+ FixupTargetFilename ( module.GetDependencyPath () ),\r
+ true );\r
+ if ( pclean_files )\r
+ {\r
+ string_list& clean_files = *pclean_files;\r
+ CLEAN_FILE ( target );\r
+ }\r
+ return target;\r
+}\r
+\r
+/*static*/ MingwModuleHandler*\r
+MingwModuleHandler::InstanciateHandler (\r
+ const Module& module,\r
+ MingwBackend* backend )\r
{\r
MingwModuleHandler* handler;\r
- switch ( moduletype )\r
+ switch ( module.type )\r
{\r
case BuildTool:\r
- handler = new MingwBuildToolModuleHandler ( backend );\r
+ handler = new MingwBuildToolModuleHandler ( module );\r
break;\r
case StaticLibrary:\r
- handler = new MingwStaticLibraryModuleHandler ( backend );\r
+ handler = new MingwStaticLibraryModuleHandler ( module );\r
break;\r
case ObjectLibrary:\r
- handler = new MingwObjectLibraryModuleHandler ( backend );\r
+ handler = new MingwObjectLibraryModuleHandler ( module );\r
break;\r
case Kernel:\r
- handler = new MingwKernelModuleHandler ( backend );\r
+ handler = new MingwKernelModuleHandler ( module );\r
break;\r
case NativeCUI:\r
- handler = new MingwNativeCUIModuleHandler ( backend );\r
+ handler = new MingwNativeCUIModuleHandler ( module );\r
break;\r
case Win32CUI:\r
- handler = new MingwWin32CUIModuleHandler ( backend );\r
+ handler = new MingwWin32CUIModuleHandler ( module );\r
break;\r
case Win32GUI:\r
- handler = new MingwWin32GUIModuleHandler ( backend );\r
+ handler = new MingwWin32GUIModuleHandler ( module );\r
break;\r
case KernelModeDLL:\r
- handler = new MingwKernelModeDLLModuleHandler ( backend );\r
+ handler = new MingwKernelModeDLLModuleHandler ( module );\r
break;\r
case NativeDLL:\r
- handler = new MingwNativeDLLModuleHandler ( backend );\r
+ handler = new MingwNativeDLLModuleHandler ( module );\r
break;\r
case Win32DLL:\r
- handler = new MingwWin32DLLModuleHandler ( backend );\r
+ handler = new MingwWin32DLLModuleHandler ( module );\r
break;\r
case KernelModeDriver:\r
- handler = new MingwKernelModeDriverModuleHandler ( backend );\r
+ handler = new MingwKernelModeDriverModuleHandler ( module );\r
break;\r
case BootLoader:\r
- handler = new MingwBootLoaderModuleHandler ( backend );\r
+ handler = new MingwBootLoaderModuleHandler ( module );\r
break;\r
case BootSector:\r
- handler = new MingwBootSectorModuleHandler ( backend );\r
+ handler = new MingwBootSectorModuleHandler ( module );\r
break;\r
case Iso:\r
- handler = new MingwIsoModuleHandler ( backend );\r
+ handler = new MingwIsoModuleHandler ( module );\r
+ break;\r
+ case Test:\r
+ handler = new MingwTestModuleHandler ( module );\r
+ break;\r
+ default:\r
+ throw UnknownModuleTypeException (\r
+ module.node.location,\r
+ module.type );\r
break;\r
}\r
return handler;\r
}\r
\r
string\r
-MingwModuleHandler::GetActualSourceFilename ( const string& filename ) const\r
+MingwModuleHandler::GetActualSourceFilename (\r
+ const string& filename ) const\r
{\r
string extension = GetExtension ( filename );\r
if ( extension == ".spec" || extension == "SPEC" )\r
}\r
\r
string\r
-MingwModuleHandler::GetModuleArchiveFilename ( const Module& module ) const\r
+MingwModuleHandler::GetModuleArchiveFilename () const\r
{\r
- return ReplaceExtension ( FixupTargetFilename ( module.GetPath () ),\r
- ".a" );\r
+ if ( module.type == StaticLibrary )\r
+ return GetTargetFilename(module,NULL);\r
+ return PassThruCacheDirectory ( ReplaceExtension (\r
+ FixupTargetFilename ( module.GetPath () ),\r
+ ".temp.a" ), false );\r
}\r
\r
bool\r
MingwModuleHandler::IsGeneratedFile ( const File& file ) const\r
{\r
string extension = GetExtension ( file.name );\r
- if ( extension == ".spec" || extension == "SPEC" )\r
- return true;\r
- else\r
- return false;\r
+ return ( extension == ".spec" || extension == "SPEC" );\r
}\r
\r
string\r
-MingwModuleHandler::GetImportLibraryDependency ( const Module& importedModule )\r
+MingwModuleHandler::GetImportLibraryDependency (\r
+ const Module& importedModule )\r
{\r
+ string dep;\r
if ( importedModule.type == ObjectLibrary )\r
- return GetObjectsMacro ( importedModule );\r
+ dep = GetTargetMacro ( importedModule );\r
else\r
- return PassThruCacheDirectory ( FixupTargetFilename ( importedModule.GetDependencyPath () ) );\r
+ dep = GetImportLibraryFilename ( importedModule, NULL );\r
+ return dep;\r
}\r
\r
-string\r
-MingwModuleHandler::GetModuleDependencies ( const Module& module )\r
+void\r
+MingwModuleHandler::GetModuleDependencies (\r
+ string_list& dependencies )\r
{\r
- if ( module.dependencies.size () == 0 )\r
- return "";\r
+ size_t iend = module.dependencies.size ();\r
+\r
+ // TODO FIXME - do we *really* not want to call\r
+ // GetDefinitionDependencies() if dependencies.size() == 0 ???\r
+ if ( iend == 0 )\r
+ return;\r
\r
- string dependencies ( "" );\r
- for ( size_t i = 0; i < module.dependencies.size (); i++ )\r
+ for ( size_t i = 0; i < iend; i++ )\r
{\r
- if ( dependencies.size () > 0 )\r
- dependencies += " ";\r
- const Dependency* dependency = module.dependencies[i];\r
- const Module* dependencyModule = dependency->dependencyModule;\r
- dependencies += dependencyModule->GetTargets ();\r
- }\r
- string definitionDependencies = GetDefinitionDependencies ( module );\r
- if ( dependencies.length () > 0 && definitionDependencies.length () > 0 )\r
- dependencies += " " + definitionDependencies;\r
- else if ( definitionDependencies.length () > 0 )\r
- dependencies = definitionDependencies;\r
- return dependencies;\r
+ const Dependency& dependency = *module.dependencies[i];\r
+ const Module& dependencyModule = *dependency.dependencyModule;\r
+ dependencyModule.GetTargets ( dependencies );\r
+ }\r
+ GetDefinitionDependencies ( dependencies );\r
}\r
\r
-string\r
-MingwModuleHandler::GetSourceFilenames ( const Module& module,\r
- bool includeGeneratedFiles ) const\r
+void\r
+MingwModuleHandler::GetSourceFilenames (\r
+ string_list& list,\r
+ bool includeGeneratedFiles ) const\r
{\r
size_t i;\r
\r
- string sourceFilenames ( "" );\r
const vector<File*>& files = module.non_if_data.files;\r
for ( i = 0; i < files.size (); i++ )\r
{\r
if ( includeGeneratedFiles || !IsGeneratedFile ( *files[i] ) )\r
- sourceFilenames += " " + GetActualSourceFilename ( files[i]->name );\r
+ {\r
+ list.push_back (\r
+ GetActualSourceFilename ( files[i]->name ) );\r
+ }\r
}\r
// intentionally make a copy so that we can append more work in\r
// the middle of processing without having to go recursive\r
{\r
File& file = *files[j];\r
if ( includeGeneratedFiles || !IsGeneratedFile ( file ) )\r
- sourceFilenames += " " + GetActualSourceFilename ( file.name );\r
+ {\r
+ list.push_back (\r
+ GetActualSourceFilename ( file.name ) );\r
+ }\r
}\r
}\r
- return sourceFilenames;\r
}\r
\r
-string\r
-MingwModuleHandler::GetSourceFilenames ( const Module& module ) const\r
+void\r
+MingwModuleHandler::GetSourceFilenamesWithoutGeneratedFiles (\r
+ string_list& list ) const\r
{\r
- return GetSourceFilenames ( module,\r
- true );\r
+ GetSourceFilenames ( list, false );\r
}\r
\r
string\r
-MingwModuleHandler::GetSourceFilenamesWithoutGeneratedFiles ( const Module& module ) const\r
-{\r
- return GetSourceFilenames ( module,\r
- false );\r
-}\r
-\r
-static string\r
-GetObjectFilename ( const Module& module, const string& sourceFilename )\r
+MingwModuleHandler::GetObjectFilename (\r
+ const string& sourceFilename,\r
+ string_list* pclean_files ) const\r
{\r
string newExtension;\r
string extension = GetExtension ( sourceFilename );\r
newExtension = ".stubs.o";\r
else\r
newExtension = ".o";\r
- return FixupTargetFilename (\r
- ReplaceExtension (\r
- PrefixFilename(sourceFilename,module.prefix),\r
- newExtension ) );\r
+ string obj_file = PassThruCacheDirectory (\r
+ FixupTargetFilename (\r
+ ReplaceExtension (\r
+ sourceFilename, //PrefixFilename(sourceFilename,module.prefix),\r
+ newExtension ) ),\r
+ false );\r
+ if ( pclean_files )\r
+ {\r
+ string_list& clean_files = *pclean_files;\r
+ CLEAN_FILE ( obj_file );\r
+ }\r
+ return obj_file;\r
}\r
\r
void\r
-MingwModuleHandler::GenerateCleanTarget (\r
- const Module& module,\r
- const string_list& clean_files ) const\r
+MingwModuleHandler::GenerateCleanTarget () const\r
{\r
if ( 0 == clean_files.size() )\r
return;\r
}\r
\r
string\r
-MingwModuleHandler::GetObjectFilenames ( const Module& module )\r
+MingwModuleHandler::GetObjectFilenames ()\r
{\r
const vector<File*>& files = module.non_if_data.files;\r
if ( files.size () == 0 )\r
{\r
if ( objectFilenames.size () > 0 )\r
objectFilenames += " ";\r
- objectFilenames += PassThruCacheDirectory (\r
- GetObjectFilename ( module, files[i]->name ) );\r
+ objectFilenames +=\r
+ GetObjectFilename ( files[i]->name, NULL );\r
}\r
return objectFilenames;\r
}\r
\r
string\r
-MingwModuleHandler::GenerateGccDefineParametersFromVector ( const vector<Define*>& defines ) const\r
+MingwModuleHandler::GenerateGccDefineParametersFromVector (\r
+ const vector<Define*>& defines ) const\r
{\r
string parameters;\r
for ( size_t i = 0; i < defines.size (); i++ )\r
}\r
\r
string\r
-MingwModuleHandler::GenerateGccDefineParameters ( const Module& module ) const\r
+MingwModuleHandler::GenerateGccDefineParameters () const\r
{\r
string parameters = GenerateGccDefineParametersFromVector ( module.project.non_if_data.defines );\r
string s = GenerateGccDefineParametersFromVector ( module.non_if_data.defines );\r
}\r
\r
string\r
-MingwModuleHandler::ConcatenatePaths ( const string& path1,\r
- const string& path2 ) const\r
+MingwModuleHandler::ConcatenatePaths (\r
+ const string& path1,\r
+ const string& path2 ) const\r
{\r
if ( ( path1.length () == 0 ) || ( path1 == "." ) || ( path1 == "./" ) )\r
return path2;\r
}\r
\r
string\r
-MingwModuleHandler::GenerateGccIncludeParameters ( const Module& module ) const\r
+MingwModuleHandler::GenerateGccIncludeParameters () const\r
{\r
string parameters = GenerateGccIncludeParametersFromVector ( module.non_if_data.includes );\r
string s = GenerateGccIncludeParametersFromVector ( module.project.non_if_data.includes );\r
}\r
\r
string\r
-MingwModuleHandler::GenerateLinkerParameters ( const Module& module ) const\r
+MingwModuleHandler::GenerateLinkerParameters () const\r
{\r
return GenerateLinkerParametersFromVector ( module.linkerFlags );\r
}\r
\r
void\r
MingwModuleHandler::GenerateMacros (\r
- const Module& module,\r
const char* assignmentOperation,\r
const IfableData& data,\r
const vector<CompilerFlag*>* compilerFlags,\r
- const vector<LinkerFlag*>* linkerFlags,\r
- const string& cflags_macro,\r
- const string& nasmflags_macro,\r
- const string& windresflags_macro,\r
- const string& linkerflags_macro,\r
- const string& objs_macro,\r
- const string& libs_macro,\r
- const string& linkdeps_macro )\r
+ const vector<LinkerFlag*>* linkerFlags )\r
{\r
size_t i;\r
\r
if ( data.includes.size () > 0 || data.defines.size () > 0 )\r
{\r
GenerateMacro ( assignmentOperation,\r
- cflags_macro,\r
+ cflagsMacro,\r
data,\r
compilerFlags );\r
GenerateMacro ( assignmentOperation,\r
- windresflags_macro,\r
+ windresflagsMacro,\r
data,\r
compilerFlags );\r
}\r
fprintf (\r
fMakefile,\r
"%s %s %s\n",\r
- linkerflags_macro.c_str (),\r
+ linkerflagsMacro.c_str (),\r
assignmentOperation,\r
linkerParameters.c_str() );\r
}\r
fprintf (\r
fMakefile,\r
"%s %s %s\n",\r
- libs_macro.c_str(),\r
+ libsMacro.c_str(),\r
assignmentOperation,\r
deps.c_str() );\r
}\r
}\r
\r
+ const vector<If*>& ifs = data.ifs;\r
+ for ( i = 0; i < ifs.size(); i++ )\r
+ {\r
+ If& rIf = *ifs[i];\r
+ if ( rIf.data.defines.size()\r
+ || rIf.data.includes.size()\r
+ || rIf.data.libraries.size()\r
+ || rIf.data.files.size()\r
+ || rIf.data.ifs.size() )\r
+ {\r
+ fprintf (\r
+ fMakefile,\r
+ "ifeq (\"$(%s)\",\"%s\")\n",\r
+ rIf.property.c_str(),\r
+ rIf.value.c_str() );\r
+ GenerateMacros (\r
+ "+=",\r
+ rIf.data,\r
+ NULL,\r
+ NULL );\r
+ fprintf ( \r
+ fMakefile,\r
+ "endif\n\n" );\r
+ }\r
+ }\r
+}\r
+\r
+void\r
+MingwModuleHandler::GenerateObjectMacros (\r
+ const char* assignmentOperation,\r
+ const IfableData& data,\r
+ const vector<CompilerFlag*>* compilerFlags,\r
+ const vector<LinkerFlag*>* linkerFlags )\r
+{\r
+ size_t i;\r
+\r
const vector<File*>& files = data.files;\r
if ( files.size () > 0 )\r
{\r
{\r
fprintf ( fMakefile,\r
"%s := %s $(%s)\n",\r
- objs_macro.c_str(),\r
- PassThruCacheDirectory (\r
- GetObjectFilename ( module, file.name ) ).c_str (),\r
- objs_macro.c_str() );\r
+ objectsMacro.c_str(),\r
+ GetObjectFilename (\r
+ file.name, NULL ).c_str (),\r
+ objectsMacro.c_str() );\r
}\r
}\r
fprintf (\r
fMakefile,\r
"%s %s",\r
- objs_macro.c_str (),\r
+ objectsMacro.c_str (),\r
assignmentOperation );\r
for ( i = 0; i < files.size(); i++ )\r
{\r
fprintf (\r
fMakefile,\r
"%s%s",\r
- ( i%10 == 9 ? "\\\n\t" : " " ),\r
- PassThruCacheDirectory (\r
- GetObjectFilename ( module, file.name ) ).c_str () );\r
+ ( i%10 == 9 ? " \\\n\t" : " " ),\r
+ GetObjectFilename (\r
+ file.name, NULL ).c_str () );\r
}\r
}\r
fprintf ( fMakefile, "\n" );\r
"ifeq (\"$(%s)\",\"%s\")\n",\r
rIf.property.c_str(),\r
rIf.value.c_str() );\r
- GenerateMacros (\r
- module,\r
+ GenerateObjectMacros (\r
"+=",\r
rIf.data,\r
NULL,\r
- NULL,\r
- cflags_macro,\r
- nasmflags_macro,\r
- windresflags_macro,\r
- linkerflags_macro,\r
- objs_macro,\r
- libs_macro,\r
- linkdeps_macro );\r
+ NULL );\r
fprintf ( \r
fMakefile,\r
"endif\n\n" );\r
}\r
\r
void\r
-MingwModuleHandler::GenerateMacros (\r
- const Module& module,\r
- const string& cflags_macro,\r
- const string& nasmflags_macro,\r
- const string& windresflags_macro,\r
- const string& linkerflags_macro,\r
- const string& objs_macro,\r
- const string& libs_macro,\r
- const string& linkdeps_macro )\r
-{\r
- GenerateMacros (\r
- module,\r
- "=",\r
- module.non_if_data,\r
- &module.compilerFlags,\r
- &module.linkerFlags,\r
- cflags_macro,\r
- nasmflags_macro,\r
- windresflags_macro,\r
- linkerflags_macro,\r
- objs_macro,\r
- libs_macro,\r
- linkdeps_macro );\r
-\r
- if ( module.importLibrary )\r
- {\r
- string s;\r
- const vector<File*>& files = module.non_if_data.files;\r
- for ( size_t i = 0; i < files.size (); i++ )\r
- {\r
- File& file = *files[i];\r
- string extension = GetExtension ( file.name );\r
- if ( extension == ".spec" || extension == ".SPEC" )\r
- {\r
- if ( s.length () > 0 )\r
- s += " ";\r
- s += GetSpecObjectDependencies ( file.name );\r
- }\r
- }\r
- if ( s.length () > 0 )\r
- {\r
- fprintf (\r
- fMakefile,\r
- "%s += %s\n",\r
- linkdeps_macro.c_str(),\r
- s.c_str() );\r
- }\r
- }\r
-\r
- fprintf (\r
- fMakefile,\r
- "%s += $(PROJECT_CFLAGS)\n",\r
- cflags_macro.c_str () );\r
-\r
- fprintf (\r
- fMakefile,\r
- "%s += $(PROJECT_RCFLAGS)\n",\r
- windresflags_macro.c_str () );\r
-\r
- fprintf (\r
- fMakefile,\r
- "%s_LFLAGS += $(PROJECT_LFLAGS)\n",\r
- module.name.c_str () );\r
-\r
- fprintf (\r
- fMakefile,\r
- "%s += $(%s)",\r
- linkdeps_macro.c_str (),\r
- libs_macro.c_str () );\r
-\r
- fprintf ( fMakefile, "\n" );\r
-}\r
-\r
-void\r
-MingwModuleHandler::GenerateGccCommand ( const Module& module,\r
- const string& sourceFilename,\r
- const string& cc,\r
- const string& cflagsMacro )\r
+MingwModuleHandler::GenerateGccCommand (\r
+ const string& sourceFilename,\r
+ const string& cc,\r
+ const string& cflagsMacro )\r
{\r
string deps = sourceFilename;\r
if ( module.pch && use_pch )\r
deps += " " + module.pch->header + ".gch";\r
- string objectFilename = PassThruCacheDirectory (\r
- GetObjectFilename ( module, sourceFilename ) );\r
+ string objectFilename = GetObjectFilename (\r
+ sourceFilename, NULL );\r
fprintf ( fMakefile,\r
"%s: %s %s\n",\r
objectFilename.c_str (),\r
GetDirectory ( objectFilename ).c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_CC)\n" );\r
fprintf ( fMakefile,\r
- "\t%s -c %s -o $@ %s\n",\r
+ "\t%s -c $< -o $@ %s\n",\r
cc.c_str (),\r
- sourceFilename.c_str (),\r
cflagsMacro.c_str () );\r
}\r
\r
void\r
-MingwModuleHandler::GenerateGccAssemblerCommand ( const Module& module,\r
- const string& sourceFilename,\r
- const string& cc,\r
- const string& cflagsMacro )\r
+MingwModuleHandler::GenerateGccAssemblerCommand (\r
+ const string& sourceFilename,\r
+ const string& cc,\r
+ const string& cflagsMacro )\r
{\r
- string objectFilename = PassThruCacheDirectory (\r
- GetObjectFilename ( module, sourceFilename ) );\r
+ string objectFilename = GetObjectFilename (\r
+ sourceFilename, &clean_files );\r
fprintf ( fMakefile,\r
"%s: %s %s\n",\r
objectFilename.c_str (),\r
GetDirectory ( objectFilename ).c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_GAS)\n" );\r
fprintf ( fMakefile,\r
- "\t%s -x assembler-with-cpp -c %s -o $@ -D__ASM__ %s\n",\r
+ "\t%s -x assembler-with-cpp -c $< -o $@ -D__ASM__ %s\n",\r
cc.c_str (),\r
- sourceFilename.c_str (),\r
cflagsMacro.c_str () );\r
}\r
\r
void\r
-MingwModuleHandler::GenerateNasmCommand ( const Module& module,\r
- const string& sourceFilename,\r
- const string& nasmflagsMacro )\r
+MingwModuleHandler::GenerateNasmCommand (\r
+ const string& sourceFilename,\r
+ const string& nasmflagsMacro )\r
{\r
- string objectFilename = PassThruCacheDirectory (\r
- GetObjectFilename ( module, sourceFilename ) );\r
+ string objectFilename = GetObjectFilename (\r
+ sourceFilename, &clean_files );\r
fprintf ( fMakefile,\r
"%s: %s %s\n",\r
objectFilename.c_str (),\r
GetDirectory ( objectFilename ).c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_NASM)\n" );\r
fprintf ( fMakefile,\r
- "\t%s -f win32 %s -o $@ %s\n",\r
+ "\t%s -f win32 $< -o $@ %s\n",\r
"$(Q)nasm",\r
- sourceFilename.c_str (),\r
nasmflagsMacro.c_str () );\r
}\r
\r
void\r
-MingwModuleHandler::GenerateWindresCommand ( const Module& module,\r
- const string& sourceFilename,\r
- const string& windresflagsMacro )\r
-{\r
- string objectFilename = PassThruCacheDirectory ( \r
- GetObjectFilename ( module, sourceFilename ) );\r
- string rciFilename = ReplaceExtension ( sourceFilename,\r
- ".rci" );\r
- string resFilename = ReplaceExtension ( sourceFilename,\r
- ".res" );\r
+MingwModuleHandler::GenerateWindresCommand (\r
+ const string& sourceFilename,\r
+ const string& windresflagsMacro )\r
+{\r
+ string objectFilename =\r
+ GetObjectFilename ( sourceFilename, &clean_files );\r
+ string rciFilename = ros_temp +\r
+ ReplaceExtension ( sourceFilename, ".rci" );\r
+ string resFilename = ros_temp +\r
+ ReplaceExtension ( sourceFilename, ".res" );\r
fprintf ( fMakefile,\r
"%s: %s %s $(WRC_TARGET)\n",\r
objectFilename.c_str (),\r
sourceFilename.c_str (),\r
rciFilename.c_str () );\r
fprintf ( fMakefile,\r
- "\t${wrc} ${%s} %s %s\n",\r
+ "\t$(Q)$(WRC_TARGET) ${%s} %s %s\n",\r
windresflagsMacro.c_str (),\r
rciFilename.c_str (),\r
resFilename.c_str () );\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
rciFilename.c_str () );\r
fprintf ( fMakefile,\r
- "\t${windres} %s -o %s\n",\r
- resFilename.c_str (),\r
- objectFilename.c_str () );\r
+ "\t${windres} %s -o $@\n",\r
+ resFilename.c_str () );\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
resFilename.c_str () );\r
}\r
\r
void\r
MingwModuleHandler::GenerateWinebuildCommands (\r
- const Module& module,\r
- const string& sourceFilename,\r
- string_list& clean_files ) const\r
+ const string& sourceFilename )\r
{\r
string basename = GetBasename ( sourceFilename );\r
\r
- string def_file = basename + ".spec.def";\r
- CLEAN_FILE ( def_file );\r
+ string def_file = PassThruCacheDirectory (\r
+ basename + ".spec.def",\r
+ false );\r
+ CLEAN_FILE(def_file);\r
\r
- string stub_file = basename + ".stubs.c";\r
- CLEAN_FILE ( stub_file );\r
+ string stub_file = PassThruCacheDirectory (\r
+ basename + ".stubs.c",\r
+ false );\r
+ CLEAN_FILE(stub_file)\r
\r
fprintf ( fMakefile,\r
"%s: %s $(WINEBUILD_TARGET)\n",\r
fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" );\r
fprintf ( fMakefile,\r
"\t%s --def=%s -o %s\n",\r
- "${winebuild}",\r
+ "$(Q)$(WINEBUILD_TARGET)",\r
sourceFilename.c_str (),\r
def_file.c_str () );\r
\r
fprintf ( fMakefile, "\t$(ECHO_WINEBLD)\n" );\r
fprintf ( fMakefile,\r
"\t%s --pedll=%s -o %s\n",\r
- "${winebuild}",\r
+ "$(Q)$(WINEBUILD_TARGET)",\r
sourceFilename.c_str (),\r
stub_file.c_str () );\r
}\r
\r
void\r
MingwModuleHandler::GenerateCommands (\r
- const Module& module,\r
const string& sourceFilename,\r
const string& cc,\r
const string& cppc,\r
const string& cflagsMacro,\r
const string& nasmflagsMacro,\r
- const string& windresflagsMacro,\r
- string_list& clean_files )\r
+ const string& windresflagsMacro )\r
{\r
- CLEAN_FILE ( GetObjectFilename(module,sourceFilename) );\r
string extension = GetExtension ( sourceFilename );\r
if ( extension == ".c" || extension == ".C" )\r
{\r
- GenerateGccCommand ( module,\r
- sourceFilename,\r
+ GenerateGccCommand ( sourceFilename,\r
cc,\r
cflagsMacro );\r
return;\r
extension == ".cpp" || extension == ".CPP" ||\r
extension == ".cxx" || extension == ".CXX" )\r
{\r
- GenerateGccCommand ( module,\r
- sourceFilename,\r
+ GenerateGccCommand ( sourceFilename,\r
cppc,\r
cflagsMacro );\r
return;\r
}\r
else if ( extension == ".s" || extension == ".S" )\r
{\r
- GenerateGccAssemblerCommand ( module,\r
- sourceFilename,\r
+ GenerateGccAssemblerCommand ( sourceFilename,\r
cc,\r
cflagsMacro );\r
return;\r
}\r
else if ( extension == ".asm" || extension == ".ASM" )\r
{\r
- GenerateNasmCommand ( module,\r
- sourceFilename,\r
+ GenerateNasmCommand ( sourceFilename,\r
nasmflagsMacro );\r
return;\r
}\r
else if ( extension == ".rc" || extension == ".RC" )\r
{\r
- GenerateWindresCommand ( module,\r
- sourceFilename,\r
+ GenerateWindresCommand ( sourceFilename,\r
windresflagsMacro );\r
return;\r
}\r
else if ( extension == ".spec" || extension == ".SPEC" )\r
{\r
- GenerateWinebuildCommands ( module,\r
- sourceFilename,\r
- clean_files );\r
- GenerateGccCommand ( module,\r
- GetActualSourceFilename ( sourceFilename ),\r
+ GenerateWinebuildCommands ( sourceFilename );\r
+ GenerateGccCommand ( GetActualSourceFilename ( sourceFilename ),\r
cc,\r
cflagsMacro );\r
return;\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
+ const string& libsMacro )\r
{\r
+ string target ( GetTargetMacro ( module ) );\r
+ string target_folder ( GetDirectory ( GetTargetFilename ( module, NULL ) ) );\r
+\r
fprintf ( fMakefile,\r
- "%s: %s ${RSYM_TARGET}\n",\r
+ "%s: %s %s $(RSYM_TARGET)\n",\r
target.c_str (),\r
- dependencies.c_str () );\r
+ dependencies.c_str (),\r
+ target_folder.c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
string targetName ( module.GetTargetName () );\r
if ( module.importLibrary != NULL )\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string base_tmp = ros_junk + module.name + ".base.tmp";\r
+ string base_tmp = ros_temp + module.name + ".base.tmp";\r
CLEAN_FILE ( base_tmp );\r
- string junk_tmp = ros_junk + module.name + ".junk.tmp";\r
+ string junk_tmp = ros_temp + module.name + ".junk.tmp";\r
CLEAN_FILE ( junk_tmp );\r
- string temp_exp = ros_junk + module.name + ".temp.exp";\r
+ string temp_exp = ros_temp + module.name + ".temp.exp";\r
CLEAN_FILE ( temp_exp );\r
string def_file = module.GetBasePath () + SSEP + module.importLibrary->definition;\r
\r
junk_tmp.c_str (),\r
objectsMacro.c_str (),\r
libsMacro.c_str (),\r
- GetLinkerMacro ( module ).c_str () );\r
+ GetLinkerMacro ().c_str () );\r
\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
junk_tmp.c_str () );\r
\r
string killAt = module.mangledSymbols ? "" : "--kill-at";\r
killAt.c_str () );\r
\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
base_tmp.c_str () );\r
\r
fprintf ( fMakefile,\r
target.c_str (),\r
objectsMacro.c_str (),\r
libsMacro.c_str (),\r
- GetLinkerMacro ( module ).c_str () );\r
+ GetLinkerMacro ().c_str () );\r
\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
temp_exp.c_str () );\r
}\r
else\r
target.c_str (),\r
objectsMacro.c_str (),\r
libsMacro.c_str (),\r
- GetLinkerMacro ( module ).c_str () );\r
+ GetLinkerMacro ().c_str () );\r
}\r
\r
fprintf ( fMakefile, "\t$(ECHO_RSYM)\n" );\r
fprintf ( fMakefile,\r
- "\t${rsym} %s %s\n\n",\r
- target.c_str (),\r
- target.c_str () );\r
+ "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );\r
+}\r
+\r
+void\r
+MingwModuleHandler::GeneratePhonyTarget() const\r
+{\r
+ string targetMacro ( GetTargetMacro(module) );\r
+ fprintf ( fMakefile, ".PHONY: %s\n\n",\r
+ targetMacro.c_str ());\r
+ fprintf ( fMakefile, "%s: %s\n",\r
+ targetMacro.c_str (),\r
+ GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
}\r
\r
void\r
MingwModuleHandler::GenerateObjectFileTargets (\r
- const Module& module,\r
const IfableData& data,\r
const string& cc,\r
const string& cppc,\r
const string& cflagsMacro,\r
const string& nasmflagsMacro,\r
- const string& windresflagsMacro,\r
- string_list& clean_files )\r
+ const string& windresflagsMacro )\r
{\r
size_t i;\r
\r
for ( i = 0; i < files.size (); i++ )\r
{\r
string sourceFilename = files[i]->name;\r
- GenerateCommands ( module,\r
- sourceFilename,\r
+ GenerateCommands ( sourceFilename,\r
cc,\r
cppc,\r
cflagsMacro,\r
nasmflagsMacro,\r
- windresflagsMacro,\r
- clean_files );\r
+ windresflagsMacro );\r
fprintf ( fMakefile,\r
"\n" );\r
}\r
const vector<If*>& ifs = data.ifs;\r
for ( i = 0; i < ifs.size(); i++ )\r
{\r
- GenerateObjectFileTargets ( module,\r
- ifs[i]->data,\r
+ GenerateObjectFileTargets ( ifs[i]->data,\r
cc,\r
cppc,\r
cflagsMacro,\r
nasmflagsMacro,\r
- windresflagsMacro,\r
- clean_files );\r
+ windresflagsMacro );\r
}\r
}\r
\r
void\r
MingwModuleHandler::GenerateObjectFileTargets (\r
- const Module& module,\r
const string& cc,\r
const string& cppc,\r
const string& cflagsMacro,\r
const string& nasmflagsMacro,\r
- const string& windresflagsMacro,\r
- string_list& clean_files )\r
+ const string& windresflagsMacro )\r
{\r
if ( module.pch )\r
{\r
}\r
}\r
\r
- GenerateObjectFileTargets ( module,\r
- module.non_if_data,\r
+ GenerateObjectFileTargets ( module.non_if_data,\r
cc,\r
cppc,\r
cflagsMacro,\r
nasmflagsMacro,\r
- windresflagsMacro,\r
- clean_files );\r
+ windresflagsMacro );\r
fprintf ( fMakefile, "\n" );\r
}\r
\r
string\r
-MingwModuleHandler::GenerateArchiveTarget ( const Module& module,\r
- const string& ar,\r
+MingwModuleHandler::GenerateArchiveTarget ( const string& ar,\r
const string& objs_macro ) const\r
{\r
- string archiveFilename = GetModuleArchiveFilename ( module );\r
+ string archiveFilename ( GetModuleArchiveFilename () );\r
\r
fprintf ( fMakefile,\r
- "%s: %s\n",\r
+ "%s: %s %s\n",\r
archiveFilename.c_str (),\r
- objs_macro.c_str ());\r
+ objs_macro.c_str (),\r
+ GetDirectory(archiveFilename).c_str() );\r
\r
fprintf ( fMakefile, "\t$(ECHO_AR)\n" );\r
\r
fprintf ( fMakefile,\r
- "\t%s -rc %s %s\n\n",\r
+ "\t%s -rc $@ %s\n\n",\r
ar.c_str (),\r
- archiveFilename.c_str (),\r
objs_macro.c_str ());\r
\r
return archiveFilename;\r
}\r
\r
string\r
-MingwModuleHandler::GetCFlagsMacro ( const Module& module ) const\r
+MingwModuleHandler::GetCFlagsMacro () const\r
{\r
return ssprintf ( "$(%s_CFLAGS)",\r
module.name.c_str () );\r
}\r
\r
-string\r
-MingwModuleHandler::GetObjectsMacro ( const Module& module ) const\r
+/*static*/ string\r
+MingwModuleHandler::GetObjectsMacro ( const Module& module )\r
{\r
return ssprintf ( "$(%s_OBJS)",\r
module.name.c_str () );\r
}\r
\r
string\r
-MingwModuleHandler::GetLinkingDependenciesMacro ( const Module& module ) const\r
+MingwModuleHandler::GetLinkingDependenciesMacro () const\r
{\r
return ssprintf ( "$(%s_LINKDEPS)", module.name.c_str () );\r
}\r
\r
string\r
-MingwModuleHandler::GetLibsMacro ( const Module& module ) const\r
+MingwModuleHandler::GetLibsMacro () const\r
{\r
return ssprintf ( "$(%s_LIBS)", module.name.c_str () );\r
}\r
\r
string\r
-MingwModuleHandler::GetLinkerMacro ( const Module& module ) const\r
+MingwModuleHandler::GetLinkerMacro () const\r
{\r
return ssprintf ( "$(%s_LFLAGS)",\r
module.name.c_str () );\r
}\r
\r
+string\r
+MingwModuleHandler::GetModuleTargets ( const Module& module )\r
+{\r
+ if ( module.type == ObjectLibrary )\r
+ return GetObjectsMacro ( module );\r
+ else\r
+ return GetTargetFilename ( module, NULL );\r
+}\r
+\r
void\r
-MingwModuleHandler::GenerateMacrosAndTargets (\r
- const Module& module,\r
- const string* cflags,\r
- const string* nasmflags,\r
- string_list& clean_files )\r
+MingwModuleHandler::GenerateObjectMacro ()\r
{\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
+ objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ());\r
+\r
+ GenerateObjectMacros (\r
+ "=",\r
+ module.non_if_data,\r
+ &module.compilerFlags,\r
+ &module.linkerFlags );\r
+\r
+ // future references to the macro will be to get its values\r
+ objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ());\r
+}\r
\r
- string cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());\r
- string nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());\r
- string windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());\r
- string linkerFlagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());\r
- string objectsMacro = ssprintf ("%s_OBJS", module.name.c_str ());\r
- string libsMacro = ssprintf("%s_LIBS", module.name.c_str ());\r
- string linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ());\r
-\r
- GenerateMacros ( module,\r
- cflagsMacro,\r
- nasmflagsMacro,\r
- windresflagsMacro,\r
- linkerFlagsMacro,\r
- objectsMacro,\r
- libsMacro,\r
- linkDepsMacro );\r
-\r
- if ( cflags != NULL )\r
+void\r
+MingwModuleHandler::GenerateTargetMacro ()\r
+{\r
+ fprintf ( fMakefile,\r
+ "%s := %s\n",\r
+ GetTargetMacro ( module, false ).c_str (),\r
+ GetModuleTargets ( module ).c_str () );\r
+}\r
+\r
+void\r
+MingwModuleHandler::GenerateOtherMacros ()\r
+{\r
+ cflagsMacro = ssprintf ("%s_CFLAGS", module.name.c_str ());\r
+ nasmflagsMacro = ssprintf ("%s_NASMFLAGS", module.name.c_str ());\r
+ windresflagsMacro = ssprintf ("%s_RCFLAGS", module.name.c_str ());\r
+ linkerflagsMacro = ssprintf ("%s_LFLAGS", module.name.c_str ());\r
+ libsMacro = ssprintf("%s_LIBS", module.name.c_str ());\r
+ linkDepsMacro = ssprintf ("%s_LINKDEPS", module.name.c_str ());\r
+\r
+ GenerateMacros (\r
+ "=",\r
+ module.non_if_data,\r
+ &module.compilerFlags,\r
+ &module.linkerFlags );\r
+\r
+ if ( module.importLibrary )\r
+ {\r
+ string_list s;\r
+ const vector<File*>& files = module.non_if_data.files;\r
+ for ( size_t i = 0; i < files.size (); i++ )\r
+ {\r
+ File& file = *files[i];\r
+ string extension = GetExtension ( file.name );\r
+ if ( extension == ".spec" || extension == ".SPEC" )\r
+ GetSpecObjectDependencies ( s, file.name );\r
+ }\r
+ if ( s.size () > 0 )\r
+ {\r
+ fprintf (\r
+ fMakefile,\r
+ "%s +=",\r
+ linkDepsMacro.c_str() );\r
+ for ( size_t i = 0; i < s.size(); i++ )\r
+ fprintf ( fMakefile,\r
+ " %s",\r
+ s[i].c_str () );\r
+ fprintf ( fMakefile, "\n" );\r
+ }\r
+ }\r
+\r
+ fprintf (\r
+ fMakefile,\r
+ "%s += $(PROJECT_CFLAGS)\n",\r
+ cflagsMacro.c_str () );\r
+\r
+ fprintf (\r
+ fMakefile,\r
+ "%s += $(PROJECT_RCFLAGS)\n",\r
+ windresflagsMacro.c_str () );\r
+\r
+ fprintf (\r
+ fMakefile,\r
+ "%s_LFLAGS += $(PROJECT_LFLAGS)\n",\r
+ module.name.c_str () );\r
+\r
+ fprintf (\r
+ fMakefile,\r
+ "%s += $(%s)\n",\r
+ linkDepsMacro.c_str (),\r
+ libsMacro.c_str () );\r
+\r
+ string cflags = TypeSpecificCFlags();\r
+ if ( cflags.size() > 0 )\r
{\r
fprintf ( fMakefile,\r
"%s += %s\n\n",\r
cflagsMacro.c_str (),\r
- cflags->c_str () );\r
+ cflags.c_str () );\r
}\r
\r
- if ( nasmflags != NULL )\r
+ string nasmflags = TypeSpecificNasmFlags();\r
+ if ( nasmflags.size () > 0 )\r
{\r
fprintf ( fMakefile,\r
"%s += %s\n\n",\r
nasmflagsMacro.c_str (),\r
- nasmflags->c_str () );\r
+ nasmflags.c_str () );\r
}\r
\r
- // generate phony target for module name\r
- fprintf ( fMakefile, ".PHONY: %s\n",\r
- module.name.c_str () );\r
- fprintf ( fMakefile, "%s: %s\n\n",\r
- module.name.c_str (),\r
- FixupTargetFilename ( module.GetPath () ).c_str () );\r
+ fprintf ( fMakefile, "\n\n" );\r
\r
// future references to the macros will be to get their values\r
cflagsMacro = ssprintf ("$(%s)", cflagsMacro.c_str ());\r
nasmflagsMacro = ssprintf ("$(%s)", nasmflagsMacro.c_str ());\r
- objectsMacro = ssprintf ("$(%s)", objectsMacro.c_str ());\r
+}\r
\r
- string ar_target = GenerateArchiveTarget ( module, ar, objectsMacro );\r
- GenerateObjectFileTargets ( module,\r
- cc,\r
- cppc,\r
- cflagsMacro,\r
- nasmflagsMacro,\r
- windresflagsMacro,\r
- clean_files );\r
+void\r
+MingwModuleHandler::GenerateRules ()\r
+{\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 targetMacro = GetTargetMacro ( module );\r
+\r
+ CLEAN_FILE ( targetMacro );\r
+\r
+ // generate phony target for module name\r
+ fprintf ( fMakefile, ".PHONY: %s\n",\r
+ module.name.c_str () );\r
+ fprintf ( fMakefile, "%s: %s\n\n",\r
+ module.name.c_str (),\r
+ GetTargetMacro ( module ).c_str () );\r
\r
- CLEAN_FILE ( ar_target );\r
- string tgt = FixupTargetFilename(module.GetPath());\r
- if ( tgt != ar_target )\r
+ if ( module.type != ObjectLibrary )\r
{\r
- CLEAN_FILE ( tgt );\r
+ string ar_target ( GenerateArchiveTarget ( ar, objectsMacro ) );\r
+ if ( targetMacro != ar_target )\r
+ {\r
+ CLEAN_FILE ( ar_target );\r
+ }\r
}\r
+\r
+ GenerateObjectFileTargets ( cc,\r
+ cppc,\r
+ cflagsMacro,\r
+ nasmflagsMacro,\r
+ windresflagsMacro );\r
}\r
\r
-string\r
-MingwModuleHandler::GetInvocationDependencies ( const Module& module )\r
+void\r
+MingwModuleHandler::GetInvocationDependencies (\r
+ const Module& module,\r
+ string_list& dependencies )\r
{\r
- string dependencies;\r
for ( size_t i = 0; i < module.invocations.size (); i++ )\r
{\r
Invoke& invoke = *module.invocations[i];\r
- if (invoke.invokeModule == &module)\r
+ if ( invoke.invokeModule == &module )\r
/* Protect against circular dependencies */\r
continue;\r
- if ( dependencies.length () > 0 )\r
- dependencies += " ";\r
- dependencies += invoke.GetTargets ();\r
+ invoke.GetTargets ( dependencies );\r
}\r
- return dependencies;\r
}\r
\r
void\r
-MingwModuleHandler::GenerateInvocations ( const Module& module ) const\r
+MingwModuleHandler::GenerateInvocations () const\r
{\r
if ( module.invocations.size () == 0 )\r
return;\r
\r
- for ( size_t i = 0; i < module.invocations.size (); i++ )\r
+ size_t iend = module.invocations.size ();\r
+ for ( size_t i = 0; i < iend; i++ )\r
{\r
const Invoke& invoke = *module.invocations[i];\r
\r
}\r
\r
string invokeTarget = module.GetInvocationTarget ( i );\r
+ string_list invoke_targets;\r
+ assert ( invoke_targets.size() );\r
+ invoke.GetTargets ( invoke_targets );\r
fprintf ( fMakefile,\r
".PHONY: %s\n\n",\r
invokeTarget.c_str () );\r
fprintf ( fMakefile,\r
- "%s: %s\n\n",\r
- invokeTarget.c_str (),\r
- invoke.GetTargets ().c_str () );\r
+ "%s:",\r
+ invokeTarget.c_str () );\r
+ size_t j, jend = invoke_targets.size();\r
+ for ( j = 0; j < jend; j++ )\r
+ {\r
+ fprintf ( fMakefile,\r
+ " %s",\r
+ invoke_targets[i].c_str () );\r
+ }\r
+ fprintf ( fMakefile, "\n\n%s", invoke_targets[0].c_str () );\r
+ for ( j = 1; j < jend; j++ )\r
+ fprintf ( fMakefile,\r
+ " %s",\r
+ invoke_targets[i].c_str () );\r
fprintf ( fMakefile,\r
- "%s: %s\n",\r
- invoke.GetTargets ().c_str (),\r
+ ": %s\n",\r
FixupTargetFilename ( invoke.invokeModule->GetPath () ).c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_INVOKE)\n" );\r
fprintf ( fMakefile,\r
}\r
\r
string\r
-MingwModuleHandler::GetPreconditionDependenciesName ( const Module& module ) const\r
+MingwModuleHandler::GetPreconditionDependenciesName () const\r
{\r
return module.name + "_precondition";\r
}\r
\r
-string\r
-MingwModuleHandler::GetDefaultDependencies ( const Module& module ) const\r
+void\r
+MingwModuleHandler::GetDefaultDependencies (\r
+ string_list& dependencies ) const\r
{\r
/* Avoid circular dependency */\r
- if ( module.type == BuildTool\r
- || module.name == "zlib"\r
- || module.name == "hostzlib" )\r
- return "";\r
- else\r
- return "$(INIT)";\r
+ if ( module.type != BuildTool\r
+ && module.name != "zlib"\r
+ && module.name != "hostzlib" )\r
+\r
+ dependencies.push_back ( "$(INIT)" );\r
}\r
\r
void\r
-MingwModuleHandler::GeneratePreconditionDependencies ( const Module& module )\r
+MingwModuleHandler::GeneratePreconditionDependencies ()\r
{\r
- string preconditionDependenciesName = GetPreconditionDependenciesName ( module );\r
- string sourceFilenames = GetSourceFilenamesWithoutGeneratedFiles ( module );\r
- string dependencies = GetDefaultDependencies ( module );\r
- string s = GetModuleDependencies ( module );\r
- if ( s.length () > 0 )\r
+ string preconditionDependenciesName = GetPreconditionDependenciesName ();\r
+ string_list sourceFilenames;\r
+ GetSourceFilenamesWithoutGeneratedFiles ( sourceFilenames );\r
+ string_list dependencies;\r
+ GetDefaultDependencies ( dependencies );\r
+ GetModuleDependencies ( dependencies );\r
+\r
+ GetInvocationDependencies ( module, dependencies );\r
+ \r
+ if ( dependencies.size() )\r
{\r
- if ( dependencies.length () > 0 )\r
- dependencies += " ";\r
- dependencies += s;\r
+ fprintf ( fMakefile,\r
+ "%s =",\r
+ preconditionDependenciesName.c_str () );\r
+ for ( size_t i = 0; i < dependencies.size(); i++ )\r
+ fprintf ( fMakefile,\r
+ " %s",\r
+ dependencies[i].c_str () );\r
+ fprintf ( fMakefile, "\n\n" );\r
}\r
\r
- s = GetInvocationDependencies ( module );\r
- if ( s.length () > 0 )\r
+ for ( size_t i = 0; i < sourceFilenames.size(); i++ )\r
{\r
- if ( dependencies.length () > 0 )\r
- dependencies += " ";\r
- dependencies += s;\r
- }\r
- \r
- fprintf ( fMakefile,\r
- "%s = %s\n\n",\r
- preconditionDependenciesName.c_str (),\r
- dependencies.c_str () );\r
- const char* p = sourceFilenames.c_str();\r
- const char* end = p + strlen(p);\r
- while ( p < end )\r
- {\r
- const char* p2 = &p[512];\r
- if ( p2 > end )\r
- p2 = end;\r
- while ( p2 > p && !isspace(*p2) )\r
- --p2;\r
- if ( p == p2 )\r
- {\r
- p2 = strpbrk ( p, " \t" );\r
- if ( !p2 )\r
- p2 = end;\r
- }\r
fprintf ( fMakefile,\r
- "%.*s: ${%s}\n",\r
- p2-p,\r
- p,\r
+ "%s: ${%s}\n",\r
+ sourceFilenames[i].c_str(),\r
preconditionDependenciesName.c_str ());\r
- p = p2;\r
- p += strspn ( p, " \t" );\r
}\r
fprintf ( fMakefile, "\n" );\r
}\r
\r
void\r
-MingwModuleHandler::GenerateImportLibraryTargetIfNeeded (\r
- const Module& module,\r
- string_list& clean_files )\r
+MingwModuleHandler::GenerateImportLibraryTargetIfNeeded ()\r
{\r
if ( module.importLibrary != NULL )\r
{\r
- string library_target = PassThruCacheDirectory ( FixupTargetFilename ( module.GetDependencyPath () ) ).c_str ();\r
- CLEAN_FILE ( library_target );\r
+ string library_target (\r
+ GetImportLibraryFilename ( module, &clean_files ) );\r
\r
- string definitionDependencies = GetDefinitionDependencies ( module );\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- library_target.c_str (),\r
- library_target.c_str (),\r
- definitionDependencies.c_str () );\r
+ string_list deps;\r
+ GetDefinitionDependencies ( deps );\r
+\r
+ fprintf ( fMakefile, "# IMPORT LIBRARY RULE:\n" );\r
+\r
+ fprintf ( fMakefile, "%s:",\r
+ library_target.c_str () );\r
+\r
+ size_t i, iend = deps.size();\r
+ for ( i = 0; i < iend; i++ )\r
+ fprintf ( fMakefile, " %s",\r
+ deps[i].c_str () );\r
+\r
+ fprintf ( fMakefile, " %s\n",\r
+ GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
\r
fprintf ( fMakefile, "\t$(ECHO_DLLTOOL)\n" );\r
\r
}\r
}\r
\r
-string\r
-MingwModuleHandler::GetSpecObjectDependencies ( const string& filename ) const\r
+void\r
+MingwModuleHandler::GetSpecObjectDependencies (\r
+ string_list& dependencies,\r
+ const string& filename ) const\r
{\r
string basename = GetBasename ( filename );\r
- return basename + ".spec.def" + " " + basename + ".stubs.c";\r
+ dependencies.push_back ( basename + ".spec.def" );\r
+ dependencies.push_back ( basename + ".stubs.c" );\r
}\r
\r
-string\r
-MingwModuleHandler::GetDefinitionDependencies ( const Module& module )\r
+void\r
+MingwModuleHandler::GetDefinitionDependencies (\r
+ string_list& dependencies ) const\r
{\r
- string dependencies;\r
string dkNkmLibNoFixup = "dk/nkm/lib";\r
- dependencies += FixupTargetFilename ( dkNkmLibNoFixup );\r
- PassThruCacheDirectory ( dkNkmLibNoFixup + SSEP );\r
+ // TODO FIXME - verify this is the correct dependency...\r
+ // easiest way to tell is to remove it and see what breaks\r
+ /*dependencies += PassThruCacheDirectory (\r
+ FixupTargetFilename ( dkNkmLibNoFixup ),\r
+ false, NULL );*/\r
const vector<File*>& files = module.non_if_data.files;\r
for ( size_t i = 0; i < files.size (); i++ )\r
{\r
string extension = GetExtension ( file.name );\r
if ( extension == ".spec" || extension == ".SPEC" )\r
{\r
- if ( dependencies.length () > 0 )\r
- dependencies += " ";\r
- dependencies += GetSpecObjectDependencies ( file.name );\r
+ GetSpecObjectDependencies ( dependencies, file.name );\r
}\r
}\r
- return dependencies;\r
}\r
\r
-bool\r
-MingwModuleHandler::IsCPlusPlusModule ( const Module& module )\r
-{\r
- return module.cplusplus;\r
-}\r
-\r
-\r
-MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( BuildTool,\r
- backend )\r
+MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ )\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwBuildToolModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwBuildToolModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateBuildToolModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateBuildToolModuleTarget ();\r
}\r
\r
void\r
-MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwBuildToolModuleHandler::GenerateBuildToolModuleTarget ()\r
{\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateMacrosAndTargets (\r
- module,\r
- NULL,\r
- NULL,\r
- clean_files );\r
+ GenerateRules ();\r
\r
string linker;\r
- if ( IsCPlusPlusModule ( module ) )\r
+ if ( module.cplusplus )\r
linker = "${host_gpp}";\r
else\r
linker = "${host_gcc}";\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
+ fprintf ( fMakefile, "%s: %s %s %s\n",\r
+ targetMacro.c_str (),\r
objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ linkDepsMacro.c_str (),\r
+ GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
fprintf ( fMakefile,\r
- "\t%s %s -o %s %s %s\n\n",\r
+ "\t%s %s -o $@ %s %s\n\n",\r
linker.c_str (),\r
- GetLinkerMacro ( module ).c_str (),\r
- target.c_str (),\r
+ GetLinkerMacro ().c_str (),\r
objectsMacro.c_str (),\r
libsMacro.c_str () );\r
}\r
\r
\r
-MingwKernelModuleHandler::MingwKernelModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( Kernel,\r
- backend )\r
+MingwKernelModuleHandler::MingwKernelModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwKernelModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwKernelModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateKernelModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateKernelModuleTarget ();\r
}\r
\r
void\r
-MingwKernelModuleHandler::GenerateKernelModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwKernelModuleHandler::GenerateKernelModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
string targetName ( module.GetTargetName () ); // i.e. "ntoskrnl.exe"\r
- string target ( FixupTargetFilename (module.GetPath ()) ); // i.e. "$(ROS_INT).\ntoskrnl\ntoskrnl.exe"\r
+ string targetMacro ( GetTargetMacro (module) ); // i.e. "$(NTOSKRNL_TARGET)"\r
string workingDirectory = GetWorkingDirectory ();\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
- string base_tmp = ros_junk + module.name + ".base.tmp";\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
+ string base_tmp = ros_temp + module.name + ".base.tmp";\r
CLEAN_FILE ( base_tmp );\r
- string junk_tmp = ros_junk + module.name + ".junk.tmp";\r
+ string junk_tmp = ros_temp + module.name + ".junk.tmp";\r
CLEAN_FILE ( junk_tmp );\r
- string temp_exp = ros_junk + module.name + ".temp.exp";\r
+ string temp_exp = ros_temp + module.name + ".temp.exp";\r
CLEAN_FILE ( temp_exp );\r
string gccOptions = ssprintf ("-Wl,-T,%s" SSEP "ntoskrnl.lnk -Wl,--subsystem,native -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -nostartfiles -mdll",\r
module.GetBasePath ().c_str (),\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
- fprintf ( fMakefile, "%s: %s %s ${RSYM_TARGET}\n",\r
- target.c_str (),\r
+ fprintf ( fMakefile, "%s: %s %s %s $(RSYM_TARGET)\n",\r
+ targetMacro.c_str (),\r
objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ linkDepsMacro.c_str (),\r
+ GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
fprintf ( fMakefile,\r
"\t${gcc} %s %s -Wl,--base-file,%s -o %s %s %s\n",\r
- GetLinkerMacro ( module ).c_str (),\r
+ GetLinkerMacro ().c_str (),\r
gccOptions.c_str (),\r
base_tmp.c_str (),\r
junk_tmp.c_str (),\r
objectsMacro.c_str (),\r
linkDepsMacro.c_str () );\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
junk_tmp.c_str () );\r
string killAt = module.mangledSymbols ? "" : "--kill-at";\r
fprintf ( fMakefile,\r
temp_exp.c_str (),\r
killAt.c_str () );\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
base_tmp.c_str () );\r
fprintf ( fMakefile,\r
- "\t${gcc} %s %s -Wl,%s -o %s %s %s\n",\r
- GetLinkerMacro ( module ).c_str (),\r
+ "\t${gcc} %s %s -Wl,%s -o $@ %s %s\n",\r
+ GetLinkerMacro ().c_str (),\r
gccOptions.c_str (),\r
temp_exp.c_str (),\r
- target.c_str (),\r
objectsMacro.c_str (),\r
linkDepsMacro.c_str () );\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
temp_exp.c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_RSYM)\n" );\r
fprintf ( fMakefile,\r
- "\t${rsym} %s %s\n\n",\r
- target.c_str (),\r
- target.c_str () );\r
+ "\t$(Q)$(RSYM_TARGET) $@ $@\n\n" );\r
}\r
\r
\r
-MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( StaticLibrary,\r
- backend )\r
+MingwStaticLibraryModuleHandler::MingwStaticLibraryModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwStaticLibraryModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwStaticLibraryModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateStaticLibraryModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateStaticLibraryModuleTarget ();\r
}\r
\r
void\r
-MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwStaticLibraryModuleHandler::GenerateStaticLibraryModuleTarget ()\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
}\r
\r
\r
-MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( ObjectLibrary,\r
- backend )\r
+MingwObjectLibraryModuleHandler::MingwObjectLibraryModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwObjectLibraryModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwObjectLibraryModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateObjectLibraryModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateObjectLibraryModuleTarget ();\r
}\r
\r
void\r
-MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwObjectLibraryModuleHandler::GenerateObjectLibraryModuleTarget ()\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
}\r
\r
\r
-MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( KernelModeDLL,\r
- backend )\r
+MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwKernelModeDLLModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwKernelModeDLLModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateKernelModeDLLModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateKernelModeDLLModuleTarget ();\r
}\r
\r
void\r
-MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget (\r
- const Module& module,\r
- string_list& clean_files )\r
+MingwKernelModeDLLModuleHandler::GenerateKernelModeDLLModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ( );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
\r
string dependencies =\r
objectsMacro + " " + linkDepsMacro;\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
+ GenerateLinkerCommand ( dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
- libsMacro,\r
- clean_files );\r
+ libsMacro );\r
}\r
else\r
{\r
- fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- target.c_str ());\r
- fprintf ( fMakefile, "%s:\n",\r
- target.c_str ());\r
+ GeneratePhonyTarget();\r
}\r
}\r
\r
\r
-MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( KernelModeDriver,\r
- backend )\r
+MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwKernelModeDriverModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwKernelModeDriverModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateKernelModeDriverModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateKernelModeDriverModuleTarget ();\r
}\r
\r
\r
void\r
-MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget (\r
- const Module& module,\r
- string_list& clean_files )\r
+MingwKernelModeDriverModuleHandler::GenerateKernelModeDriverModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string target ( PassThruCacheDirectory( FixupTargetFilename ( module.GetPath () ) ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ();\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- string cflags ( "-D__NTDRIVER__" );\r
- GenerateMacrosAndTargets ( module,\r
- &cflags,\r
- NULL,\r
- clean_files );\r
+ GenerateRules ();\r
\r
- string dependencies =\r
- objectsMacro + " " + linkDepsMacro;\r
+ string dependencies = 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
+ GenerateLinkerCommand ( dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
- libsMacro,\r
- clean_files );\r
+ libsMacro );\r
}\r
else\r
{\r
- fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- target.c_str ());\r
- fprintf ( fMakefile, "%s:\n",\r
- target.c_str () );\r
+ GeneratePhonyTarget();\r
}\r
}\r
\r
\r
-MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( NativeDLL,\r
- backend )\r
+MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwNativeDLLModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwNativeDLLModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateNativeDLLModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateNativeDLLModuleTarget ();\r
}\r
\r
void\r
-MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwNativeDLLModuleHandler::GenerateNativeDLLModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ( );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
\r
string dependencies =\r
objectsMacro + " " + linkDepsMacro;\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
+ GenerateLinkerCommand ( dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
- libsMacro,\r
- clean_files );\r
+ libsMacro );\r
}\r
else\r
{\r
- fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- target.c_str ());\r
- fprintf ( fMakefile, "%s:\n\n",\r
- target.c_str ());\r
+ GeneratePhonyTarget();\r
}\r
}\r
\r
\r
-MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( NativeCUI,\r
- backend )\r
+MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwNativeCUIModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwNativeCUIModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateNativeCUIModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateNativeCUIModuleTarget ();\r
}\r
\r
void\r
-MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwNativeCUIModuleHandler::GenerateNativeCUIModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ( );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- string cflags ( "-D__NTAPP__" );\r
- GenerateMacrosAndTargets ( module,\r
- &cflags,\r
- NULL,\r
- clean_files );\r
+ GenerateRules ();\r
\r
string dependencies =\r
objectsMacro + " " + linkDepsMacro;\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
+ GenerateLinkerCommand ( dependencies,\r
"${gcc}",\r
linkerParameters,\r
objectsMacro,\r
- libsMacro,\r
- clean_files );\r
+ libsMacro );\r
}\r
else\r
{\r
- fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- target.c_str ());\r
- fprintf ( fMakefile, "%s:\n\n",\r
- target.c_str ());\r
+ GeneratePhonyTarget();\r
}\r
}\r
\r
\r
-MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( Win32DLL,\r
- backend )\r
+MingwWin32DLLModuleHandler::MingwWin32DLLModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwWin32DLLModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwWin32DLLModuleHandler::Process ()\r
{\r
- GenerateExtractWineDLLResourcesTarget ( module, clean_files );\r
- GeneratePreconditionDependencies ( module );\r
- GenerateWin32DLLModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateExtractWineDLLResourcesTarget ();\r
+ GenerateWin32DLLModuleTarget ();\r
}\r
\r
void\r
-MingwWin32DLLModuleHandler::GenerateExtractWineDLLResourcesTarget ( const Module& module, string_list& clean_files )\r
+MingwWin32DLLModuleHandler::GenerateExtractWineDLLResourcesTarget ()\r
{\r
fprintf ( fMakefile, ".PHONY: %s_extractresources\n\n",\r
module.name.c_str () );\r
}\r
\r
void\r
-MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwWin32DLLModuleHandler::GenerateWin32DLLModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ( );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
\r
- string dependencies =\r
- objectsMacro + " " + linkDepsMacro;\r
+ string dependencies = objectsMacro + " " + linkDepsMacro;\r
\r
string linker;\r
if ( module.cplusplus )\r
string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000 -mdll",\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
- GenerateLinkerCommand ( module,\r
- target,\r
- dependencies,\r
+ GenerateLinkerCommand ( dependencies,\r
linker,\r
linkerParameters,\r
objectsMacro,\r
- libsMacro,\r
- clean_files );\r
+ libsMacro );\r
}\r
else\r
{\r
- fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- target.c_str () );\r
- fprintf ( fMakefile, "%s:\n\n",\r
- target.c_str () );\r
+ GeneratePhonyTarget();\r
}\r
}\r
\r
\r
-MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( Win32CUI,\r
- backend )\r
+MingwWin32CUIModuleHandler::MingwWin32CUIModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwWin32CUIModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwWin32CUIModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateWin32CUIModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateWin32CUIModuleTarget ();\r
}\r
\r
void\r
-MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwWin32CUIModuleHandler::GenerateWin32CUIModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ( );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
\r
string dependencies =\r
objectsMacro + " " + linkDepsMacro;\r
string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
- GenerateLinkerCommand ( module,\r
- target,\r
- dependencies,\r
+ GenerateLinkerCommand ( dependencies,\r
linker,\r
linkerParameters,\r
objectsMacro,\r
- libsMacro,\r
- clean_files );\r
+ libsMacro );\r
}\r
else\r
{\r
- fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- target.c_str ());\r
- fprintf ( fMakefile, "%s:\n\n",\r
- target.c_str ());\r
+ GeneratePhonyTarget();\r
}\r
}\r
\r
\r
-MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( Win32GUI,\r
- backend )\r
+MingwWin32GUIModuleHandler::MingwWin32GUIModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwWin32GUIModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwWin32GUIModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateWin32GUIModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateWin32GUIModuleTarget ();\r
}\r
\r
void\r
-MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwWin32GUIModuleHandler::GenerateWin32GUIModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ( );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateImportLibraryTargetIfNeeded ( module, clean_files );\r
+ GenerateImportLibraryTargetIfNeeded ();\r
\r
if ( module.non_if_data.files.size () > 0 )\r
{\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
\r
string dependencies =\r
objectsMacro + " " + linkDepsMacro;\r
string linkerParameters = ssprintf ( "-Wl,--subsystem,windows -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",\r
module.entrypoint.c_str (),\r
module.baseaddress.c_str () );\r
- GenerateLinkerCommand ( module,\r
- target,\r
- dependencies,\r
+ GenerateLinkerCommand ( dependencies,\r
linker,\r
linkerParameters,\r
objectsMacro,\r
- libsMacro,\r
- clean_files );\r
+ libsMacro );\r
}\r
else\r
{\r
- fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- target.c_str ());\r
- fprintf ( fMakefile, "%s:\n\n",\r
- target.c_str ());\r
+ GeneratePhonyTarget();\r
}\r
}\r
\r
\r
-MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( BootLoader,\r
- backend )\r
+MingwBootLoaderModuleHandler::MingwBootLoaderModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwBootLoaderModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwBootLoaderModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateBootLoaderModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateBootLoaderModuleTarget ();\r
}\r
\r
void\r
-MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget (\r
- const Module& module,\r
- string_list& clean_files )\r
+MingwBootLoaderModuleHandler::GenerateBootLoaderModuleTarget ()\r
{\r
- static string ros_junk ( "$(ROS_TEMPORARY)" );\r
string targetName ( module.GetTargetName () );\r
- string target ( FixupTargetFilename ( module.GetPath () ) );\r
+ string targetMacro ( GetTargetMacro (module) );\r
string workingDirectory = GetWorkingDirectory ();\r
- string junk_tmp = ros_junk + module.name + ".junk.tmp";\r
+ string junk_tmp = ros_temp + module.name + ".junk.tmp";\r
CLEAN_FILE ( junk_tmp );\r
string objectsMacro = GetObjectsMacro ( module );\r
- string linkDepsMacro = GetLinkingDependenciesMacro ( module );\r
- string libsMacro = GetLibsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
\r
- GenerateMacrosAndTargets ( module, NULL, NULL, clean_files );\r
+ GenerateRules ();\r
\r
- fprintf ( fMakefile, "%s: %s %s\n",\r
- target.c_str (),\r
+ fprintf ( fMakefile, "%s: %s %s %s\n",\r
+ targetMacro.c_str (),\r
objectsMacro.c_str (),\r
- linkDepsMacro.c_str () );\r
+ linkDepsMacro.c_str (),\r
+ GetDirectory(GetTargetFilename(module,NULL)).c_str () );\r
\r
fprintf ( fMakefile, "\t$(ECHO_LD)\n" );\r
\r
fprintf ( fMakefile,\r
"\t${ld} %s -N -Ttext=0x8000 -o %s %s %s\n",\r
- GetLinkerMacro ( module ).c_str (),\r
+ GetLinkerMacro ().c_str (),\r
junk_tmp.c_str (),\r
objectsMacro.c_str (),\r
linkDepsMacro.c_str () );\r
fprintf ( fMakefile,\r
- "\t${objcopy} -O binary %s %s\n",\r
- junk_tmp.c_str (),\r
- target.c_str () );\r
+ "\t${objcopy} -O binary %s $@\n",\r
+ junk_tmp.c_str () );\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
junk_tmp.c_str () );\r
}\r
\r
\r
-MingwBootSectorModuleHandler::MingwBootSectorModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( BootSector,\r
- backend )\r
+MingwBootSectorModuleHandler::MingwBootSectorModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwBootSectorModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwBootSectorModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateBootSectorModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateBootSectorModuleTarget ();\r
}\r
\r
void\r
-MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwBootSectorModuleHandler::GenerateBootSectorModuleTarget ()\r
{\r
string objectsMacro = GetObjectsMacro ( module );\r
\r
- string* nasmflags = new string ( "-f bin" );\r
- GenerateMacrosAndTargets ( module,\r
- NULL,\r
- nasmflags,\r
- clean_files );\r
+ GenerateRules ();\r
\r
fprintf ( fMakefile, ".PHONY: %s\n\n",\r
- module.name.c_str ());\r
+ module.name.c_str ());\r
fprintf ( fMakefile,\r
"%s: %s\n",\r
module.name.c_str (),\r
}\r
\r
\r
-MingwIsoModuleHandler::MingwIsoModuleHandler ( MingwBackend* backend )\r
- : MingwModuleHandler ( Iso,\r
- backend )\r
+MingwIsoModuleHandler::MingwIsoModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
{\r
}\r
\r
void\r
-MingwIsoModuleHandler::Process ( const Module& module, string_list& clean_files )\r
+MingwIsoModuleHandler::Process ()\r
{\r
- GeneratePreconditionDependencies ( module );\r
- GenerateIsoModuleTarget ( module, clean_files );\r
- GenerateInvocations ( module );\r
+ GenerateIsoModuleTarget ();\r
}\r
\r
void\r
-MingwIsoModuleHandler::OutputBootstrapfileCopyCommands ( const string& bootcdDirectory,\r
- const Module& module )\r
+MingwIsoModuleHandler::OutputBootstrapfileCopyCommands (\r
+ const string& bootcdDirectory )\r
{\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
- string targetFilenameNoFixup = bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd;\r
- string targetFilename = PassThruCacheDirectory ( FixupTargetFilename ( targetFilenameNoFixup ) );\r
+ string targetFilenameNoFixup ( bootcdDirectory + SSEP + m.bootstrap->base + SSEP + m.bootstrap->nameoncd );\r
+ string targetFilename ( GetTargetMacro ( module ) );\r
fprintf ( fMakefile,\r
"\t${cp} %s %s\n",\r
m.GetPath ().c_str (),\r
}\r
\r
void\r
-MingwIsoModuleHandler::OutputCdfileCopyCommands ( const string& bootcdDirectory,\r
- const Module& module )\r
+MingwIsoModuleHandler::OutputCdfileCopyCommands (\r
+ const string& bootcdDirectory )\r
{\r
for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
{\r
const CDFile& cdfile = *module.project.cdfiles[i];\r
string targetFilenameNoFixup = bootcdDirectory + SSEP + cdfile.base + SSEP + cdfile.nameoncd;\r
- string targetFilename = PassThruCacheDirectory ( FixupTargetFilename ( targetFilenameNoFixup ) );\r
+ string targetFilename = GetTargetMacro(module);\r
fprintf ( fMakefile,\r
"\t${cp} %s %s\n",\r
cdfile.GetPath ().c_str (),\r
}\r
\r
string\r
-MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string& bootcdDirectory,\r
- const Module& module )\r
+MingwIsoModuleHandler::GetBootstrapCdDirectories ( const string& bootcdDirectory )\r
{\r
string directories;\r
for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
const Module& m = *module.project.modules[i];\r
if ( m.bootstrap != NULL )\r
{\r
- string targetDirecctory = bootcdDirectory + SSEP + m.bootstrap->base;\r
+ string targetDirectory ( bootcdDirectory + SSEP + m.bootstrap->base );\r
if ( directories.size () > 0 )\r
directories += " ";\r
- directories += PassThruCacheDirectory ( FixupTargetFilename ( targetDirecctory ) );\r
+ directories += PassThruCacheDirectory (\r
+ FixupTargetFilename ( targetDirectory ),\r
+ true );\r
}\r
}\r
return directories;\r
}\r
\r
string\r
-MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string& bootcdDirectory,\r
- const Module& module )\r
+MingwIsoModuleHandler::GetNonModuleCdDirectories ( const string& bootcdDirectory )\r
{\r
string directories;\r
for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
{\r
const CDFile& cdfile = *module.project.cdfiles[i];\r
- string targetDirecctory = bootcdDirectory + SSEP + cdfile.base;\r
+ string targetDirectory ( bootcdDirectory + SSEP + cdfile.base );\r
if ( directories.size () > 0 )\r
directories += " ";\r
- directories += PassThruCacheDirectory ( FixupTargetFilename ( targetDirecctory ) );\r
+ directories += PassThruCacheDirectory (\r
+ FixupTargetFilename ( targetDirectory ),\r
+ true );\r
}\r
return directories;\r
}\r
\r
string\r
-MingwIsoModuleHandler::GetCdDirectories ( const string& bootcdDirectory,\r
- const Module& module )\r
+MingwIsoModuleHandler::GetCdDirectories ( const string& bootcdDirectory )\r
{\r
- string directories = GetBootstrapCdDirectories ( bootcdDirectory,\r
- module );\r
- directories += " " + GetNonModuleCdDirectories ( bootcdDirectory,\r
- module );\r
+ string directories = GetBootstrapCdDirectories ( bootcdDirectory );\r
+ directories += " " + GetNonModuleCdDirectories ( bootcdDirectory );\r
return directories;\r
}\r
\r
void\r
MingwIsoModuleHandler::GetBootstrapCdFiles (\r
- vector<string>& out,\r
- const Module& module ) const\r
+ vector<string>& out ) const\r
{\r
for ( size_t i = 0; i < module.project.modules.size (); i++ )\r
{\r
\r
void\r
MingwIsoModuleHandler::GetNonModuleCdFiles (\r
- vector<string>& out,\r
- const Module& module ) const\r
+ vector<string>& out ) const\r
{\r
for ( size_t i = 0; i < module.project.cdfiles.size (); i++ )\r
{\r
\r
void\r
MingwIsoModuleHandler::GetCdFiles (\r
- vector<string>& out,\r
- const Module& module ) const\r
+ vector<string>& out ) const\r
{\r
- GetBootstrapCdFiles ( out, module );\r
- GetNonModuleCdFiles ( out, module );\r
+ GetBootstrapCdFiles ( out );\r
+ GetNonModuleCdFiles ( out );\r
}\r
\r
void\r
-MingwIsoModuleHandler::GenerateIsoModuleTarget ( const Module& module, string_list& clean_files )\r
+MingwIsoModuleHandler::GenerateIsoModuleTarget ()\r
{\r
string bootcdDirectory = "cd";\r
string isoboot = FixupTargetFilename ( "boot/freeldr/bootsect/isoboot.o" );\r
string bootcdReactosNoFixup = bootcdDirectory + "/reactos";\r
- string bootcdReactos = FixupTargetFilename ( bootcdReactosNoFixup );\r
- PassThruCacheDirectory ( bootcdReactos + SSEP );\r
- string reactosInf = FixupTargetFilename ( bootcdReactosNoFixup + "/reactos.inf" );\r
+ string bootcdReactos = PassThruCacheDirectory (\r
+ FixupTargetFilename ( bootcdReactosNoFixup ),\r
+ true );\r
+ CLEAN_FILE ( bootcdReactos );\r
+ string reactosInf = ros_temp + FixupTargetFilename ( bootcdReactosNoFixup + "/reactos.inf" );\r
string reactosDff = NormalizeFilename ( "bootdata/packages/reactos.dff" );\r
- string cdDirectories = GetCdDirectories ( bootcdDirectory,\r
- module );\r
+ string cdDirectories = GetCdDirectories ( bootcdDirectory );\r
vector<string> vCdFiles;\r
- GetCdFiles ( vCdFiles, module );\r
+ GetCdFiles ( vCdFiles );\r
string cdFiles = v2s ( vCdFiles, 5 );\r
\r
fprintf ( fMakefile, ".PHONY: %s\n\n",\r
module.name.c_str ());\r
fprintf ( fMakefile,\r
- "%s: all %s %s %s %s ${CABMAN_TARGET} ${CDMAKE_TARGET}\n",\r
+ "%s: all %s %s %s %s $(CABMAN_TARGET) $(CDMAKE_TARGET)\n",\r
module.name.c_str (),\r
isoboot.c_str (),\r
- PassThruCacheDirectory ( bootcdReactos ).c_str (),\r
+ bootcdReactos.c_str (),\r
cdDirectories.c_str (),\r
cdFiles.c_str () );\r
fprintf ( fMakefile, "\t$(ECHO_CABMAN)\n" );\r
fprintf ( fMakefile,\r
- "\t${cabman} -C %s -L %s -I\n",\r
+ "\t$(Q)$(CABMAN_TARGET) -C %s -L %s -I\n",\r
reactosDff.c_str (),\r
bootcdReactos.c_str () );\r
fprintf ( fMakefile,\r
- "\t${cabman} -C %s -RC %s -L %s -N -P $(OUTPUT)\n",\r
+ "\t$(Q)$(CABMAN_TARGET) -C %s -RC %s -L %s -N -P $(OUTPUT)\n",\r
reactosDff.c_str (),\r
reactosInf.c_str (),\r
bootcdReactos.c_str ());\r
fprintf ( fMakefile,\r
- "\t-@${rm} %s\n",\r
+ "\t-@${rm} %s 2>$(NUL)\n",\r
reactosInf.c_str () );\r
- OutputBootstrapfileCopyCommands ( bootcdDirectory,\r
- module );\r
- OutputCdfileCopyCommands ( bootcdDirectory,\r
- module );\r
+ OutputBootstrapfileCopyCommands ( bootcdDirectory );\r
+ OutputCdfileCopyCommands ( bootcdDirectory );\r
fprintf ( fMakefile, "\t$(ECHO_CDMAKE)\n" );\r
fprintf ( fMakefile,\r
- "\t${cdmake} -v -m -b %s %s REACTOS ReactOS.iso\n",\r
+ "\t$(Q)$(CDMAKE_TARGET) -v -m -b %s %s REACTOS ReactOS.iso\n",\r
isoboot.c_str (),\r
bootcdDirectory.c_str () );\r
fprintf ( fMakefile,\r
"\n" );\r
}\r
+\r
+\r
+MingwTestModuleHandler::MingwTestModuleHandler (\r
+ const Module& module_ )\r
+\r
+ : MingwModuleHandler ( module_ )\r
+{\r
+}\r
+\r
+void\r
+MingwTestModuleHandler::Process ()\r
+{\r
+ GenerateTestModuleTarget ();\r
+}\r
+\r
+void\r
+MingwTestModuleHandler::GenerateTestModuleTarget ()\r
+{\r
+ string targetMacro ( GetTargetMacro (module) );\r
+ string workingDirectory = GetWorkingDirectory ( );\r
+ string objectsMacro = GetObjectsMacro ( module );\r
+ string linkDepsMacro = GetLinkingDependenciesMacro ();\r
+ string libsMacro = GetLibsMacro ();\r
+\r
+ GenerateImportLibraryTargetIfNeeded ();\r
+\r
+ if ( module.non_if_data.files.size () > 0 )\r
+ {\r
+ GenerateRules ();\r
+\r
+ string dependencies = objectsMacro + " " + linkDepsMacro;\r
+\r
+ string linker;\r
+ if ( module.cplusplus )\r
+ linker = "${gpp}";\r
+ else\r
+ linker = "${gcc}";\r
+\r
+ string linkerParameters = ssprintf ( "-Wl,--subsystem,console -Wl,--entry,%s -Wl,--image-base,%s -Wl,--file-alignment,0x1000 -Wl,--section-alignment,0x1000",\r
+ module.entrypoint.c_str (),\r
+ module.baseaddress.c_str () );\r
+ GenerateLinkerCommand ( dependencies,\r
+ linker,\r
+ linkerParameters,\r
+ objectsMacro,\r
+ libsMacro );\r
+ }\r
+ else\r
+ {\r
+ GeneratePhonyTarget();\r
+ }\r
+}\r