first multi target test (lauches 'ls')
[qemu] / tests / Makefile
1 include ../config-host.mak
2
3 CFLAGS=-Wall -O2 -g
4 LDFLAGS=
5
6 ifeq ($(ARCH),i386)
7 TESTS=linux-test testthread sha1-i386 test-i386 runcom
8 endif
9 TESTS+=sha1# test_path
10 #TESTS+=test_path
11
12 QEMU=../i386-user/qemu-i386
13
14 all: $(TESTS)
15
16 hello-i386: hello-i386.c
17         $(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
18         strip $@
19
20 testthread: testthread.c
21         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
22
23 test_path: test_path.c
24         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
25         ./$@ || { rm $@; exit 1; }
26
27 # i386 emulation test (test various opcodes) */
28 test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
29            test-i386.h test-i386-shift.h test-i386-muldiv.h
30         $(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ test-i386.c \
31               test-i386-code16.S test-i386-vm86.S -lm
32
33 ifeq ($(ARCH),i386)
34 test: test-i386
35         ./test-i386 > test-i386.ref
36 else
37 test:
38 endif
39         $(QEMU) test-i386 > test-i386.out
40         @if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
41
42 # generic Linux and CPU test
43 linux-test: linux-test.c
44         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
45
46 # speed test
47 sha1-i386: sha1.c
48         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
49
50 sha1: sha1.c
51         $(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
52
53 speed: sha1 sha1-i386
54         time ./sha1
55         time $(QEMU) ./sha1-i386
56
57 # vm86 test
58 runcom: runcom.c
59         $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
60
61 # arm test
62 hello-arm: hello-arm.o
63         arm-linux-ld -o $@ $<
64
65 hello-arm.o: hello-arm.c
66         arm-linux-gcc -Wall -g -O2 -c -o $@ $<
67
68 # XXX: find a way to compile easily a test for each arch
69 test2:
70         @for arch in i386 arm sparc ppc; do \
71            ../$${arch}-user/qemu-$${arch} $${arch}/ls -l linux-test.c ; \
72         done
73
74 clean:
75         rm -f *~ *.o $(TESTS)