asm 32/64: replace (long)sym->next by sym->jnext
[tinycc/kirr.git] / win32 / build-tcc.bat
blobde042a89cc514281c372e62fe63226a9c5e2df50
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
15 @goto tools
17 :x86_64
18 echo>>..\config.h #define TCC_TARGET_X86_64 1
19 @set P=x86_64-pc-mingw32-
20 @goto tools
22 :tools
23 %P%gcc -Os tools/tiny_impdef.c -o tiny_impdef.exe -s
24 %P%gcc -Os tools/tiny_libmaker.c -o tiny_libmaker.exe -s
26 :libtcc
27 if not exist libtcc\nul mkdir libtcc
28 copy ..\libtcc.h libtcc\libtcc.h
30 %P%gcc -Os -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
31 %P%ar rcs libtcc/libtcc.a libtcc.o
33 :tcc
34 %P%gcc -Os -fno-strict-aliasing ../tcc.c -o tcc.exe -s -DTCC_USE_LIBTCC -ltcc -Llibtcc
36 :libtcc1.a
37 .\tcc -c lib/crt1.c
38 .\tcc -c lib/wincrt1.c
39 .\tcc -c lib/dllcrt1.c
40 .\tcc -c lib/dllmain.c
41 .\tcc -c ../lib/libtcc1.c
42 @if not x%P%==x goto asm64
43 .\tcc -c lib/chkstk.S
44 .\tcc -c ../lib/alloca86.S
45 tiny_libmaker lib/libtcc1.a crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o libtcc1.o alloca86.o
46 @goto cleanup
48 :asm64
49 @rem !!! currently TinyCC doesn't 64bit asm. Need 'yasm' !!!
50 .\tcc -o tmp.s -E lib/chkstk.S
51 yasm -p gnu -f elf64 -o chkstk.o tmp.s
52 .\tcc -o tmp.s -E ../lib/alloca86_64.S
53 yasm -p gnu -f elf64 -o alloca86_64.o tmp.s
54 del tmp.s
55 tiny_libmaker lib/libtcc1.a crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o libtcc1.o alloca86_64.o
57 :cleanup
58 del *.o