VS2015 solution and project files
[tinycc.git] / win32 / build-tcc.bat
blobe5caf3b60fd3ef7a5384b4ac9b8c198b9ef0c117
1 @echo off
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
15 @set P=32
16 @goto tools
18 :x86_64
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
22 @set P=64
23 @goto tools
25 :tools
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
30 :libtcc
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
36 :tcc
37 %CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
39 :copy_std_includes
40 copy ..\include\*.h include > nul
42 :libtcc1.a
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
49 goto lib%P%
51 :lib32
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
56 @goto the_end
58 :lib64
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
62 :the_end
63 del *.o
65 :makedoc
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
73 :skip_makedoc