win32/64: msys2 support

Support ./configure && make under msys2 (a new msys fork)
on win32 and win64.

Get rid of CONFIG_WIN64 make-var. (On windows, WIN32 in
general is used for both 32 and 64 bit platforms)

Also:
- cleanup win32/build-tcc.bat
- adjust win32/(doc/)tcc-win32.tx
This commit is contained in:
grischka 2016-10-02 01:39:07 +02:00
parent 49d3118621
commit f350487e1e
5 changed files with 27 additions and 29 deletions

View File

@ -28,9 +28,6 @@ LINK_LIBTCC =
LIBS = LIBS =
ifdef CONFIG_WIN32 ifdef CONFIG_WIN32
ifeq ($(ARCH),x86-64)
CONFIG_WIN64=yes
endif
STRIP_BINARIES = yes STRIP_BINARIES = yes
LIBTCC = libtcc.dll LIBTCC = libtcc.dll
else else
@ -93,18 +90,18 @@ ARM_FILES = $(CORE_FILES) arm-gen.c
ARM64_FILES = $(CORE_FILES) arm64-gen.c ARM64_FILES = $(CORE_FILES) arm64-gen.c
C67_FILES = $(CORE_FILES) c67-gen.c tcccoff.c C67_FILES = $(CORE_FILES) c67-gen.c tcccoff.c
ifdef CONFIG_WIN64 ifdef CONFIG_WIN32
PROGS+=tiny_impdef$(EXESUF) PROGS+=tiny_impdef$(EXESUF) tiny_libmaker$(EXESUF)
NATIVE_FILES=$(WIN64_FILES) ifeq ($(ARCH),x86-64)
PROGS_CROSS=$(WIN32_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) NATIVE_FILES=$(WIN64_FILES)
LIBTCC1_CROSS=lib/i386-win32/libtcc1.a PROGS_CROSS=$(WIN32_CROSS)
LIBTCC1_CROSS=lib/i386-win32/libtcc1.a
else ifdef CONFIG_WIN32 else
PROGS+=tiny_impdef$(EXESUF) NATIVE_FILES=$(WIN32_FILES)
NATIVE_FILES=$(WIN32_FILES) PROGS_CROSS=$(WIN64_CROSS)
PROGS_CROSS=$(WIN64_CROSS) $(I386_CROSS) $(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) LIBTCC1_CROSS=lib/x86_64-win32/libtcc1.a
LIBTCC1_CROSS=lib/x86_64-win32/libtcc1.a endif
PROGS_CROSS+=$(X64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)
else ifeq ($(ARCH),i386) else ifeq ($(ARCH),i386)
NATIVE_FILES=$(I386_FILES) NATIVE_FILES=$(I386_FILES)
PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS) PROGS_CROSS=$(X64_CROSS) $(WIN32_CROSS) $(WIN64_CROSS) $(ARM_CROSS) $(ARM64_CROSS) $(C67_CROSS) $(WINCE_CROSS)

1
configure vendored
View File

@ -50,6 +50,7 @@ cpu=
targetos=`uname` targetos=`uname`
case $targetos in case $targetos in
MINGW32*) mingw32=yes;; MINGW32*) mingw32=yes;;
MSYS*) mingw32=yes;;
DragonFly) noldl=yes;; DragonFly) noldl=yes;;
OpenBSD) noldl=yes;; OpenBSD) noldl=yes;;
FreeBSD) noldl=yes;; FreeBSD) noldl=yes;;

View File

@ -8,11 +8,12 @@ VPATH = $(TOPSRC)/lib $(TOPSRC)/win32/lib
ifndef TARGET ifndef TARGET
# we're building the native libtcc1.a # we're building the native libtcc1.a
ifdef CONFIG_WIN64 ifdef CONFIG_WIN32
TARGET = x86_64-win32 ifeq ($(ARCH),x86-64)
# using tcc TARGET = x86_64-win32
else ifdef CONFIG_WIN32 else
TARGET = i386-win32 TARGET = i386-win32
endif
# using tcc # using tcc
else ifeq ($(ARCH),i386) else ifeq ($(ARCH),i386)
TARGET = i386 TARGET = i386

View File

@ -5,19 +5,17 @@
@set /p VERSION= < ..\VERSION @set /p VERSION= < ..\VERSION
echo>..\config.h #define TCC_VERSION "%VERSION%" echo>..\config.h #define TCC_VERSION "%VERSION%"
@if _%1_==_AMD64_ shift /1 && goto x86_64 @if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ goto x86_64
@if _%1_==_x64_ shift /1 && goto x86_64 @if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ goto x86_64
@set target=-DTCC_TARGET_PE -DTCC_TARGET_I386 @set target=-DTCC_TARGET_PE -DTCC_TARGET_I386
@set CC=gcc -Os -s -fno-strict-aliasing @set CC=gcc -m32 -Os -s -fno-strict-aliasing
@if _%1_==_debug_ set CC=gcc -g -ggdb
@set P=32 @set P=32
@goto tools @goto tools
:x86_64 :x86_64
@set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64 @set target=-DTCC_TARGET_PE -DTCC_TARGET_X86_64
@set CC=x86_64-w64-mingw32-gcc -Os -s -fno-strict-aliasing @set CC=gcc -m64 -Os -s -fno-strict-aliasing
@if _%1_==_debug_ set CC=x86_64-w64-mingw32-gcc -g -ggdb
@set P=64 @set P=64
@goto tools @goto tools
@ -36,6 +34,8 @@ tiny_impdef libtcc.dll -o libtcc/libtcc.def
:copy_std_includes :copy_std_includes
copy ..\include\*.h include copy ..\include\*.h include
copy ..\tcclib.h include
copy ..\tests\libtcc_test.c examples
:libtcc1.a :libtcc1.a
.\tcc %target% -c ../lib/libtcc1.c .\tcc %target% -c ../lib/libtcc1.c
@ -59,10 +59,9 @@ tiny_libmaker lib/libtcc1.a libtcc1.o alloca86_64.o crt1.o wincrt1.o dllcrt1.o d
:the_end :the_end
del *.o del *.o
copy ..\tests\libtcc_test.c examples
:makedoc :makedoc
if not exist doc md doc if not exist doc md doc
copy tcc-win32.txt doc copy tcc-win32.txt doc
echo>..\config.texi @set VERSION %VERSION% echo>..\config.texi @set VERSION %VERSION%
makeinfo --html --no-split -o doc\tcc-doc.html ../tcc-doc.texi makeinfo --html --no-split -o doc\tcc-doc.html ../tcc-doc.texi || echo *** tcc-doc.html was not built ***

View File

@ -54,7 +54,7 @@
tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def tcc examples/libtcc_test.c -I libtcc libtcc/libtcc.def
- Compiling with MinGW: - Compiling with MinGW:
gcc examples/libtcc_test.c -I libtcc libtcc.dll gcc examples/libtcc_test.c -I libtcc libtcc.dll -o libtcc_test.exe
- Compiling with MSVC: - Compiling with MSVC:
lib /def:libtcc\libtcc.def /out:libtcc.lib lib /def:libtcc\libtcc.def /out:libtcc.lib