Guest User

Untitled

a guest
Mar 19th, 2015
125
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo OFF
  2. mkdir bin\
  3. mkdir bin\libgdcc\
  4. mkdir acs\
  5. cls
  6. color 7
  7. setlocal EnableDelayedExpansion
  8. echo --- Begin Build ---
  9. set/a BUILT_FILES=0
  10. set/a SKIPPED_FILES=0
  11. set OUTFILE=main
  12. set GDCC=GDCC
  13. set PATH=%PATH%;%GDCC%
  14. set CFLAGS=--bc-target=ZDoom
  15. set CC=gdcc-cc
  16. set AS=gdcc-as
  17. set LD=gdcc-ld
  18.  
  19. if "%1" == "clean" (
  20.   goto make.clean
  21. ) else (
  22.   if "%1" == "clean-all" (
  23.     goto make.cleanall
  24.   )
  25. )
  26.  
  27. goto make.all
  28.  
  29. :make.clean
  30. del bin\*.ir acs\*.bin
  31. goto end
  32.  
  33. :make.cleanall
  34. del bin\*.ir bin\libgdcc\*.ir acs\*.bin
  35. goto end
  36.  
  37. :make.all
  38. :make.libGDCC-ZDACS-asm
  39. set TO_BUILD=bin\libgdcc\ZDACS-asm.ir
  40. set FILES=%GDCC%\lib\src\libGDCC\ZDACS\*.asm
  41. set EXECUTABLE=%AS%
  42. set BUILD_RETURN=make.libGDCC-c
  43. goto build
  44.  
  45. :make.libGDCC-c
  46. set TO_BUILD=bin\libgdcc\c.ir
  47. set FILES=%GDCC%\lib\src\libGDCC\*.c
  48. set EXECUTABLE=%CC%
  49. set BUILD_RETURN=make.libGDCC
  50. goto build
  51.  
  52. :make.libGDCC
  53. set TO_BUILD=bin\libgdcc\libGDCC.ir
  54. set FILES=bin\libgdcc\*.ir
  55. set EXECUTABLE=%LD%
  56. set BUILD_RETURN=make.libc
  57. set CFLAGS1=-c
  58. goto build
  59.  
  60. :make.libc
  61. set TO_BUILD=bin\libgdcc\libc.ir
  62. set FILES=%GDCC%\lib\src\libc\*.c
  63. set EXECUTABLE=%CC%
  64. set BUILD_RETURN=make.ir
  65. goto build
  66.  
  67. :make.ir
  68. set TO_BUILD=bin\%OUTFILE%.ir
  69. set FILES=src\*.c
  70. set EXECUTABLE=%CC%
  71. set BUILD_RETURN=make.bin
  72. set ALWAYS_REBUILD=YES
  73. set CFLAGS1=-iinc
  74. goto build
  75.  
  76. :make.bin
  77. set TO_BUILD=acs\%OUTFILE%.bin
  78. set FILES=bin\*.ir bin\libgdcc\*.ir
  79. set EXECUTABLE=%LD%
  80. set BUILD_RETURN=end
  81. set ALWAYS_REBUILD=YES
  82. goto build
  83.  
  84. :build.compile
  85. echo --- Building !TO_BUILD! ---
  86. set/a BUILT_FILES=%BUILT_FILES% + 1
  87. !EXECUTABLE! !CFLAGS1! !CFLAGS! -o !TO_BUILD! !FILES!
  88. echo !EXECUTABLE! !CFLAGS1! !CFLAGS! -o !TO_BUILD! !FILES!
  89.  
  90. goto build.finish
  91.  
  92. :build
  93. if "!ALWAYS_REBUILD!" == "" (
  94.   if not exist !TO_BUILD! (
  95.     goto build.compile
  96.   ) else (
  97.     echo --- Already built !TO_BUILD!, skipping. ---
  98.     set/a SKIPPED_FILES=%SKIPPED_FILES% + 1
  99.   )
  100. ) else (
  101.   goto build.compile
  102. )
  103.  
  104. :build.finish
  105. set CFLAGS1=
  106. set LOGFILE=
  107.  
  108. goto !BUILD_RETURN!
  109.  
  110. :end
  111. echo --- Finished. %BUILT_FILES% built, and %SKIPPED_FILES% skipped. ---
  112. echo --- Press any key to exit. ---
  113. endlocal
  114. pause>nul
RAW Paste Data