mirror of
https://github.com/mirror/tinycc.git
synced 2025-01-27 06:10:06 +08:00
make test: run cross-test always
To see inconsistencies when they happen.
This commit is contained in:
parent
42220676d7
commit
bbc7070c82
54
Makefile
54
Makefile
@ -62,6 +62,9 @@ else
|
||||
endif
|
||||
export MACOSX_DEPLOYMENT_TARGET := 10.6
|
||||
endif
|
||||
ifdef CONFIG_BSD
|
||||
NATIVE_TARGET = $(ARCH)-$(TARGETOS)
|
||||
endif
|
||||
endif
|
||||
|
||||
# run local version of tcc with local libraries and includes
|
||||
@ -70,11 +73,6 @@ TCCFLAGS-win = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TO
|
||||
TCCFLAGS = $(TCCFLAGS$(CFG))
|
||||
TCC = $(TOP)/tcc$(EXESUF) $(TCCFLAGS)
|
||||
|
||||
# cross compiler targets to build
|
||||
TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
|
||||
TCC_X += riscv64
|
||||
# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
|
||||
|
||||
CFLAGS_P = $(CFLAGS) -pg -static -DCONFIG_TCC_STATIC -DTCC_PROFILE
|
||||
LIBS_P = $(LIBS)
|
||||
LDFLAGS_P = $(LDFLAGS)
|
||||
@ -99,6 +97,27 @@ NATIVE_DEFINES_no_$(CONFIG_bcheck) += -DCONFIG_TCC_BCHECK=0
|
||||
NATIVE_DEFINES_no_$(CONFIG_backtrace) += -DCONFIG_TCC_BACKTRACE=0
|
||||
NATIVE_DEFINES += $(NATIVE_DEFINES_yes) $(NATIVE_DEFINES_no_no)
|
||||
|
||||
DEF-i386 = -DTCC_TARGET_I386
|
||||
DEF-i386-win32 = -DTCC_TARGET_I386 -DTCC_TARGET_PE
|
||||
DEF-x86_64 = -DTCC_TARGET_X86_64
|
||||
DEF-x86_64-win32= -DTCC_TARGET_X86_64 -DTCC_TARGET_PE
|
||||
DEF-x86_64-osx = -DTCC_TARGET_X86_64 -DTCC_TARGET_MACHO
|
||||
DEF-arm-fpa = -DTCC_TARGET_ARM
|
||||
DEF-arm-fpa-ld = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
|
||||
DEF-arm-vfp = -DTCC_TARGET_ARM -DTCC_ARM_VFP
|
||||
DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI
|
||||
DEF-arm-eabihf = $(DEF-arm-eabi) -DTCC_ARM_HARDFLOAT
|
||||
DEF-arm = $(DEF-arm-eabihf)
|
||||
DEF-arm-wince = $(DEF-arm-eabihf) -DTCC_TARGET_PE
|
||||
DEF-arm64 = -DTCC_TARGET_ARM64
|
||||
DEF-riscv64 = -DTCC_TARGET_RISCV64
|
||||
DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
|
||||
DEF-x86_64-FreeBSD = $(DEF-x86_64) -DTARGETOS_FreeBSD
|
||||
DEF-x86_64-NetBSD = $(DEF-x86_64) -DTARGETOS_NetBSD
|
||||
DEF-x86_64-OpenBSD = $(DEF-x86_64) -DTARGETOS_OpenBSD
|
||||
|
||||
DEF-$(NATIVE_TARGET) = $(NATIVE_DEFINES)
|
||||
|
||||
ifeq ($(INCLUDED),no)
|
||||
# --------------------------------------------------------------------------
|
||||
# running top Makefile
|
||||
@ -109,6 +128,11 @@ TCCDOCS = tcc.1 tcc-doc.html tcc-doc.info
|
||||
|
||||
all: $(PROGS) $(TCCLIBS) $(TCCDOCS)
|
||||
|
||||
# cross compiler targets to build
|
||||
TCC_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince c67
|
||||
TCC_X += riscv64
|
||||
# TCC_X += arm-fpa arm-fpa-ld arm-vfp arm-eabi
|
||||
|
||||
# cross libtcc1.a targets to build
|
||||
LIBTCC1_X = i386 x86_64 i386-win32 x86_64-win32 x86_64-osx arm arm64 arm-wince
|
||||
LIBTCC1_X += riscv64
|
||||
@ -122,7 +146,7 @@ cross: $(LIBTCC1_CROSS) $(PROGS_CROSS)
|
||||
# build specific cross compiler & lib
|
||||
cross-%: %-tcc$(EXESUF) %-libtcc1.a ;
|
||||
|
||||
install: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=no
|
||||
install: ; @$(MAKE) --no-print-directory install$(CFG)
|
||||
install-strip: ; @$(MAKE) --no-print-directory install$(CFG) CONFIG_strip=yes
|
||||
uninstall: ; @$(MAKE) --no-print-directory uninstall$(CFG)
|
||||
|
||||
@ -135,23 +159,6 @@ endif
|
||||
T = $(or $(CROSS_TARGET),$(NATIVE_TARGET),unknown)
|
||||
X = $(if $(CROSS_TARGET),$(CROSS_TARGET)-)
|
||||
|
||||
DEF-i386 = -DTCC_TARGET_I386
|
||||
DEF-x86_64 = -DTCC_TARGET_X86_64
|
||||
DEF-i386-win32 = -DTCC_TARGET_PE -DTCC_TARGET_I386
|
||||
DEF-x86_64-win32= -DTCC_TARGET_PE -DTCC_TARGET_X86_64
|
||||
DEF-x86_64-osx = -DTCC_TARGET_MACHO -DTCC_TARGET_X86_64
|
||||
DEF-arm-wince = -DTCC_TARGET_PE -DTCC_TARGET_ARM -DTCC_ARM_EABI -DTCC_ARM_VFP -DTCC_ARM_HARDFLOAT
|
||||
DEF-arm64 = -DTCC_TARGET_ARM64
|
||||
DEF-c67 = -DTCC_TARGET_C67 -w # disable warnigs
|
||||
DEF-arm-fpa = -DTCC_TARGET_ARM
|
||||
DEF-arm-fpa-ld = -DTCC_TARGET_ARM -DLDOUBLE_SIZE=12
|
||||
DEF-arm-vfp = -DTCC_TARGET_ARM -DTCC_ARM_VFP
|
||||
DEF-arm-eabi = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI
|
||||
DEF-arm-eabihf = -DTCC_TARGET_ARM -DTCC_ARM_VFP -DTCC_ARM_EABI -DTCC_ARM_HARDFLOAT
|
||||
DEF-arm = $(DEF-arm-eabihf)
|
||||
DEF-riscv64 = -DTCC_TARGET_RISCV64
|
||||
DEF-$(NATIVE_TARGET) = $(NATIVE_DEFINES)
|
||||
|
||||
DEFINES += $(DEF-$T) $(DEF-all)
|
||||
DEFINES += $(if $(ROOT-$T),-DCONFIG_SYSROOT="\"$(ROOT-$T)\"")
|
||||
DEFINES += $(if $(CRT-$T),-DCONFIG_TCC_CRTPREFIX="\"$(CRT-$T)\"")
|
||||
@ -214,7 +221,6 @@ ifeq ($(CONFIG_strip),no)
|
||||
CFLAGS += -g
|
||||
LDFLAGS += -g
|
||||
else
|
||||
CONFIG_strip = yes
|
||||
ifndef CONFIG_OSX
|
||||
LDFLAGS += -s
|
||||
endif
|
||||
|
9
tcc.c
9
tcc.c
@ -157,14 +157,17 @@ static const char version[] =
|
||||
"C67"
|
||||
#elif defined TCC_TARGET_ARM
|
||||
"ARM"
|
||||
# ifdef TCC_ARM_EABI
|
||||
" eabi"
|
||||
# ifdef TCC_ARM_HARDFLOAT
|
||||
"hf"
|
||||
# endif
|
||||
# endif
|
||||
#elif defined TCC_TARGET_ARM64
|
||||
"AArch64"
|
||||
#elif defined TCC_TARGET_RISCV64
|
||||
"riscv64"
|
||||
#endif
|
||||
#ifdef TCC_ARM_HARDFLOAT
|
||||
" Hard Float"
|
||||
#endif
|
||||
#ifdef TCC_TARGET_PE
|
||||
" Windows"
|
||||
#elif defined(TCC_TARGET_MACHO)
|
||||
|
10
tcc.h
10
tcc.h
@ -191,14 +191,14 @@ extern long double strtold (const char *__nptr, char **__endptr);
|
||||
#if !defined TCC_IS_NATIVE \
|
||||
|| (defined CONFIG_TCC_BACKTRACE && CONFIG_TCC_BACKTRACE==0)
|
||||
# undef CONFIG_TCC_BACKTRACE
|
||||
# undef CONFIG_TCC_BCHECK
|
||||
#else
|
||||
# define CONFIG_TCC_BACKTRACE 1
|
||||
# if defined CONFIG_TCC_BCHECK && CONFIG_TCC_BCHECK==0
|
||||
# define CONFIG_TCC_BACKTRACE 1 /* enable builtin stack backtraces */
|
||||
#endif
|
||||
|
||||
#if defined CONFIG_TCC_BCHECK && CONFIG_TCC_BCHECK==0
|
||||
# undef CONFIG_TCC_BCHECK
|
||||
# else
|
||||
#else
|
||||
# define CONFIG_TCC_BCHECK 1 /* enable bound checking code */
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined TARGETOS_OpenBSD \
|
||||
|
2
tccgen.c
2
tccgen.c
@ -7750,8 +7750,10 @@ static void init_putv(init_params *p, CType *type, unsigned long c)
|
||||
*(long double*)ptr = vtop->c.ld;
|
||||
else if (sizeof(double) == LDOUBLE_SIZE)
|
||||
*(double *)ptr = (double)vtop->c.ld;
|
||||
#ifndef TCC_CROSS_TEST
|
||||
else
|
||||
tcc_error("can't cross compile long double constants");
|
||||
#endif
|
||||
break;
|
||||
#if PTR_SIZE != 8
|
||||
case VT_LLONG:
|
||||
|
@ -276,16 +276,33 @@ asm-c-connect-test: asm-c-connect$(EXESUF) asm-c-connect-sep$(EXESUF)
|
||||
./asm-c-connect-sep$(EXESUF) > asm-c-connect.out2 && cat asm-c-connect.out2
|
||||
@diff -u asm-c-connect.out1 asm-c-connect.out2 || (echo "error"; exit 1)
|
||||
|
||||
TCC_YY = $(foreach T,$(TCC_X),$(if $(wildcard $(TOP)/$T-tcc$(EXESUF)),$T))
|
||||
|
||||
cross-test :
|
||||
$(if $(strip $(TCC_YY)),\
|
||||
$(MAKE) $(foreach T,$(TCC_YY),cross-$T.test) --no-print-directory,:)
|
||||
|
||||
cross-%.test :
|
||||
# quick sanity check for cross-compilers
|
||||
cross-test : tcctest.c examples/ex3.c
|
||||
@echo ------------ $@ ------------
|
||||
$(TOP)/$*-tcc$(EXESUF) -v $(TCCFLAGS-$(if $(findstring win,$*),win,unx))\
|
||||
-c $(TOPSRC)/examples/ex3.c
|
||||
$(foreach T,$(CROSS-TGTS),$(call CROSS-COMPILE,$T))
|
||||
|
||||
CROSS-TGTS = \
|
||||
i386 \
|
||||
i386-win32 \
|
||||
x86_64 \
|
||||
x86_64-win32 \
|
||||
x86_64-osx \
|
||||
x86_64-FreeBSD \
|
||||
x86_64-NetBSD \
|
||||
x86_64-OpenBSD \
|
||||
arm-fpa \
|
||||
arm-eabihf \
|
||||
arm-wince \
|
||||
arm64 \
|
||||
riscv64 \
|
||||
c67
|
||||
|
||||
define CROSS-COMPILE
|
||||
@echo " . $(1)"
|
||||
$(TCC) $(DEF-$1) -DTCC_CROSS_TEST -run $(TOPSRC)/tcc.c \
|
||||
-c $(if $(findstring c67,$1),$(filter %/ex3.c,$^),$<) -w $(TCCFLAGS)
|
||||
|
||||
endef
|
||||
|
||||
# targets for development
|
||||
%.bin: %.c tcc
|
||||
|
Loading…
Reference in New Issue
Block a user