Fixed tests on Windows (including out-of-tree problems)
[tinycc.git] / tests / tests2 / Makefile
blob9c2e70f456a7d54c2c77ef5ad39436c3d2bd842c
1 TOP = ../..
2 include $(TOP)/Makefile
3 VPATH = $(top_srcdir)/tests/tests2
5 TCCFLAGS = -B$(TOP)
6 ifdef CONFIG_WIN32
7 TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
8 endif
10 ifeq ($(TARGETOS),Darwin)
11 CFLAGS += -Wl,-flat_namespace,-undefined,warning
12 TCCFLAGS += -D_ANSI_SOURCE
13 export MACOSX_DEPLOYMENT_TARGET:=10.2
14 endif
16 TCC = $(TOP)/tcc $(TCCFLAGS)
18 TESTS = \
19 00_assignment.test \
20 01_comment.test \
21 02_printf.test \
22 03_struct.test \
23 04_for.test \
24 05_array.test \
25 06_case.test \
26 07_function.test \
27 08_while.test \
28 09_do_while.test \
29 10_pointer.test \
30 11_precedence.test \
31 12_hashdefine.test \
32 13_integer_literals.test \
33 14_if.test \
34 15_recursion.test \
35 16_nesting.test \
36 17_enum.test \
37 18_include.test \
38 19_pointer_arithmetic.test \
39 20_pointer_comparison.test \
40 21_char_array.test \
41 22_floating_point.test \
42 23_type_coercion.test \
43 24_math_library.test \
44 25_quicksort.test \
45 26_character_constants.test \
46 27_sizeof.test \
47 28_strings.test \
48 29_array_address.test \
49 31_args.test \
50 32_led.test \
51 33_ternary_op.test \
52 35_sizeof.test \
53 36_array_initialisers.test \
54 37_sprintf.test \
55 38_multiple_array_index.test \
56 39_typedef.test \
57 40_stdio.test \
58 41_hashif.test \
59 42_function_pointer.test \
60 43_void_param.test \
61 44_scoped_declarations.test \
62 45_empty_for.test \
63 47_switch_return.test \
64 48_nested_break.test \
65 49_bracket_evaluation.test \
66 50_logical_second_arg.test \
67 51_static.test \
68 52_unnamed_enum.test \
69 54_goto.test \
70 55_lshift_type.test
72 # 30_hanoi.test -- seg fault in the code, gcc as well
73 # 34_array_assignment.test -- array assignment is not in C standard
74 # 46_grep.test -- does not compile even with gcc
76 # some tests do not pass on all platforms, remove them for now
77 ifeq ($(TARGETOS),Darwin)
78 TESTS := $(filter-out 40_stdio.test,$(TESTS))
79 endif
80 ifdef CONFIG_WIN32
81 TESTS := $(filter-out 24_math_library.test 28_strings.test,$(TESTS))
82 endif
84 %.test: %.c %.expect
85 @echo Test: $*...
86 @if [ "x`echo $* | grep args`" != "x" ]; \
87 then $(TCC) $< -norunsrc -run $(notdir $<) - arg1 arg2 arg3 arg4 >$*.output; \
88 else $(TCC) -run $< >$*.output; \
90 @if diff -bu $(<:.c=.expect) $*.output ; \
91 then rm -f $*.output; \
92 else exit 1; \
95 all test: $(TESTS)
97 clean:
98 rm -vf fred.txt *.output
100 Makefile: $(top_srcdir)/tests/tests2/Makefile
101 cp $< $@