Subversion Repositories Kolibri OS

Rev

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

  1. @echo off
  2. @rem ----------------------------------------------------
  3. @rem batch file to build tcc using mingw gcc
  4. @rem ----------------------------------------------------
  5.  
  6. @set /p VERSION= < ..\VERSION
  7. ::echo>..\config.h #define TCC_VERSION "%VERSION%"
  8. ::echo>>..\config.h #define CONFIG_TCC_STATIC
  9.  
  10. @if _%1_==_AMD64_ shift /1 && goto x86_64
  11. @if _%1_==_x64_ shift /1 && goto x86_64
  12.  
  13. @set target=-DTCC_TARGET_MEOS -DTCC_TARGET_I386
  14. @set CC=gcc -Os -s -fno-strict-aliasing -Wno-incompatible-pointer-types
  15. @if _%1_==_debug_ set CC=gcc -g -ggdb
  16. @set P=32
  17. @goto tools
  18.  
  19. :x86_64
  20. ::@set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
  21. ::@set CC=x86_64-w64-mingw32-gcc -Os -s -fno-strict-aliasing -Wno-incompatible-pointer-types
  22. ::@if _%1_==_debug_ set CC=x86_64-w64-mingw32-gcc -g -ggdb
  23. ::@set P=64
  24. @goto tools
  25.  
  26. :tools
  27. echo will use %CC% %target%
  28. %CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
  29. %CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
  30.  
  31. :libtcc
  32. if not exist libtcc mkdir libtcc
  33. copy ..\libtcc.h libtcc\libtcc.h > nul
  34. %CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a
  35. tiny_impdef libtcc.dll -o libtcc/libtcc.def
  36.  
  37. :tcc
  38. %CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
  39.  
  40. :copy_std_includes
  41. copy ..\include\*.h include > nul
  42.  
  43. :libtcc1.a
  44. .\tcc %target% -c ../lib/libtcc1.c
  45. .\tcc %target% -c lib/crt1.c
  46. .\tcc %target% -c lib/wincrt1.c
  47. .\tcc %target% -c lib/dllcrt1.c
  48. .\tcc %target% -c lib/dllmain.c
  49. .\tcc %target% -c lib/chkstk.S
  50. goto lib%P%
  51.  
  52. :lib32
  53. .\tcc %target% -c ../lib/alloca86.S
  54. .\tcc %target% -c ../lib/alloca86-bt.S
  55. .\tcc %target% -c ../lib/bcheck.c
  56. tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
  57. @goto the_end
  58.  
  59. :lib64
  60. .\tcc %target% -c ../lib/alloca86_64.S
  61. tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
  62.  
  63. :the_end
  64. del *.o
  65.  
  66. :makedoc
  67. for /f "delims=" %%i in ('where makeinfo') do set minfo=perl "%%~i"
  68. if "%minfo%"=="" goto :skip_makedoc
  69. echo>..\config.texi @set VERSION %VERSION%
  70. if not exist doc md doc
  71. %minfo% --html --no-split -o doc\tcc-doc.html ../tcc-doc.texi
  72. copy tcc-win32.txt doc
  73. copy ..\tests\libtcc_test.c examples
  74. :skip_makedoc
  75.