Unified · Split
| @@ -1,3 +1,4 @@ | |||
| 1 | @echo off | ||
| 1 | @rem ---------------------------------------------------- | 2 | @rem ---------------------------------------------------- |
| 2 | @rem batch file to build tcc using mingw gcc | 3 | @rem batch file to build tcc using mingw gcc |
| 3 | @rem ---------------------------------------------------- | 4 | @rem ---------------------------------------------------- |
| @@ -5,28 +6,30 @@ · 1 unmodified line | |||
| 5 | @set /p VERSION= < ..\VERSION | 6 | @set /p VERSION= < ..\VERSION |
| 6 | echo>..\config.h #define TCC_VERSION "%VERSION%" | 7 | echo>..\config.h #define TCC_VERSION "%VERSION%" |
| 7 | 8 | ||
| 8 | @rem @if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64 | 9 | @if _%1_==_AMD64_ shift /1 && goto x86_64 |
| 9 | @if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64 | 10 | @if _%1_==_x64_ shift /1 && goto x86_64 |
| 10 | 11 | ||
| 11 | @set target=-DTCC_TARGET_PE -DTCC_TARGET_I386 | 12 | @set target=-DTCC_TARGET_PE -DTCC_TARGET_I386 |
| 12 | @set CC=gcc -Os -s -fno-strict-aliasing | 13 | @set CC=gcc -Os -s -fno-strict-aliasing |
| 14 | @if _%1_==_debug_ set CC=gcc -g -ggdb | ||
| 13 | @set P=32 | 15 | @set P=32 |
| 14 | @goto tools | 16 | @goto tools |
| 15 | 17 | ||
| 16 | :x86_64 | 18 | :x86_64 |
| 17 | @set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 | 19 | @set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 |
| 18 | @rem mingw 64 has an ICE with -Os | 20 | @set CC=x86_64-w64-mingw32-gcc -Os -s -fno-strict-aliasing |
| 19 | @set CC=x86_64-pc-mingw32-gcc -O0 -s -fno-strict-aliasing | 21 | @if _%1_==_debug_ set CC=x86_64-w64-mingw32-gcc -g -ggdb |
| 20 | @set P=64 | 22 | @set P=64 |
| 21 | @goto tools | 23 | @goto tools |
| 22 | 24 | ||
| 23 | :tools | 25 | :tools |
| 26 | echo will use %CC% %target% | ||
| 24 | %CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe | 27 | %CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe |
| 25 | %CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe | 28 | %CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe |
| 26 | 29 | ||
| 27 | :libtcc | 30 | :libtcc |
| 28 | if not exist libtcc mkdir libtcc | 31 | if not exist libtcc mkdir libtcc |
| 29 | copy ..\libtcc.h libtcc\libtcc.h | 32 | copy ..\libtcc.h libtcc\libtcc.h > nul |
| 30 | %CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a | 33 | %CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a |
| 31 | tiny_impdef libtcc.dll -o libtcc/libtcc.def | 34 | tiny_impdef libtcc.dll -o libtcc/libtcc.def |
| 32 | 35 | ||
| @@ -34,7 +37,7 @@ tiny_impdef libtcc.dll -o libtcc/libtcc.def · 1 unmodified line | |||
| 34 | %CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc | 37 | %CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc |
| 35 | 38 | ||
| 36 | :copy_std_includes | 39 | :copy_std_includes |
| 37 | copy ..\include\*.h include | 40 | copy ..\include\*.h include > nul |
| 38 | 41 | ||
| 39 | :libtcc1.a | 42 | :libtcc1.a |
| 40 | .\tcc %target% -c ../lib/libtcc1.c | 43 | .\tcc %target% -c ../lib/libtcc1.c |
| @@ -60,8 +63,10 @@ tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o d · 19 unmodified lines | |||
| 60 | del *.o | 63 | del *.o |
| 61 | 64 | ||
| 62 | :makedoc | 65 | :makedoc |
| 66 | where makeinfo > nul 2>&1 || goto :skip_makedoc | ||
| 63 | echo>..\config.texi @set VERSION %VERSION% | 67 | echo>..\config.texi @set VERSION %VERSION% |
| 64 | if not exist doc md doc | 68 | if not exist doc md doc |
| 65 | makeinfo --html --no-split -o doc\tcc-doc.html ../tcc-doc.texi | 69 | makeinfo --html --no-split -o doc\tcc-doc.html ../tcc-doc.texi |
| 66 | copy tcc-win32.txt doc | 70 | copy tcc-win32.txt doc |
| 67 | copy ..\tests\libtcc_test.c examples | 71 | copy ..\tests\libtcc_test.c examples |
| 72 | :skip_makedoc | ||