build: restore out-of-tree support
This commit is contained in:
@ -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