preliminary patch to fix http://lists.nongnu.org/archive/html/tinycc-devel/2015-04...
[tinycc.git] / tests / tests2 / Makefile
blob97c22dcdfe9d032f721a0349dafcdb1e92744a79
1 TOP = ../..
2 include $(TOP)/Makefile
4 # clear CFLAGS and LDFLAGS
5 CFLAGS :=
6 LDFLAGS :=
8 ifdef CONFIG_WIN32
9 TCCFLAGS = -B$(top_srcdir)/win32 -I$(top_srcdir)/include -L$(TOP)
10 else
11 TCCFLAGS = -B$(TOP) -I$(top_srcdir)/include -lm
12 endif
14 ifeq ($(TARGETOS),Darwin)
15 CFLAGS += -Wl,-flat_namespace,-undefined,warning
16 TCCFLAGS += -D_ANSI_SOURCE
17 export MACOSX_DEPLOYMENT_TARGET:=10.2
18 endif
20 TCC = $(TOP)/tcc $(TCCFLAGS)
22 TESTS = \
23 00_assignment.test \
24 01_comment.test \
25 02_printf.test \
26 03_struct.test \
27 04_for.test \
28 05_array.test \
29 06_case.test \
30 07_function.test \
31 08_while.test \
32 09_do_while.test \
33 10_pointer.test \
34 11_precedence.test \
35 12_hashdefine.test \
36 13_integer_literals.test \
37 14_if.test \
38 15_recursion.test \
39 16_nesting.test \
40 17_enum.test \
41 18_include.test \
42 19_pointer_arithmetic.test \
43 20_pointer_comparison.test \
44 21_char_array.test \
45 22_floating_point.test \
46 23_type_coercion.test \
47 24_math_library.test \
48 25_quicksort.test \
49 26_character_constants.test \
50 27_sizeof.test \
51 28_strings.test \
52 29_array_address.test \
53 30_hanoi.test \
54 31_args.test \
55 32_led.test \
56 33_ternary_op.test \
57 34_array_assignment.test \
58 35_sizeof.test \
59 36_array_initialisers.test \
60 37_sprintf.test \
61 38_multiple_array_index.test \
62 39_typedef.test \
63 40_stdio.test \
64 41_hashif.test \
65 42_function_pointer.test \
66 43_void_param.test \
67 44_scoped_declarations.test \
68 45_empty_for.test \
69 46_grep.test \
70 47_switch_return.test \
71 48_nested_break.test \
72 49_bracket_evaluation.test \
73 50_logical_second_arg.test \
74 51_static.test \
75 52_unnamed_enum.test \
76 54_goto.test \
77 55_lshift_type.test \
78 56_btype_excess-1.test \
79 57_btype_excess-2.test \
80 58_function_redefinition.test \
81 59_function_array.test \
82 60_enum_redefinition.test \
83 61_undefined_enum.test \
84 62_enumerator_redefinition.test \
85 63_local_enumerator_redefinition.test \
86 64_macro_nesting.test \
87 65_macro_concat_start.test \
88 66_macro_concat_end.test \
89 67_macro_concat.test \
90 68_macro_param_list_err_1.test \
91 69_macro_param_list_err_2.test \
92 70_floating_point_literals.test \
93 71_macro_empty_arg.test \
94 72_long_long_constant.test \
95 73_arm64.test \
96 74_nocode_wanted.test \
97 75_array_in_struct_init.test \
98 76_dollars_in_identifiers.test \
99 77_push_pop_macro.test \
100 78_vla_label.test \
101 79_vla_continue.test \
102 80_macros.test
104 # 34_array_assignment.test -- array assignment is not in C standard
106 SKIP = 34_array_assignment.test
108 # some tests do not pass on all platforms, remove them for now
109 ifeq ($(CONFIG_arm_eabi),yes) # not ARM soft-float
110 SKIP += 22_floating_point.test
111 endif
112 ifeq ($(TARGETOS),Darwin)
113 SKIP += 40_stdio.test
114 endif
115 ifdef CONFIG_WIN32
116 SKIP += 24_math_library.test # don't have round()
117 SKIP += 28_strings.test # don't have r/index() / strings.h
118 endif
119 ifeq ($(ARCH),x86-64)
120 SKIP += 73_arm64.test
121 endif
123 # Some tests might need arguments
124 ARGS =
125 31_args.test : ARGS = arg1 arg2 arg3 arg4 arg5
126 46_grep.test : ARGS = '[^* ]*[:a:d: ]+\:\*-/: $$' 46_grep.c
128 # Some tests might need different flags
129 FLAGS =
130 76_dollars_in_identifiers.test : FLAGS = -fdollars-in-identifiers
132 all test: $(filter-out $(SKIP),$(TESTS))
134 %.test: %.c
135 @echo Test: $*...
137 @$(TCC) -run $(FLAGS) $< $(ARGS) 2>&1 | grep -v 'warning: soft float ABI currently not supported: default to softfp' >$*.output || true
138 @diff -Nbu $*.expect $*.output && rm -f $*.output
140 @($(TCC) $(FLAGS) $< -o $*.exe && ./$*.exe $(ARGS)) 2>&1 | grep -v 'warning: soft float ABI currently not supported: default to softfp' >$*.output2 || true
141 @diff -Nbu $*.expect $*.output2 && rm -f $*.output2 $*.exe
143 clean:
144 rm -vf fred.txt *.output* *.exe