Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

  1. var fso=new ActiveXObject("Scripting.FileSystemObject");
  2. var wsh=WScript.CreateObject("WScript.Shell");
  3. var curpath=".";
  4. var gccpath="c:\\program files\\MinGW\\MinGW\\bin\\";
  5. //var gccpath="cmd.exe /c ";
  6. var gccexe="\""+gccpath+"cc1.exe"+"\" ";
  7. var asexe="\""+gccpath+"as.exe"+"\" ";
  8. var objcopyexe="\""+gccpath+"objcopy.exe"+"\" ";
  9. //var gccexe=gccpath+"cc1.exe" ;
  10. //var asexe=gccpath+"as.exe";
  11. var scriptline="CREATE melibc.a\r\n";
  12.  
  13. curpath=".\\string\\";
  14. compileasm("memmove");
  15. compileasm("memset");
  16. curpath=".\\mesys\\";
  17. compileasm("backgr");
  18. compileasm("button");
  19. compileasm("clock");
  20. compileasm("date");
  21. compileasm("debug_board");
  22. compileasm("delay");
  23. compileasm("dga");
  24. compileasm("draw_bar");
  25. compileasm("draw_image");
  26. compileasm("draw_window");
  27. compileasm("event");
  28. compileasm("exit");
  29. compileasm("file_58");
  30. compileasm("ipc");
  31. compileasm("irq");
  32. compileasm("keyboard");
  33. compileasm("line");
  34. compileasm("midi");
  35. compileasm("pci");
  36. compileasm("pixel");
  37. compileasm("process");
  38. compileasm("screen");
  39. compileasm("sound");
  40. compileasm("thread");
  41. compileasm("window_redraw");
  42. compileasm("write_text");
  43. curpath=".\\mem\\";
  44. compileasm("memalloc");
  45. curpath=".\\mesys\\";
  46. compilec("debug_board_");
  47. curpath=".\\string\\";
  48. compilec("memchr");
  49. compilec("memcmp");
  50. compilec("strcat");
  51. compilec("strchr");
  52. compilec("strcmp");
  53. compilec("strcoll");
  54. compilec("strcpy");
  55. compilec("strcspn");
  56. compilec("strdup");
  57. compilec("strerror");
  58. compilec("strlen");
  59. compilec("strnbrk");
  60. compilec("strncat");
  61. compilec("strncmp");
  62. compilec("strncpy");
  63. compilec("strrchr");
  64. compilec("strspn");
  65. compilec("strstr");
  66. compilec("strtok");
  67. compilec("strxfrm");
  68. curpath=".\\file\\";
  69. compilec("fclose");
  70. compilec("fopen");
  71. compilec("feof");
  72. compilec("fflush");
  73. compilec("fgetc");
  74. compilec("fgetpos");
  75. compilec("fsetpos");
  76. compilec("fputc");
  77. compilec("fread");
  78. compilec("fwrite");
  79. compilec("fseek");
  80. compilec("ftell");
  81. compilec("rewind");
  82. compilec("fprintf");
  83. compilec("fscanf");
  84. compilec("ungetc");
  85. curpath=".\\start\\";
  86. compileasm("start");
  87. //linking
  88. scriptline+="SAVE\r\n";
  89. linko();
  90. function compileasm(filename)
  91. {
  92.   wsh.Run("fasm.exe "+quote(curpath+filename+".asm")+
  93.     " "+quote(curpath+filename+".o"),0,true);
  94.   addo(filename);
  95. }
  96. function compilec(filename)
  97. {
  98.   wsh.Run(gccexe+"-nostdinc -I .\\include -DGNUC " + quote(curpath + filename + ".c")+
  99.     " -o " + quote(curpath + filename + ".s"),0,true);
  100.   wsh.Run(asexe+quote(curpath+filename+".s")+" -o "+quote(curpath+filename+".o"),0,true);
  101.   wsh.Run(objcopyexe+" -O elf32-i386 --remove-leading-char "+quote(curpath+filename+".o"),0,true);
  102.   addo(filename);
  103. }
  104. function addo(filename)
  105. {
  106.   scriptline+="ADDMOD "+curpath+filename+".o\r\n";
  107. }
  108. function linko()
  109. {
  110.   //fso.DeleteFile(".\\melibc.a");
  111.   var file=fso.OpenTextFile("./script.txt",2,true);
  112.   file.Write(scriptline);
  113.   wsh.Run("cmd.exe /c ar.exe -M < ./script.txt",4,true);
  114. }
  115. function quote(name)
  116. {
  117.   return "\""+name+"\"";
  118. }