Makefile 1.6 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 41
	@if diff -u test-i386.ref test-i386.out ; then echo "Auto Test OK"; fi

B
bellard 已提交
42 43 44 45
# generic Linux and CPU test
linux-test: linux-test.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< -lm

B
bellard 已提交
46
# speed test
B
bellard 已提交
47
sha1-i386: sha1.c
B
bellard 已提交
48 49
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
50 51 52 53
sha1: sha1.c
	$(HOST_CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

speed: sha1 sha1-i386
B
bellard 已提交
54
	time ./sha1
B
bellard 已提交
55
	time $(QEMU) ./sha1-i386
B
bellard 已提交
56

B
bellard 已提交
57 58 59 60
# vm86 test
runcom: runcom.c
	$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $<

B
bellard 已提交
61 62 63 64 65 66 67
# 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 已提交
68 69 70 71 72 73
# 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 已提交
74 75
clean:
	rm -f *~ *.o $(TESTS)