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