Changes in building scripts (problems with spaces in DOS filenames)

git-svn-id: svn://kolibrios.org@216 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
victor 2006-11-21 16:27:21 +00:00
parent 1391dd1d1d
commit e1c5ec4c11
3 changed files with 27 additions and 13 deletions

View File

@ -0,0 +1,2 @@
cscript compile.js build
pause

View File

@ -1 +1,2 @@
compile.js clean cscript cscript compile.js clean
pause

View File

@ -3,7 +3,18 @@ ForWriting = 2
ForAppending = 8 ForAppending = 8
var fso = new ActiveXObject("Scripting.FileSystemObject"); var fso = new ActiveXObject("Scripting.FileSystemObject");
var wsh = new ActiveXObject("WScript.Shell"); var wsh = new ActiveXObject("WScript.Shell");
_DEBUG = true;
function _debug(mes)
{
if(_DEBUG != true) return mes;
try{var file = fso.OpenTextFile("debug_info.txt", ForAppending);}
catch(e){var file = fso.CreateTextFile("debug_info.txt", true);}
file.Write(mes);
file.close();
return mes;
}
function alert(mes){WScript.Echo(mes);return mes} function alert(mes){WScript.Echo(mes);return mes}
function debug(obj){for(key in obj)alert('['+key+']="'+obj[key]+'"')} function debug(obj){for(key in obj)alert('['+key+']="'+obj[key]+'"')}
function getFileContent(filename){ function getFileContent(filename){
var file = fso.OpenTextFile(filename, ForReading); var file = fso.OpenTextFile(filename, ForReading);
@ -61,7 +72,7 @@ function Project(filename){
var objname = filename.replace(/.\w{1,3}$/,".o"); var objname = filename.replace(/.\w{1,3}$/,".o");
objList.push(objname); objList.push(objname);
if(fso.FileExists(objname)) return; if(fso.FileExists(objname)) return;
wsh.Run(this.fasm+' "'+filename+'" "'+objname+'"',0,true); wsh.Run(_debug('"'+this.fasm+'" "'+filename+'" "'+objname+'"\n'),0,true);
} }
this.compile_c = function(filename){ this.compile_c = function(filename){
var objname = filename.replace(/.\w{1,3}$/,".o"); var objname = filename.replace(/.\w{1,3}$/,".o");
@ -70,15 +81,15 @@ function Project(filename){
var asmname = filename.replace(/.\w{1,3}$/,".s"); var asmname = filename.replace(/.\w{1,3}$/,".s");
var command = ""; var command = "";
if(!fso.FileExists(asmname)){ if(!fso.FileExists(asmname)){
command = this.gccpath +"\\"+ this.gccexe + " -nostdinc"; command = '"'+this.gccpath +"\\"+ this.gccexe + "\" -nostdinc";
if(this.include) command += " -I .\\include"; if(this.include) command += " -I .\\include";
command +=" -DGNUC" +' "'+filename + '" -o "' + asmname + '"'; command +=" -DGNUC" +' "'+filename + '" -o "' + asmname + '"\n';
wsh.Run("cmd.exe /c "+command, 0, true); wsh.Run(_debug("cmd.exe /c "+command), 0, true);
} }
command = this.gccpath +"\\"+ this.asexe +' "'+ asmname +'" -o "'+ objname +'"'; command = '"'+this.gccpath +"\\"+ this.asexe +'" "'+ asmname +'" -o "'+ objname +'"\n';
wsh.Run("cmd.exe /c "+command, 0, true); wsh.Run(_debug("cmd.exe /c "+command), 0, true);
command = this.gccpath +"\\"+ this.objcopyexe +' -O elf32-i386 --remove-leading-char "'+ objname +'"'; command = '"'+this.gccpath +"\\"+ this.objcopyexe +'" -O elf32-i386 --remove-leading-char "'+ objname +'"\n';
wsh.Run("cmd.exe /c "+command, 0, true); wsh.Run(_debug("cmd.exe /c "+command), 0, true);
} }
this.build = function(){ this.build = function(){
var fl = new Enumerator(this.files); var fl = new Enumerator(this.files);
@ -100,10 +111,10 @@ function Project(filename){
file.Close(); file.Close();
wsh.Run(this.gccpath+"\\ar.exe -M < OBJLIST.TXT", 0, true);*/ wsh.Run(this.gccpath+"\\ar.exe -M < OBJLIST.TXT", 0, true);*/
var ar = wsh.Exec(this.gccpath+"\\ar.exe -M") var ar = wsh.Exec(_debug(this.gccpath+"\\ar.exe -M\n"))
ar.StdIn.Write("CREATE "+this.dstpath+'\\'+this.name+".a\r\n"); ar.StdIn.Write(_debug("CREATE "+this.dstpath+'\\'+this.name+".a\r\n"));
for (; !fl.atEnd(); fl.moveNext()){ar.StdIn.Write("ADDMOD "+fl.item()+"\r\n");} for (; !fl.atEnd(); fl.moveNext()){ar.StdIn.Write(_debug("ADDMOD "+fl.item()+"\r\n"));}
ar.StdIn.Write("SAVE\r\t"); ar.StdIn.Write(_debug("SAVE\r\n"));
} }
this.rebuild = function(){ this.rebuild = function(){
this.clean(); this.clean();