make: new lib/Makefile for libtcc1.a on more platforms

win32/64 cross-compilers now build libtcc1.a and install it
together with the windows headers in a 'win32' sub-directory
of TCCDIR.
This commit is contained in:
grischka
2010-12-04 16:47:08 +01:00
parent 2ce9a0e2fe
commit 86ffc48129
6 changed files with 266 additions and 254 deletions

View File

@ -1,59 +1,62 @@
@rem ----------------------------------------------------
@rem batch file to build tcc using gcc and ar from mingw
@rem ----------------------------------------------------
@set PROMPT=$G$S
echo>..\config.h #define TCC_VERSION "0.9.25"
echo>>..\config.h #define CONFIG_TCCDIR "."
echo>>..\config.h #define CONFIG_SYSROOT ""
@set target=-DTCC_TARGET_PE -DTCC_TARGET_I386
@set CC=gcc
@set AR=ar
@if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
@if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64
@set target=-DTCC_TARGET_PE -DTCC_TARGET_I386
@set CC=gcc -Os -s
@set AR=ar
@set P=32
@goto tools
:x86_64
@set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
@set CC=x86_64-pc-mingw32-gCC
@rem mingw 64 has an ICE with -Os
@set CC=x86_64-pc-mingw32-gcc -O0 -s
@set AR=x86_64-pc-mingw32-ar
@set S=_64
@goto tools
@set P=64
:tools
%CC% %target% -Os tools/tiny_impdef.c -o tiny_impdef.exe -s
%CC% %target% -Os tools/tiny_libmaker.c -o tiny_libmaker.exe -s
%CC% %target% tools/tiny_impdef.c -o tiny_impdef.exe
%CC% %target% tools/tiny_libmaker.c -o tiny_libmaker.exe
:libtcc
if not exist libtcc\nul mkdir libtcc
copy ..\libtcc.h libtcc\libtcc.h
%CC% %target% -Os -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
%CC% %target% -fno-strict-aliasing ../libtcc.c -c -o libtcc.o
%AR% rcs libtcc/libtcc.a libtcc.o
:tcc
%CC% %target% -Os -fno-strict-aliasing ../tcc.c -o tcc.exe -s -DTCC_USE_LIBTCC -ltcc -Llibtcc
%CC% %target% -fno-strict-aliasing ../tcc.c -o tcc.exe -DTCC_USE_LIBTCC -ltcc -Llibtcc
:copy_std_includes
copy ..\include\*.h include
: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/libtcc1.c
.\tcc %target% -c lib/chkstk.S
.\tcc %target% -c ../lib/alloca86%S%.S
@if _%P%_==_64_ goto lib64
@set LIBFILES=crt1.o wincrt1.o dllcrt1.o dllmain.o chkstk.o libtcc1.o alloca86%S%.o
@if not _%P%==_ goto makelib
.\tcc %target% -c ../lib/alloca86-bt%S%.S
: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
@set LIBFILES=%LIBFILES% alloca86-bt%S%.o bcheck.o
: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
:makelib
tiny_libmaker lib/libtcc1.a %LIBFILES%
:the_end
del *.o