win64: add x64 target to build-tcc.bat
[tinycc.git] / win32 / build-tcc.bat
blobbcab23330a9cfae401b0e8a8d72bc3b1e0047fd3
1 @rem ----------------------------------------------------
2 @rem batch file to build tcc using gcc and ar from mingw
3 @rem ----------------------------------------------------
4 @set PROMPT=$G$S
6 copy ..\include\*.h include
8 echo>..\config.h #define TCC_VERSION "0.9.25"
9 echo>>..\config.h #define TCC_TARGET_PE 1
10 echo>>..\config.h #define CONFIG_TCCDIR "."
11 echo>>..\config.h #define CONFIG_SYSROOT ""
13 @if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
14 @if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64
16 :i386
17 @set AS=.\tcc -c
18 @goto tools
20 :x86_64
21 @set P=x86_64-pc-mingw32-
22 @set X64=-x64
23 @rem !!! currently TinyCC doesn't 64bit asm. Need 'yasm' !!!
24 @set AS=yasm -p gnu -f elf64
25 echo>>..\config.h #define TCC_TARGET_X86_64 1
26 @goto tools
28 :tools
29 %P%gcc -Os tools/tiny_impdef.c -o tiny_impdef.exe -s
30 %P%gcc -Os tools/tiny_libmaker.c -o tiny_libmaker.exe -s
32 :libtcc
33 if not exist libtcc\nul mkdir libtcc
34 copy ..\libtcc.h libtcc\libtcc.h
36 %P%gcc -Os -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
37 %P%ar rcs libtcc/libtcc.a libtcc.o
39 :tcc
40 %P%gcc -Os -fno-strict-aliasing ../tcc.c -o tcc.exe -s -DTCC_USE_LIBTCC -ltcc -Llibtcc
42 :libtcc1.a
43 .\tcc -c lib/crt1.c
44 .\tcc -c lib/wincrt1.c
45 .\tcc -c lib/dllcrt1.c
46 .\tcc -c lib/dllmain.c
47 .\tcc -c ../lib/libtcc1.c
48 .\tcc -o tmp.s -E lib/chkstk.S
49 %AS% -o chkstk.o tmp.s
50 .\tcc -o tmp.s -E ../lib/alloca86.S
51 %AS% -o alloca86.o tmp.s
52 del tmp.s
53 tiny_libmaker lib/libtcc1%X64%.a crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o libtcc1.o alloca86.o
55 :cleanup
56 del *.o