tinycc/win32/build-tcc.bat

68 lines
1.9 KiB
Batchfile
Raw Normal View History

@rem ----------------------------------------------------
@rem batch file to build tcc using mingw gcc
@rem ----------------------------------------------------
2009-07-18 20:06:46 +00:00
@set /p VERSION= < ..\VERSION
echo>..\config.h #define TCC_VERSION "%VERSION%"
2009-07-18 20:06:46 +00:00
@if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64
@if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
@set target=-DTCC_TARGET_PE -DTCC_TARGET_I386
@set CC=gcc -m32 -Os -s -fno-strict-aliasing
@set P=32
2009-07-18 20:06:46 +00:00
@goto tools
:x86_64
@set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
@set CC=gcc -m64 -Os -s -fno-strict-aliasing
@set P=64
@goto tools
2009-07-18 20:06:46 +00:00
:tools
%CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
%CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
2009-07-18 20:06:46 +00:00
:libtcc
if not exist libtcc mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h
2012-04-18 16:38:11 +00:00
%CC% %target% -shared -DLIBTCC_AS_DLL -DONE_SOURCE ../libtcc.c -o libtcc.dll -Wl,-out-implib,libtcc/libtcc.a
tiny_impdef libtcc.dll -o libtcc/libtcc.def
2009-07-18 20:06:46 +00:00
:tcc
%CC% %target% ../tcc.c -o tcc.exe -ltcc -Llibtcc
2009-07-18 20:06:46 +00:00
:copy_std_includes
copy ..\include\*.h include
copy ..\tcclib.h include
copy ..\tests\libtcc_test.c examples
:libtcc1.a
.\tcc %target% -c ../lib/libtcc1.c
.\tcc %target% -c lib/crt1.c
.\tcc %target% -c lib/wincrt1.c
.\tcc %target% -c lib/dllcrt1.c
.\tcc %target% -c lib/dllmain.c
.\tcc %target% -c lib/chkstk.S
goto lib%P%
:lib32
.\tcc %target% -c ../lib/alloca86.S
.\tcc %target% -c ../lib/alloca86-bt.S
.\tcc %target% -c ../lib/bcheck.c
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86.o alloca86-bt.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o bcheck.o
@goto the_end
:lib64
.\tcc %target% -c ../lib/alloca86_64.S
tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o
:the_end
del *.o
:makedoc
if not exist doc md doc
copy tcc-win32.txt doc
echo>..\config.texi @set VERSION %VERSION%
makeinfo --html --no-split -o doc\tcc-doc.html ../tcc-doc.texi || echo *** tcc-doc.html was not built ***