Makefile 2.6 KB
Newer Older
B
bellard 已提交
1
-include ../config-host.mak
B
bellard 已提交
2

B
bellard 已提交
3
CFLAGS=-Wall -O2 -g -fno-strict-aliasing
B
bellard 已提交
4
#CFLAGS+=-msse2
B
bellard 已提交
5 6
LDFLAGS=

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

B
bellard 已提交
16
QEMU=../i386-linux-user/qemu-i386
B
bellard 已提交
17 18 19

all: $(TESTS)

B
bellard 已提交
20
hello-i386: hello-i386.c
B
bellard 已提交
21
	$(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
B
bellard 已提交
22
	strip $@
B
bellard 已提交
23

B
bellard 已提交
24 25 26
testthread: testthread.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread

B
update  
bellard 已提交
27 28 29 30
test_path: test_path.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
	./$@ || { rm $@; exit 1; }

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

test-x86_64: test-i386.c \
           test-i386.h test-i386-shift.h test-i386-muldiv.h
	$(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ test-i386.c -lm
B
bellard 已提交
40

B
bellard 已提交
41
ifeq ($(ARCH),i386)
B
bellard 已提交
42
test: test-i386
B
bellard 已提交
43
	./test-i386 > test-i386.ref
B
bellard 已提交
44 45
else
test:
B
bellard 已提交
46
endif
B
bellard 已提交
47
	$(QEMU) test-i386 > test-i386.out
B
bellard 已提交
48
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
B
bellard 已提交
49 50 51 52
ifeq ($(ARCH),i386)
	$(QEMU) -no-code-copy test-i386 > test-i386.out
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK (no code copy)"; fi
endif
B
bellard 已提交
53

B
bellard 已提交
54 55 56 57
# generic Linux and CPU test
linux-test: linux-test.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm

B
bellard 已提交
58
# speed test
B
bellard 已提交
59
sha1-i386: sha1.c
B
bellard 已提交
60 61
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
62 63 64 65
sha1: sha1.c
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

speed: sha1 sha1-i386
B
bellard 已提交
66
	time ./sha1
B
bellard 已提交
67
	time $(QEMU) ./sha1-i386
B
bellard 已提交
68

B
bellard 已提交
69 70 71 72
# vm86 test
runcom: runcom.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
73 74
# NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
qruncom: qruncom.c ../i386-user/libqemu.a
75
	$(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user -I../fpu \
B
bellard 已提交
76 77
              -o $@ $< -L../i386-user -lqemu -lm

B
bellard 已提交
78 79 80 81 82 83 84
# arm test
hello-arm: hello-arm.o
	arm-linux-ld -o $@ $<

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

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

88 89 90 91 92 93 94
# MIPS test
hello-mips: hello-mips.c
	mips-linux-gnu-gcc -nostdlib -static -mno-abicalls -fno-PIC -mabi=32 -Wall -Wextra -g -O2 -o $@ $<

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

95 96 97 98
# testsuite for the CRIS port.
test-cris:
	$(MAKE) -C cris check

B
bellard 已提交
99
clean:
B
bellard 已提交
100 101
	rm -f *~ *.o test-i386.out test-i386.ref \
           test-x86_64.log test-x86_64.ref qruncom $(TESTS)