aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorgrischka <grischka>2017-02-25 12:49:47 +0100
committergrischka <grischka>2017-02-25 12:51:04 +0100
commitbb93064d7857d887b674999c9b4152b44a628f9a (patch)
tree5290a93161373fd5a286d9aaf32ebb8dea04f82c /tests
parent669f61117d6ff2255649e80a9708fe24e32d4a33 (diff)
downloadtinycc-bb93064d7857d887b674999c9b4152b44a628f9a.tar.gz
tinycc-bb93064d7857d887b674999c9b4152b44a628f9a.tar.bz2
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
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile24
-rw-r--r--tests/pp/Makefile3
-rw-r--r--tests/tests2/Makefile9
3 files changed, 19 insertions, 17 deletions
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 $@ $<
diff --git a/tests/pp/Makefile b/tests/pp/Makefile
index 1032b65..ba75bbc 100644
--- a/tests/pp/Makefile
+++ b/tests/pp/Makefile
@@ -3,11 +3,10 @@
#
TOP = ../..
-include $(TOP)/config.mak
+include $(TOP)/Makefile
SRC = $(TOPSRC)/tests/pp
VPATH = $(SRC)
-TCC = ../../tcc
files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
TESTS = $(call files,c) $(call files,S)
diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile
index 52f590f..b8d6a49 100644
--- a/tests/tests2/Makefile
+++ b/tests/tests2/Makefile
@@ -1,15 +1,8 @@
TOP = ../..
-include $(TOP)/config.mak
+include $(TOP)/Makefile
SRC = $(TOPSRC)/tests/tests2
VPATH = $(SRC)
-# run local version of tcc with local libraries and includes
-TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include
-ifdef CONFIG_WIN32
- TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -L$(TOP)
-endif
-TCC = $(TOP)/tcc $(TCCFLAGS)
-
TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c))))
# 34_array_assignment.test -- array assignment is not in C standard