blob: 1734fe5c89be0263ea2dc20b65284f0773079234 [file] [log] [blame]
Eric Biedermanb138ac82003-04-22 18:44:01 +00001# Move the configuration defines to makefile.conf
Eric Biederman584997b2003-06-25 11:34:59 +00002CC=gcc
Eric Biederman90089602004-05-28 14:11:54 +00003CPPFLAGS=
Eric Biedermanf7a0ba82003-06-19 15:14:52 +00004CFLAGS= -g -Wall $(CPPFLAGS)
Eric Biederman05f26fc2003-06-11 21:55:00 +00005CPROF_FLAGS=-pg -fprofile-arcs
Eric Biedermanb138ac82003-04-22 18:44:01 +00006
7all: romcc test
8
9romcc: romcc.c Makefile
10 $(CC) $(CFLAGS) -o $@ $<
11
Eric Biederman05f26fc2003-06-11 21:55:00 +000012romcc_pg: romcc.c Makefile
13 $(CC) $(CFLAGS) $(CPROF_FLAGS) -o $@ $<
14
Eric Biederman83b991a2003-10-11 06:20:25 +000015LINUX_TESTS=\
16 linux_test1.c \
17 linux_test2.c \
18 linux_test3.c \
19 linux_test4.c \
20 linux_test5.c \
21 linux_test6.c \
22 linux_test7.c \
Eric Biederman5ade04a2003-10-22 04:03:46 +000023 linux_test8.c \
Eric Biederman90089602004-05-28 14:11:54 +000024 linux_test9.c \
25 linux_test10.c \
26 linux_test11.c \
27 linux_test12.c \
28 linux_test13.c \
Eric Biederman83b991a2003-10-11 06:20:25 +000029
Eric Biedermanb138ac82003-04-22 18:44:01 +000030TESTS=\
Eric Biederman90089602004-05-28 14:11:54 +000031 hello_world1.c \
Eric Biedermanf7a0ba82003-06-19 15:14:52 +000032 hello_world2.c \
Eric Biederman90089602004-05-28 14:11:54 +000033 simple_test1.c \
Eric Biedermanb138ac82003-04-22 18:44:01 +000034 simple_test2.c \
35 simple_test3.c \
36 simple_test4.c \
37 simple_test5.c \
38 simple_test6.c \
39 simple_test7.c \
40 simple_test8.c \
41 simple_test9.c \
42 simple_test10.c \
43 simple_test11.c \
44 simple_test12.c \
45 simple_test13.c \
46 simple_test14.c \
47 simple_test15.c \
Eric Biederman0babc1c2003-05-09 02:39:00 +000048 simple_test16.c \
49 simple_test17.c \
50 simple_test18.c \
51 simple_test19.c \
Eric Biedermana96d6a92003-05-13 20:45:19 +000052 simple_test20.c \
Eric Biederman6aa31cc2003-06-10 21:22:07 +000053 simple_test21.c \
Eric Biederman6aa31cc2003-06-10 21:22:07 +000054 simple_test23.c \
55 simple_test24.c \
56 simple_test25.c \
57 simple_test26.c \
58 simple_test27.c \
59 simple_test28.c \
60 simple_test29.c \
Eric Biederman05f26fc2003-06-11 21:55:00 +000061 simple_test31.c \
Eric Biederman8d9c1232003-06-17 08:42:17 +000062 simple_test32.c \
Eric Biedermand3283ec2003-06-18 11:03:18 +000063 simple_test33.c \
Eric Biedermanf7a0ba82003-06-19 15:14:52 +000064 simple_test34.c \
65 simple_test35.c \
66 simple_test36.c \
67 simple_test37.c \
Eric Biedermand1ea5392003-06-28 06:49:45 +000068 simple_test40.c \
69 simple_test41.c \
Eric Biedermand1ea5392003-06-28 06:49:45 +000070 simple_test43.c \
Eric Biedermand1ea5392003-06-28 06:49:45 +000071 simple_test45.c \
72 simple_test46.c \
73 simple_test47.c \
Eric Biederman530b5192003-07-01 10:05:30 +000074 simple_test48.c \
75 simple_test49.c \
76 simple_test50.c \
77 simple_test51.c \
78 simple_test52.c \
79 simple_test53.c \
Eric Biederman66fe2222003-07-04 15:14:04 +000080 simple_test55.c \
81 simple_test56.c \
Eric Biederman83b991a2003-10-11 06:20:25 +000082 simple_test57.c \
83 simple_test58.c \
84 simple_test60.c \
85 simple_test61.c \
86 simple_test62.c \
87 simple_test63.c \
88 simple_test64.c \
89 simple_test65.c \
90 simple_test66.c \
91 simple_test67.c \
92 simple_test68.c \
Eric Biederman5ade04a2003-10-22 04:03:46 +000093 simple_test69.c \
Eric Biederman90089602004-05-28 14:11:54 +000094 simple_test70.c \
Eric Biederman5ade04a2003-10-22 04:03:46 +000095 simple_test71.c \
96 simple_test72.c \
97 simple_test73.c \
Eric Biederman90089602004-05-28 14:11:54 +000098 simple_test74.c \
99 simple_test75.c \
100 simple_test76.c \
101 simple_test77.c \
102 simple_test78.c \
103 simple_test79.c \
104 simple_test80.c \
105 simple_test81.c \
106 simple_test82.c \
107 simple_test83.c \
108 simple_test84.c \
109 simple_test85.c \
110 simple_test86.c \
Yinghai Lu13f1c2a2005-07-08 02:49:49 +0000111 simple_test87.c \
112 simple_test88.c \
113 simple_test89.c \
114 simple_test90.c \
Eric Biederman90089602004-05-28 14:11:54 +0000115 raminit_test1.c \
Eric Biederman6aa31cc2003-06-10 21:22:07 +0000116 raminit_test2.c \
Eric Biedermanf96a8102003-06-16 16:57:34 +0000117 raminit_test3.c \
Eric Biederman530b5192003-07-01 10:05:30 +0000118 raminit_test4.c \
Eric Biederman83b991a2003-10-11 06:20:25 +0000119 raminit_test5.c \
120 raminit_test6.c \
121 $(LINUX_TESTS)
Eric Biedermanb138ac82003-04-22 18:44:01 +0000122
Eric Biedermand1ea5392003-06-28 06:49:45 +0000123FAIL_TESTS = \
Eric Biederman66fe2222003-07-04 15:14:04 +0000124 fail_test1.c \
125 fail_test2.c \
Eric Biederman83b991a2003-10-11 06:20:25 +0000126 fail_test3.c \
127 fail_test4.c \
128 fail_test5.c \
Eric Biederman5cd81732004-03-11 15:01:31 +0000129 fail_test6.c \
130 fail_test7.c \
131 fail_test8.c \
Eric Biederman90089602004-05-28 14:11:54 +0000132 fail_test9.c \
133 fail_test10.c \
134 fail_test11.c \
Eric Biedermand1ea5392003-06-28 06:49:45 +0000135
Eric Biedermanb138ac82003-04-22 18:44:01 +0000136TEST_SRCS:=$(patsubst %, tests/%, $(TESTS))
137TEST_ASM:=$(patsubst %.c, tests/%.S, $(TESTS))
Eric Biederman83b991a2003-10-11 06:20:25 +0000138TEST_ASM_O:=$(patsubst %.c, tests/%.S-O, $(TESTS))
139TEST_ASM_O2:=$(patsubst %.c, tests/%.S-O2, $(TESTS))
140TEST_ASM_mmmx :=$(patsubst %.c, tests/%.S-mmmx, $(TESTS))
141TEST_ASM_msse :=$(patsubst %.c, tests/%.S-msse, $(TESTS))
142TEST_ASM_mmmx_msse:=$(patsubst %.c, tests/%.S-mmmx-msse, $(TESTS))
143TEST_ASM_O_mmmx :=$(patsubst %.c, tests/%.S-O-mmmx, $(TESTS))
144TEST_ASM_O_msse :=$(patsubst %.c, tests/%.S-O-msse, $(TESTS))
145TEST_ASM_O_mmmx_msse:=$(patsubst %.c, tests/%.S-O-mmmx-msse, $(TESTS))
146TEST_ASM_O2_mmmx :=$(patsubst %.c, tests/%.S-O2-mmmx, $(TESTS))
147TEST_ASM_O2_msse :=$(patsubst %.c, tests/%.S-O2-msse, $(TESTS))
148TEST_ASM_O2_mmmx_msse:=$(patsubst %.c, tests/%.S-O2-mmmx-msse, $(TESTS))
Eric Biederman5ade04a2003-10-22 04:03:46 +0000149TEST_ASM_O2_mmmx_call :=$(patsubst %.c, tests/%.S-O2-mmmx-call, $(TESTS))
150TEST_ASM_O2_mmmx_msse_call:=$(patsubst %.c, tests/%.S-O2-mmmx-msse-call, $(TESTS))
151TEST_ASM_ALL:= $(TEST_ASM) $(TEST_ASM_O) $(TEST_ASM_O2) $(TEST_ASM_mmmx) $(TEST_ASM_msse) $(TEST_ASM_mmmx_msse) $(TEST_ASM_O_mmmx) $(TEST_ASM_O_msse) $(TEST_ASM_O_mmmx_msse) $(TEST_ASM_O2_mmmx) $(TEST_ASM_O2_msse) $(TEST_ASM_O2_mmmx_msse) $(TEST_ASM_O2_mmmx_call) $(TEST_ASM_O2_mmmx_msse_call)
Eric Biederman90089602004-05-28 14:11:54 +0000152TEST_ASM_MOST:= $(TEST_ASM_O) $(TEST_ASM_O_mmmx) $(TEST_ASM_O_msse) $(TEST_ASM_O_mmmx_msse) $(TEST_ASM_O2) $(TEST_ASM_O2_mmmx) $(TEST_ASM_O2_msse) $(TEST_ASM_O2_mmmx_msse)
153# $(TEST_ASM_O2_mmmx_call) $(TEST_ASM_O2_mmmx_msse_call)
Eric Biedermanb138ac82003-04-22 18:44:01 +0000154TEST_OBJ:=$(patsubst %.c, tests/%.o, $(TESTS))
155TEST_ELF:=$(patsubst %.c, tests/%.elf, $(TESTS))
Eric Biederman83b991a2003-10-11 06:20:25 +0000156LINUX_ELF:=$(patsubst %.c, tests/%.elf, $(LINUX_TESTS))
157LINUX_OUT:=$(patsubst %.c, tests/%.out, $(LINUX_TESTS))
Eric Biedermanb138ac82003-04-22 18:44:01 +0000158
Eric Biedermand1ea5392003-06-28 06:49:45 +0000159FAIL_SRCS:=$(patsubst %, tests/%, $(FAIL_TESTS))
160FAIL_OUT:=$(patsubst %.c, tests/%.out, $(FAIL_TESTS))
161
162
Eric Biederman90089602004-05-28 14:11:54 +0000163ROMCC_OPTS=-fmax-allocation-passes=8 -fdebug-live-range-conflicts -Itests/include
Eric Biederman5ade04a2003-10-22 04:03:46 +0000164
Eric Biedermanb138ac82003-04-22 18:44:01 +0000165$(TEST_ASM): %.S: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000166 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000167
168$(TEST_ASM_O): %.S-O: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000169 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000170
171$(TEST_ASM_O2): %.S-O2: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000172 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000173
174
175$(TEST_ASM_mmmx): %.S-mmmx: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000176 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -mmmx -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000177
178$(TEST_ASM_msse): %.S-msse: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000179 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -msse -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000180
181$(TEST_ASM_mmmx_msse): %.S-mmmx-msse: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000182 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -mmmx -msse -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000183
184
185$(TEST_ASM_O_mmmx): %.S-O-mmmx: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000186 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -mmmx -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000187
188$(TEST_ASM_O_msse): %.S-O-msse: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000189 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -msse -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000190
191$(TEST_ASM_O_mmmx_msse): %.S-O-mmmx-msse: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000192 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O -mmmx -msse -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000193
194
195$(TEST_ASM_O2_mmmx): %.S-O2-mmmx: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000196 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000197
198$(TEST_ASM_O2_msse): %.S-O2-msse: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000199 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -msse -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000200
201$(TEST_ASM_O2_mmmx_msse): %.S-O2-mmmx-msse: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000202 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -msse -o $@ $< > $*.debug
203
204$(TEST_ASM_O2_mmmx_call): %.S-O2-mmmx-call: %.c romcc
205 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -fno-always-inline -o $@ $< > $*.debug
206
207$(TEST_ASM_O2_mmmx_msse_call): %.S-O2-mmmx-msse-call: %.c romcc
208 export ALLOC_CHECK_=2; ./romcc $(ROMCC_OPTS) -O2 -mmmx -msse -fno-always-inline -o $@ $< > $*.debug
Eric Biederman83b991a2003-10-11 06:20:25 +0000209
Eric Biedermand1ea5392003-06-28 06:49:45 +0000210
211$(FAIL_OUT): %.out: %.c romcc
Eric Biederman5ade04a2003-10-22 04:03:46 +0000212 export ALLOC_CHECK_=2; if ./romcc $(ROMCC_OPTS) -O2 -o $*.S $< > $*.debug 2> $@ ; then exit 1 ; else exit 0 ; fi
Eric Biedermanb138ac82003-04-22 18:44:01 +0000213
Eric Biederman90089602004-05-28 14:11:54 +0000214#$(TEST_OBJ): %.o: %.S-O2-mmmx-call
215
Eric Biederman83b991a2003-10-11 06:20:25 +0000216$(TEST_OBJ): %.o: %.S-O2-mmmx
Eric Biedermanb138ac82003-04-22 18:44:01 +0000217 as $< -o $@
218
Eric Biederman6aa31cc2003-06-10 21:22:07 +0000219$(TEST_ELF): %.elf: %.o tests/ldscript.ld
220 ld -T tests/ldscript.ld $< -o $@
Eric Biedermanb138ac82003-04-22 18:44:01 +0000221
Eric Biederman83b991a2003-10-11 06:20:25 +0000222$(LINUX_OUT): %.out: %.elf
223 ./$< > $@
224
225test: $(TEST_ELF) $(FAIL_OUT) $(TEST_ASM_MOST)
226
227run_linux: $(LINUX_OUT)
Eric Biedermanb138ac82003-04-22 18:44:01 +0000228
229echo:
230 echo "TEST_SRCS=$(TEST_SRCS)"
231 echo "TEST_ASM=$(TEST_ASM)"
Eric Biederman90089602004-05-28 14:11:54 +0000232 echo "TEST_ASM=$(TEST_ASM_MOST)"
Eric Biedermanb138ac82003-04-22 18:44:01 +0000233 echo "TEST_OBJ=$(TEST_OBJ)"
234 echo "TEST_ELF=$(TEST_ELF)"
Eric Biedermand1ea5392003-06-28 06:49:45 +0000235 echo ""
236 echo "FAIL_SRCS=$(FAIL_SRCS)"
237 echo "FAIL_ASM=$(FAIL_ASM)"
Eric Biedermanb138ac82003-04-22 18:44:01 +0000238
239clean:
Eric Biederman83b991a2003-10-11 06:20:25 +0000240 rm -f romcc romcc_pg core $(TEST_ASM_ALL) $(TEST_OBJ) $(TEST_ELF) tests/*.debug tests/*.debug2 tests/*.gmon.out tests/*.out
Eric Biedermanb138ac82003-04-22 18:44:01 +0000241