Subversion Repositories Kolibri OS

Rev

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

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