build: revert Makefiles to 0.9.26 state (mostly)
[tinycc.git] / tests / tests2 / Makefile
blob587f1e7b879429aafdbd614f69456b5fe9509c02
1 TOP = ../..
2 include $(TOP)/Makefile
4 # run local version of tcc with local libraries and includes
5 TCCFLAGS = -B$(TOP) -I$(TOP)
6 ifdef CONFIG_WIN32
7 TCCFLAGS = -B$(TOP)/win32 -I$(TOP)/include -I$(TOP) -L$(TOP)
8 endif
9 TCC = $(TOP)/tcc $(TCCFLAGS)
11 TESTS = $(patsubst %.c,%.test,$(sort $(wildcard *.c)))
13 # 34_array_assignment.test -- array assignment is not in C standard
14 SKIP = 34_array_assignment.test
16 # some tests do not pass on all platforms, remove them for now
17 ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
18 SKIP += 22_floating_point.test
19 endif
20 ifeq ($(TARGETOS),Darwin)
21 SKIP += 40_stdio.test
22 endif
23 ifdef CONFIG_WIN32
24 SKIP += 24_math_library.test # don't have round()
25 SKIP += 28_strings.test # don't have r/index() / strings.h
26 endif
27 ifeq ($(ARCH),x86-64)
28 SKIP += 73_arm64.test
29 endif
30 ifeq (,$(filter i386 x86-64,$(ARCH)))
31 SKIP += 85-asm-outside-function.test
32 endif
34 # Some tests might need arguments
35 ARGS =
36 31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
37 46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c
39 # Some tests might need different flags
40 76_dollars_in_identifiers.test : TCCFLAGS += -fdollars-in-identifiers
42 # Filter some always-warning
43 FILTER =
44 ifeq (-$(findstring arm,$(ARCH))-,-arm-)
45 FILTER = 2>&1 | grep -v 'warning: soft float ABI currently not supported'
46 endif
48 all test: $(filter-out $(SKIP),$(TESTS))
50 %.test: %.c %.expect
51 @echo Test: $*...
52 # test -run
53 @$(TCC) -run $< $(ARGS) $(FILTER) >$*.output 2>&1 || true
54 @diff -Nbu $*.expect $*.output && rm -f $*.output
55 # test exe (disabled for speed)
56 # @($(TCC) $(FLAGS) $< -o $*.exe && ./$*.exe $(ARGS)) $(FiLTER) >$*.output2 2>&1 ; \
57 # diff -Nbu $*.expect $*.output2 && rm -f $*.output2 $*.exe
59 # automatically generate .expect files with gcc:
60 %.expect :
61 (gcc $*.c -o a.exe && ./a.exe $(ARGS)) >$*.expect 2>&1; rm -f a.exe
63 # tell make not to delete
64 .PRECIOUS: %.expect
66 clean:
67 rm -f fred.txt *.output a.exe