build: restore out-of-tree support
This commit is contained in:
@ -4,8 +4,8 @@
|
||||
|
||||
TOP = ..
|
||||
include $(TOP)/Makefile
|
||||
VPATH = $(TOP)/tests $(TOP)
|
||||
CFLAGS = -I$(TOP)
|
||||
VPATH = $(TOPSRC)/tests $(TOPSRC) $(TOP)
|
||||
CFLAGS = -I$(TOPSRC) -I$(TOP)
|
||||
|
||||
# what tests to run
|
||||
TESTS = \
|
||||
@ -42,14 +42,14 @@ ifeq ($(CONFIG_arm_eabi),yes)
|
||||
endif
|
||||
|
||||
# run local version of tcc with local libraries and includes
|
||||
TCCFLAGS = -B$(TOP) -I$(TOP)
|
||||
TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP)
|
||||
ifdef CONFIG_WIN32
|
||||
TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP)
|
||||
TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -I$(TOPSRC) -I$(TOP) -L$(TOP)
|
||||
PATH := $(CURDIR)/$(TOP):$(PATH) # for libtcc_test to find libtcc.dll
|
||||
endif
|
||||
|
||||
TCC = $(TOP)/tcc $(TCCFLAGS)
|
||||
RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOP)/tcc.c $(TCCFLAGS)
|
||||
RUN_TCC = $(NATIVE_DEFINES) -DONE_SOURCE -run $(TOPSRC)/tcc.c $(TCCFLAGS)
|
||||
|
||||
ifeq ($(TARGETOS),Darwin)
|
||||
CFLAGS += -Wl,-flat_namespace,-undefined,warning
|
||||
@ -154,9 +154,9 @@ btest: boundtest.c
|
||||
speedtest: ex2 ex3
|
||||
@echo ------------ $@ ------------
|
||||
time ./ex2 1238 2 3 4 10 13 4
|
||||
time $(TCC) -run $(TOP)/examples/ex2.c 1238 2 3 4 10 13 4
|
||||
time $(TCC) -run $(TOPSRC)/examples/ex2.c 1238 2 3 4 10 13 4
|
||||
time ./ex3 35
|
||||
time $(TCC) -run $(TOP)/examples/ex3.c 35
|
||||
time $(TCC) -run $(TOPSRC)/examples/ex3.c 35
|
||||
|
||||
weaktest: tcctest.c test.ref
|
||||
$(TCC) -c $< -o weaktest.tcc.o
|
||||
@ -165,7 +165,7 @@ weaktest: tcctest.c test.ref
|
||||
objdump -t weaktest.gcc.o | grep ' w ' | sed -e 's/.* \([a-zA-Z0-9_]*\)$$/\1/' | LC_ALL=C sort > weaktest.gcc.o.txt
|
||||
diff weaktest.gcc.o.txt weaktest.tcc.o.txt && echo "Weak Auto Test OK"
|
||||
|
||||
ex%: $(TOP)/examples/ex%.c
|
||||
ex%: $(TOPSRC)/examples/ex%.c
|
||||
$(CC) -o $@ $< $(CFLAGS)
|
||||
|
||||
# tiny assembler testing
|
||||
|
||||
@ -2,8 +2,13 @@
|
||||
# credits: 01..13.c from the pcc cpp-tests suite
|
||||
#
|
||||
|
||||
TOP = ../..
|
||||
include $(TOP)/config.mak
|
||||
SRC = $(TOPSRC)/tests/pp
|
||||
VPATH = $(SRC)
|
||||
|
||||
TCC = ../../tcc
|
||||
files = $(patsubst %.$1,%.test,$(wildcard *.$1))
|
||||
files = $(patsubst %.$1,%.test,$(notdir $(wildcard $(SRC)/*.$1)))
|
||||
TESTS = $(call files,c) $(call files,S)
|
||||
|
||||
all test : $(sort $(TESTS))
|
||||
@ -13,13 +18,13 @@ DIFF_OPTS = -Nu -b -B -I "^\#"
|
||||
%.test: %.c %.expect
|
||||
@echo PPTest $* ...
|
||||
-@$(TCC) -E -P $< >$*.output 2>&1 ; \
|
||||
diff $(DIFF_OPTS) $*.expect $*.output \
|
||||
diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
|
||||
&& rm -f $*.output
|
||||
|
||||
%.test: %.S %.expect
|
||||
@echo PPTest $* ...
|
||||
-@$(TCC) -E -P $< >$*.output 2>&1 ; \
|
||||
diff $(DIFF_OPTS) $*.expect $*.output \
|
||||
diff $(DIFF_OPTS) $(SRC)/$*.expect $*.output \
|
||||
&& rm -f $*.output
|
||||
|
||||
# automatically generate .expect files with gcc:
|
||||
|
||||
@ -1,14 +1,16 @@
|
||||
TOP = ../..
|
||||
include $(TOP)/Makefile
|
||||
include $(TOP)/config.mak
|
||||
SRC = $(TOPSRC)/tests/tests2
|
||||
VPATH = $(SRC)
|
||||
|
||||
# run local version of tcc with local libraries and includes
|
||||
TCCFLAGS = -B$(TOP) -I$(TOP)
|
||||
TCCFLAGS = -B$(TOP) -I$(TOPSRC)/include
|
||||
ifdef CONFIG_WIN32
|
||||
TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP)
|
||||
TCCFLAGS = -B$(TOPSRC)/win32 -I$(TOPSRC)/include -L$(TOP)
|
||||
endif
|
||||
TCC = $(TOP)/tcc $(TCCFLAGS)
|
||||
|
||||
TESTS = $(patsubst %.c,%.test,$(sort $(wildcard *.c)))
|
||||
TESTS = $(patsubst %.c,%.test,$(sort $(notdir $(wildcard $(SRC)/*.c))))
|
||||
|
||||
# 34_array_assignment.test -- array assignment is not in C standard
|
||||
SKIP = 34_array_assignment.test
|
||||
@ -34,15 +36,16 @@ endif
|
||||
# Some tests might need arguments
|
||||
ARGS =
|
||||
31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
|
||||
46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c
|
||||
46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' $(SRC)/46_grep.c
|
||||
|
||||
# Some tests might need different flags
|
||||
76_dollars_in_identifiers.test : TCCFLAGS += -fdollars-in-identifiers
|
||||
|
||||
# Filter source directory in warnings/errors (out-of-tree builds)
|
||||
FILTER = 2>&1 | sed 's,$(SRC)/,,g'
|
||||
# Filter some always-warning
|
||||
FILTER =
|
||||
ifeq (-$(findstring arm,$(ARCH))-,-arm-)
|
||||
FILTER = 2>&1 | grep -v 'warning: soft float ABI currently not supported'
|
||||
FILTER += 2>&1 | grep -v 'warning: soft float ABI currently not supported'
|
||||
endif
|
||||
|
||||
all test: $(filter-out $(SKIP),$(TESTS))
|
||||
@ -51,10 +54,7 @@ all test: $(filter-out $(SKIP),$(TESTS))
|
||||
@echo Test: $*...
|
||||
# test -run
|
||||
@$(TCC) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true
|
||||
@diff -Nbu $*.expect $*.output && rm -f $*.output
|
||||
# test exe (disabled for speed)
|
||||
# @($(TCC) $(FLAGS) $< -o $*.exe && ./$*.exe $(ARGS)) $(FiLTER) >$*.output2 2>&1 ; \
|
||||
# diff -Nbu $*.expect $*.output2 && rm -f $*.output2 $*.exe
|
||||
@diff -Nbu $(SRC)/$*.expect $*.output && rm -f $*.output
|
||||
|
||||
# automatically generate .expect files with gcc:
|
||||
%.expect :
|
||||
|
||||
Reference in New Issue
Block a user