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

B
bellard 已提交
3 4 5
CFLAGS=-Wall -O2 -g
LDFLAGS=

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

B
update  
bellard 已提交
12
QEMU=../i386-user/qemu-i386
B
bellard 已提交
13 14 15

all: $(TESTS)

B
bellard 已提交
16
hello-i386: hello-i386.c
B
bellard 已提交
17
	$(CC) -nostdlib $(CFLAGS) -static $(LDFLAGS) -o $@ $<
B
bellard 已提交
18
	strip $@
B
bellard 已提交
19

B
bellard 已提交
20 21 22
testthread: testthread.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lpthread

B
update  
bellard 已提交
23 24 25 26
test_path: test_path.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<
	./$@ || { rm $@; exit 1; }

B
bellard 已提交
27
# i386 emulation test (test various opcodes) */
B
bellard 已提交
28
test-i386: test-i386.c test-i386-code16.S test-i386-vm86.S \
B
bellard 已提交
29
           test-i386.h test-i386-shift.h test-i386-muldiv.h
B
bellard 已提交
30
	$(CC) $(CFLAGS) $(LDFLAGS) -static -o $@ test-i386.c \
B
bellard 已提交
31
              test-i386-code16.S test-i386-vm86.S -lm
B
bellard 已提交
32

B
bellard 已提交
33
ifeq ($(ARCH),i386)
B
bellard 已提交
34
test: test-i386
B
bellard 已提交
35
	./test-i386 > test-i386.ref
B
bellard 已提交
36 37
else
test:
B
bellard 已提交
38
endif
B
bellard 已提交
39
	$(QEMU) test-i386 > test-i386.out
B
bellard 已提交
40
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi
B
bellard 已提交
41 42 43 44
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 已提交
45

B
bellard 已提交
46 47 48 49
# generic Linux and CPU test
linux-test: linux-test.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm

B
bellard 已提交
50
# speed test
B
bellard 已提交
51
sha1-i386: sha1.c
B
bellard 已提交
52 53
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
54 55 56 57
sha1: sha1.c
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

speed: sha1 sha1-i386
B
bellard 已提交
58
	time ./sha1
B
bellard 已提交
59
	time $(QEMU) ./sha1-i386
B
bellard 已提交
60

B
bellard 已提交
61 62 63 64
# vm86 test
runcom: runcom.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
65 66 67 68 69
# NOTE: -fomit-frame-pointer is currently needed : this is a bug in libqemu
qruncom: qruncom.c ../i386-user/libqemu.a
	$(CC) $(CFLAGS) -fomit-frame-pointer $(LDFLAGS) -I../target-i386 -I.. -I../i386-user \
              -o $@ $< -L../i386-user -lqemu -lm

B
bellard 已提交
70 71 72 73 74 75 76
# 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 $@ $<

B
bellard 已提交
77 78 79 80 81 82
# XXX: find a way to compile easily a test for each arch
test2:
	@for arch in i386 arm sparc ppc; do \
           ../$${arch}-user/qemu-$${arch} $${arch}/ls -l linux-test.c ; \
        done

B
bellard 已提交
83
clean:
B
update  
bellard 已提交
84
	rm -f *~ *.o test-i386.out test-i386.ref qruncom $(TESTS)