Subversion Repositories Kolibri OS

Rev

Rev 6424 | Blame | Last modification | View Log | Download | RSS feed

  1. @echo off
  2. echo ####################################################
  3. echo #           Melibc builder                         #
  4. echo #  usage: build [clean]                            #
  5. echo ####################################################
  6. rem #### CONFIG SECTION ####
  7. set LIBNAME=libck.a
  8. set INCLUDE=include
  9. set CC=kos32-tcc  
  10. set CFLAGS=-c -nostdinc -DGNUC -I"%cd%\%INCLUDE%" -Wall
  11. set AR=kos32-ar
  12. set ASM=fasm
  13. set dirs=stdio memory kolibrisys string stdlib math
  14. rem #### END OF CONFIG SECTION ####
  15.  
  16. set objs=
  17. set target=%1
  18. if not "%1"=="clean" set target=all
  19.  
  20. set INCLUDE="%cd%"
  21. call :Target_%target%
  22.  
  23. if ERRORLEVEL 0 goto Exit_OK
  24.  
  25. echo Probably at runing has been created error
  26. echo For help send a report...
  27. pause
  28. goto :eof
  29.  
  30. :Compile_C
  31. echo compile .c %1
  32.    %CC% %CFLAGS% %1 -o "%~dpn1.o"
  33.    if not %errorlevel%==0 goto Error_Failed
  34.    set objs=%objs% "%~dpn1.o"
  35. goto :eof
  36.  
  37. :Compile_Asm
  38. echo compile .asm %1
  39.    %ASM% %1 "%~dpn1.o"
  40.    if not %errorlevel%==0 goto Error_Failed
  41.    set objs=%objs% "%~dpn1.o"
  42. goto :eof
  43.  
  44. :Target_clean
  45.    echo cleaning ...
  46.    for %%a in (%dirs%) do del /Q "%%a\*.o"
  47. goto :Exit_OK
  48.  
  49. :Target_all
  50.    echo building all ...
  51.    for %%a in (%dirs%) do (
  52.       for %%f in ("%%a\*.asm") do call :Compile_Asm "%%f"
  53.       for %%f in ("%%a\*.c") do call :Compile_C "%%f"
  54.    )
  55.    echo calling AR
  56.    %AR% -ru %LIBNAME% %objs%
  57.    if not %errorlevel%==0 goto Error_Failed
  58. goto Exit_OK
  59.  
  60. :Error_Failed
  61. echo error: execution failed
  62. pause
  63. exit 1
  64.  
  65. :Exit_OK
  66. echo ####################################################
  67. echo # All operations has been done...                  #
  68. echo # For cleaning run this script with param " clean" #
  69. echo ####################################################
  70. pause
  71. exit 0