2 @rem ----------------------------------------------------
3 @rem batch file to build tcc using mingw gcc
4 @rem ----------------------------------------------------
6 @set /p VERSION= < ..\VERSION
7 echo>..\config.h #define TCC_VERSION "%VERSION%"
9 @if _%1_==_AMD64_ shift /1 && goto x86_64
10 @if _%1_==_x64_ shift /1 && goto x86_64
12 @set target=-DTCC_TARGET_PE -DTCC_TARGET_I386
13 @set CC=gcc -Os -s -fno-strict-aliasing -Wno-incompatible-pointer-types
14 @if _%1_==_debug_ set CC=gcc -g -ggdb
19 @set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
20 @set CC=x86_64-w64-mingw32-gcc -Os -s -fno-strict-aliasing -Wno-incompatible-pointer-types
21 @if _%1_==_debug_ set CC=x86_64-w64-mingw32-gcc -g -ggdb
26 echo will use %CC% %target%
27 %CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
28 %CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
31 if not exist libtcc mkdir libtcc
32 copy ..\libtcc.h libtcc\libtcc.h > nul
33 %CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a
34 tiny_impdef libtcc.dll -o libtcc/libtcc.def
37 %CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
40 copy ..\include\*.h include > nul
43 .\tcc %target% -c ../lib/libtcc1.c
44 .\tcc %target% -c lib/crt1.c
45 .\tcc %target% -c lib/wincrt1.c
46 .\tcc %target% -c lib/dllcrt1.c
47 .\tcc %target% -c lib/dllmain.c
48 .\tcc %target% -c lib/chkstk.S
52 .\tcc %target% -c ../lib/alloca86.S
53 .\tcc %target% -c ../lib/alloca86-bt.S
54 .\tcc %target% -c ../lib/bcheck.c
55 tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
59 .\tcc %target% -c ../lib/alloca86_64.S
60 tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
66 for /f "delims=" %%i in ('where makeinfo') do set minfo=perl "%%~i"
67 if "%minfo%"=="" goto :skip_makedoc
68 echo>..\config.texi @set VERSION %VERSION%
69 if not exist doc md doc
70 %minfo% --html --no-split -o doc\tcc-doc.html ../tcc-doc.texi
71 copy tcc-win32.txt doc
72 copy ..\tests\libtcc_test.c examples