Statistics
| Branch: | Revision:

root / tests / Makefile @ a986fcc4

History | View | Annotate | Download (2.7 kB)

1
-include ../config-host.mak
2

    
3
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
4
#CFLAGS+=-msse2
5
LDFLAGS=
6

    
7
ifeq ($(ARCH),i386)
8
TESTS=linux-test testthread sha1-i386 test-i386
9
endif
10
ifeq ($(ARCH),x86_64)
11
TESTS=test-x86_64
12
endif
13
TESTS+=sha1# test_path
14
#TESTS+=test_path
15
#TESTS+=runcom
16

    
17
QEMU=../i386-linux-user/qemu-i386
18

    
19
all: $(TESTS)
20

    
21
hello-i386: hello-i386.c
22
	$(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
23
	strip $@
24

    
25
testthread: testthread.c
26
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread
27

    
28
test_path: test_path.c
29
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
30
	./$@ || { rm $@; exit 1; }
31

    
32
# i386/x86_64 emulation test (test various opcodes) */
33
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
34
           test-i386.h test-i386-shift.h test-i386-muldiv.h
35
	$(CC) -m32 $(CFLAGS) $(LDFLAGS) -static -o $@ \
36
              test-i386.c test-i386-code16.S test-i386-vm86.S -lm
37

    
38
test-x86_64: test-i386.c \
39
           test-i386.h test-i386-shift.h test-i386-muldiv.h
40
	$(CC) -m64 $(CFLAGS) $(LDFLAGS) -static -o $@ test-i386.c -lm
41

    
42
ifeq ($(ARCH),i386)
43
test: test-i386
44
	./test-i386 > test-i386.ref
45
else
46
test:
47
endif
48
	$(QEMU) test-i386 > test-i386.out
49
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
50

    
51
.PHONY: test-mmap
52
test-mmap: test-mmap.c
53
	$(CC) $(CFLAGS) -Wall -static -O2 $(LDFLAGS) -o $@ $<
54
	-./test-mmap
55
	-$(QEMU) ./test-mmap
56
	-$(QEMU) -p 8192 ./test-mmap 8192
57
	-$(QEMU) -p 16384 ./test-mmap 16384
58
	-$(QEMU) -p 32768 ./test-mmap 32768
59

    
60
# generic Linux and CPU test
61
linux-test: linux-test.c
62
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm
63

    
64
# speed test
65
sha1-i386: sha1.c
66
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
67

    
68
sha1: sha1.c
69
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
70

    
71
speed: sha1 sha1-i386
72
	time ./sha1
73
	time $(QEMU) ./sha1-i386
74

    
75
# vm86 test
76
runcom: runcom.c
77
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
78

    
79
# NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
80
qruncom: qruncom.c ../i386-user/libqemu.a
81
	$(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \
82
              -o $@ $< -L../i386-user -lqemu -lm
83

    
84
# arm test
85
hello-arm: hello-arm.o
86
	arm-linux-ld -o $@ $<
87

    
88
hello-arm.o: hello-arm.c
89
	arm-linux-gcc -Wall -g -O2 -c -o $@ $<
90

    
91
test-arm-iwmmxt: test-arm-iwmmxt.s
92
	cpp < $< | arm-linux-gnu-gcc -Wall -static -march=iwmmxt -mabi=aapcs -x assembler - -o $@
93

    
94
# MIPS test
95
hello-mips: hello-mips.c
96
	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
97

    
98
hello-mipsel: hello-mips.c
99
	mipsel-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<
100

    
101
# testsuite for the CRIS port.
102
test-cris:
103
	$(MAKE) -C cris check
104

    
105
clean:
106
	rm -f *~ *.o test-i386.out test-i386.ref \
107
           test-x86_64.log test-x86_64.ref qruncom $(TESTS)