From bb93064d7857d887b674999c9b4152b44a628f9a Mon Sep 17 00:00:00 2001 From: grischka Date: Sat, 25 Feb 2017 12:49:47 +0100 Subject: makefile: unify cross with native builds supports building cross compilers on the fly without need for configure --enable-cross $ make cross # all compilers $ make cross-TARGET # only TARGET-compiler & its libtcc1.a with TARGET one from i386 x86_64 i386-win32 x86_64-win32 arm arm64 arm-wince c67 Type 'make help' for more information --- tests/Makefile | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) (limited to 'tests/Makefile') diff --git a/tests/Makefile b/tests/Makefile index 558d06c..fdd57b2 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -17,6 +17,7 @@ TESTS = \ dlltest \ abitest \ vla_test-run \ + cross-test \ tests2-dir \ pp-dir @@ -45,23 +46,22 @@ endif ifeq (,$(filter i386 x86_64,$(ARCH))) TESTS := $(filter-out dlltest,$(TESTS)) endif +ifndef CONFIG_CROSS + TESTS := $(filter-out cross-%,$(TESTS)) +endif -# run local version of tcc with local libraries and includes -TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) ifdef CONFIG_WIN32 - TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP) - PATH := $(CURDIR)/$(TOP):$(PATH) # for libtcc_test to find libtcc.dll + PATH := $(CURDIR)/$(TOP);$(PATH) # for libtcc_test to find libtcc.dll endif -TCC = $(TOP)/tcc $(TCCFLAGS) -RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS) - ifeq ($(TARGETOS),Darwin) CFLAGS += -Wl,-flat_namespace,-undefined,warning TCCFLAGS += -D_ANSI_SOURCE export MACOSX_DEPLOYMENT_TARGET:=10.2 endif +RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS) + DISAS = objdump -d all test : clean-s $(TESTS) @@ -236,6 +236,16 @@ vla_test-run: vla_test$(EXESUF) @echo ------------ $@ ------------ ./vla_test$(EXESUF) +cross-test : + @echo ------------ $@ ------------ + $(TOP)/i386-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok" + $(TOP)/x86_64-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok" + $(TOP)/arm-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok" + $(TOP)/c67-tcc$(EXESUF) $(TCCFLAGS-unx) -c $(TOPSRC)/examples/ex3.c && echo "ok" + $(TOP)/i386-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok" + $(TOP)/x86_64-win32-tcc$(EXESUF) $(TCCFLAGS-win) $(TOPSRC)/win32/examples/hello_win.c && echo "ok" + $(TOP)/arm-wince-tcc$(EXESUF) $(TCCFLAGS-win) -c $(TOPSRC)/win32/examples/hello_win.c && echo "ok" + # targets for development %.bin: %.c tcc $(TCC) -g -o $@ $< -- cgit v1.3.1