<file>depends.c</file>\r
</module>\r
</directory>\r
+ <directory name="lib">\r
+ <xi:include href="lib/directory.xml" />\r
+ </directory>\r
<directory name="ntoskrnl">\r
<xi:include href="ntoskrnl/module.xml" />\r
</directory>\r
--- /dev/null
+<directory name="kjs">\r
+ <xi:include href="kjs/module.xml" />\r
+</directory>\r
--- /dev/null
+<module name="kjs" type="staticlibrary">\r
+ <include>.</include>\r
+ <include>./src</include>\r
+ <include>./include</include>\r
+ <directory name="ksrc">\r
+ <file>setjmp.S</file>\r
+ <file>longjmp.S</file>\r
+ <file>alloc.c</file>\r
+ <file>bc.c</file>\r
+ <file>b_core.c</file>\r
+ <file>b_file.c</file>\r
+ <file>b_func.c</file>\r
+ <file>b_regexp.c</file>\r
+ <file>b_system.c</file>\r
+ <file>compat.c</file>\r
+ <file>debug.c</file>\r
+ <file>iostream.c</file>\r
+ <file>js.c</file>\r
+ <file>kjs.c</file>\r
+ <file>mrgsort.c</file>\r
+ <file>object.c</file>\r
+ <file>regex.c</file>\r
+ <file>vm.c</file>\r
+ <file>vmjumps.c</file>\r
+ <file>vmswitch.c</file>\r
+ <file>vmswt0.c</file>\r
+ <file>longjmp.c</file>\r
+ </directory>\r
+ <directory name="src">\r
+ <file>b_array.c</file>\r
+ <file>b_bool.c</file>\r
+ <file>b_object.c</file>\r
+ <file>b_number.c</file>\r
+ <file>b_string.c</file>\r
+ <file>b_vm.c</file>\r
+ <file>compiler.c</file>\r
+ <file>crc32.c</file>\r
+ <file>dl_dummy.c</file>\r
+ <file>heap.c</file>\r
+ <file>utils.c</file>\r
+ </directory>\r
+</module>\r
void\r
MingwBackend::GenerateGlobalVariables ()\r
{\r
+ fprintf ( fMakefile, "rm = del /y\n" );\r
fprintf ( fMakefile, "gcc = gcc\n" );\r
fprintf ( fMakefile, "ld = ld\n" );\r
fprintf ( fMakefile, "ar = ar\n" );\r
+ fprintf ( fMakefile, "dlltool = dlltool\n" );\r
fprintf ( fMakefile, "\n" );\r
}\r
\r
{\r
}\r
\r
+string\r
+MingwModuleHandler::GetWorkingDirectory ()\r
+{\r
+ return ".";\r
+}\r
+\r
string\r
MingwModuleHandler::ReplaceExtension ( string filename,\r
string newExtension )\r
}\r
\r
string\r
-MingwModuleHandler::GetModuleLibraryDependencies ( Module& module )\r
+MingwModuleHandler::GetImportLibraryDependencies ( Module& module )\r
{\r
if ( module.libraries.size () == 0 )\r
return "";\r
{\r
if ( dependencies.size () > 0 )\r
dependencies += " ";\r
- dependencies += module.libraries[i]->name;\r
+ Module* importedModule = module.project->LocateModule ( module.libraries[i]->name );\r
+ assert ( importedModule != NULL );\r
+ dependencies += importedModule->GetPath ().c_str ();\r
}\r
return dependencies;\r
}\r
string objectFilename = GetObjectFilename ( sourceFilename );\r
fprintf ( fMakefile,\r
"%s: %s\n",\r
- sourceFilename.c_str (),\r
- objectFilename.c_str() );\r
+ objectFilename.c_str (),\r
+ sourceFilename.c_str() );\r
fprintf ( fMakefile,\r
"\t${gcc} -c %s -o %s\n",\r
sourceFilename.c_str (),\r
void\r
MingwKernelModuleHandler::GenerateKernelModuleTarget ( Module& module )\r
{\r
- fprintf ( fMakefile, "%s: %s\n",\r
+ string workingDirectory = GetWorkingDirectory ( );\r
+ string archiveFilename = GetModuleArchiveFilename ( module );\r
+ string importLibraryDependencies = GetImportLibraryDependencies ( module );\r
+ fprintf ( fMakefile, "%s: %s %s\n",\r
+ module.GetPath ().c_str (),\r
+ archiveFilename.c_str (),\r
+ importLibraryDependencies.c_str () );\r
+ fprintf ( fMakefile,\r
+ "\t${gcc} -Wl,--base-file,%s/base.tmp -o %s/junk.tmp %s %s\n",\r
+ workingDirectory.c_str (),\r
+ workingDirectory.c_str (),\r
+ archiveFilename.c_str (),\r
+ importLibraryDependencies.c_str () );\r
+ fprintf ( fMakefile,\r
+ "\t${rm} %s/junk.tmp\n",\r
+ workingDirectory.c_str () );\r
+ fprintf ( fMakefile,\r
+ "\t${dlltool} --dllname %s --base-file %s/base.tmp --output-exp %s/temp.exp --kill-at\n",\r
module.GetPath ().c_str (),\r
- GetModuleLibraryDependencies ( module ).c_str () );\r
- fprintf ( fMakefile, "\t\n\n" );\r
+ workingDirectory.c_str (),\r
+ workingDirectory.c_str ());\r
+ fprintf ( fMakefile,\r
+ "\t${rm} %s/base.tmp\n",\r
+ workingDirectory.c_str () );\r
+ fprintf ( fMakefile,\r
+ "\t${ld} -Wl,%s/temp.exp -o %s %s %s\n",\r
+ workingDirectory.c_str (),\r
+ module.GetPath ().c_str (),\r
+ archiveFilename.c_str (),\r
+ importLibraryDependencies.c_str () );\r
+ fprintf ( fMakefile,\r
+ "\t${rm} %s/temp.exp\n",\r
+ workingDirectory.c_str () );\r
+ \r
GenerateArchiveTarget ( module );\r
GenerateObjectFileTargets ( module );\r
}\r
virtual bool CanHandleModule ( Module& module ) = 0;\r
virtual void Process ( Module& module ) = 0;\r
protected:\r
+ std::string MingwModuleHandler::GetWorkingDirectory ();\r
std::string ReplaceExtension ( std::string filename,\r
std::string newExtension );\r
std::string GetModuleArchiveFilename ( Module& module );\r
- std::string GetModuleLibraryDependencies ( Module& module );\r
+ std::string GetImportLibraryDependencies ( Module& module );\r
std::string GetSourceFilenames ( Module& module );\r
std::string GetObjectFilename ( std::string sourceFilename );\r
std::string GetObjectFilenames ( Module& module );\r
}\r
#endif\r
\r
-Module::Module ( const XMLElement& moduleNode,\r
+Module::Module ( Project* project,\r
+ const XMLElement& moduleNode,\r
const string& moduleName,\r
const string& modulePath )\r
- : node(moduleNode),\r
+ : project(project),\r
+ node(moduleNode),\r
name(moduleName),\r
path(modulePath)\r
{\r
{\r
if ( attribute.value == "buildtool" )\r
return BuildTool;\r
+ if ( attribute.value == "staticlibrary" )\r
+ return StaticLibrary;\r
if ( attribute.value == "kernelmodedll" )\r
return KernelModeDLL;\r
throw InvalidAttributeValueException ( attribute.name,\r
{\r
att = e.GetAttribute ( "name", true );\r
assert(att);\r
- Module* module = new Module ( e, att->value, path );\r
+ Module* module = new Module ( this, e, att->value, path );\r
modules.push_back ( module );\r
module->ProcessXML ( e, path );\r
return;\r
for ( size_t i = 0; i < e.subElements.size (); i++ )\r
ProcessXML ( *e.subElements[i], subpath );\r
}\r
+\r
+Module*\r
+Project::LocateModule ( string name )\r
+{\r
+ for ( size_t i = 0; i < modules.size (); i++ )\r
+ {\r
+ if (modules[i]->name == name)\r
+ return modules[i];\r
+ }\r
+\r
+ return NULL;\r
+}\r
~Project ();\r
void ProcessXML ( const XMLElement& e,\r
const std::string& path );\r
+ Module* LocateModule ( std::string name );\r
private:\r
void ReadXml ();\r
XMLFile xmlfile;\r
enum ModuleType\r
{\r
BuildTool,\r
+ StaticLibrary,\r
KernelModeDLL\r
};\r
\r
class Module\r
{\r
public:\r
+ Project* project;\r
const XMLElement& node;\r
std::string name;\r
std::string path;\r
std::vector<File*> files;\r
std::vector<Library*> libraries;\r
\r
- Module ( const XMLElement& moduleNode,\r
+ Module ( Project* project,\r
+ const XMLElement& moduleNode,\r
const std::string& moduleName,\r
const std::string& modulePath );\r
~Module();\r